+++ /dev/null
-//
-// 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")]
+++ /dev/null
-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
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, 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
- }
-}
+++ /dev/null
-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
-
+++ /dev/null
- 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
-
+++ /dev/null
- 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!
-
+++ /dev/null
-thisdir = class/Managed.Windows.Forms
-include ../../build/rules.make
-
-LIBRARY = System.Windows.Forms.dll
-LIB_MCS_FLAGS = /unsafe /codepage:65001 \
- /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
-
-RESOURCES = \
- resources/System.Windows.Forms.resources \
- resources/System.Windows.Forms.en.resources \
- resources/System.Windows.Forms.de.resources
-
-PREBUILT = $(RESOURCES:=.prebuilt)
-
-EXTRA_DISTFILES = \
- README System.Windows.Forms.dll.resources \
- $(RESOURCES:.resources=.resx) $(PREBUILT) build-csproj
-
-TEST_MCS_FLAGS = /r:System.Drawing.dll
-
-SWF.csproj: System.Windows.Forms.dll.sources
- ./build-csproj
-
-include ../../build/library.make
-
-$(the_lib): $(RESOURCES) SWF.csproj
-
-$(RESOURCES): %.resources: %.resx
- $(RESGEN) $< || cp $@.prebuilt $@
-
-$(PREBUILT): %.prebuilt: %
- cp $* $@
-
-dist-default: $(PREBUILT)
+++ /dev/null
- 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.
+++ /dev/null
-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.
+++ /dev/null
-<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\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\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\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"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
+++ /dev/null
-Microsoft Visual Studio Solution File, Format Version 8.00\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWF", "SWF.csproj", "{5E6430B2-6B9F-4E76-802E-20207EF80391}"\r
- ProjectSection(ProjectDependencies) = postProject\r
- EndProjectSection\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfiguration) = preSolution\r
- Debug = Debug\r
- Release = Release\r
- EndGlobalSection\r
- GlobalSection(ProjectConfiguration) = postSolution\r
- {5E6430B2-6B9F-4E76-802E-20207EF80391}.Debug.ActiveCfg = Debug|.NET\r
- {5E6430B2-6B9F-4E76-802E-20207EF80391}.Debug.Build.0 = Debug|.NET\r
- {5E6430B2-6B9F-4E76-802E-20207EF80391}.Release.ActiveCfg = Release|.NET\r
- {5E6430B2-6B9F-4E76-802E-20207EF80391}.Release.Build.0 = Release|.NET\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityAddIns) = postSolution\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-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
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- {
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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) {
- TypeConverter c = TypeDescriptor.GetConverter (tt);
- v = c.ConvertFromString (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);
- }
-
- 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
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;\r
- 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.WriteAttributeString ("mimetype", "application/x-microsoft.net.object.bytearray.base64");
- 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)
- {
- writer.WriteStartElement ("data");
- writer.WriteAttributeString ("name", name);
- 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 (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.ConvertTo (value, typeof (string));
- WriteString (name, str);
- 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);
- }
-
- 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 ("'", "\"");
- }
-}
-
+++ /dev/null
-2005-05-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
- * EventsTab.cs: Implementation start with many gaping holes
-\r
-2005-05-09 Marek Safar <marek.safar@seznam.cz>
-
- * PropertyTab.cs: Implemented.
-\r
-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.
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.Windows.Forms;
-namespace System.Windows.Forms.Design {
- 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){
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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]
- public 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;
- }
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 { \r
- get {\r
- if (bitmap == null) {\r
- Type t = base.GetType();\r
- bitmap = new Bitmap (t, t.Name + ".bmp");\r
- }\r
- return bitmap;\r
- }\r
- }\r
-\r
- public virtual object[] Components { \r
- get { return components; }\r
- set { components = value; }\r
- }\r
-\r
- public virtual string HelpKeyword { \r
- get { return TabName; }\r
- }\r
-\r
- public abstract string TabName { get; }
-
- public virtual bool CanExtend (object extendee)\r
- {\r
- return true;\r
- }\r
-\r
- public virtual void Dispose()\r
- {\r
- Dispose (true);\r
- GC.SuppressFinalize (this);\r
- }\r
-\r
- protected virtual void Dispose(bool disposing)\r
- {\r
- if (disposing && bitmap != null) {\r
- bitmap.Dispose ();\r
- bitmap = null;\r
- }\r
- }\r
-\r
- public virtual PropertyDescriptor GetDefaultProperty (object component)\r
- {\r
- return TypeDescriptor.GetDefaultProperty(component);\r
- }\r
-\r
- public virtual PropertyDescriptorCollection GetProperties (object component)\r
- {\r
- return GetProperties (component, null);\r
- }\r
-\r
- public abstract PropertyDescriptorCollection GetProperties (object component, Attribute[] attributes);\r
-\r
- public virtual PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object component, Attribute[] attributes)\r
- {\r
- return GetProperties (component, attributes);\r
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
- }
-}
+++ /dev/null
-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
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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,
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- #endregion // Local Variables
-
- #region Constructors
- public Font(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 {
- 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 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
-
- }
-}
+++ /dev/null
-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.
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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>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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-<VisualStudioProject>\r
- <CSHARP\r
- ProjectType = "Local"\r
- ProductVersion = "7.10.3077"\r
- SchemaVersion = "2.0"\r
- ProjectGuid = "{12D60959-776E-41E9-82BE-AA5DF4BB7CAE}"\r
- >\r
- <Build>\r
- <Settings\r
- ApplicationIcon = ""\r
- AssemblyKeyContainerName = ""\r
- AssemblyName = "rtf"\r
- AssemblyOriginatorKeyFile = ""\r
- DefaultClientScript = "JScript"\r
- DefaultHTMLPageLayout = "Grid"\r
- DefaultTargetSchema = "IE50"\r
- DelaySign = "false"\r
- OutputType = "Exe"\r
- PreBuildEvent = ""\r
- PostBuildEvent = ""\r
- RootNamespace = "rtf"\r
- RunPostBuildEvent = "OnBuildSuccess"\r
- StartupObject = ""\r
- >\r
- <Config\r
- Name = "Debug"\r
- AllowUnsafeBlocks = "false"\r
- BaseAddress = "285212672"\r
- CheckForOverflowUnderflow = "false"\r
- ConfigurationOverrideFile = ""\r
- DefineConstants = ""\r
- DocumentationFile = ""\r
- DebugSymbols = "true"\r
- FileAlignment = "4096"\r
- IncrementalBuild = "false"\r
- NoStdLib = "false"\r
- NoWarn = ""\r
- Optimize = "false"\r
- OutputPath = "bin\Debug\"\r
- RegisterForComInterop = "false"\r
- RemoveIntegerChecks = "false"\r
- TreatWarningsAsErrors = "false"\r
- WarningLevel = "1"\r
- />\r
- <Config\r
- Name = "Release"\r
- AllowUnsafeBlocks = "false"\r
- BaseAddress = "285212672"\r
- CheckForOverflowUnderflow = "false"\r
- ConfigurationOverrideFile = ""\r
- DefineConstants = ""\r
- DocumentationFile = ""\r
- DebugSymbols = "false"\r
- FileAlignment = "4096"\r
- IncrementalBuild = "false"\r
- NoStdLib = "false"\r
- NoWarn = ""\r
- Optimize = "false"\r
- OutputPath = "bin\Release\"\r
- RegisterForComInterop = "false"\r
- RemoveIntegerChecks = "false"\r
- TreatWarningsAsErrors = "false"\r
- WarningLevel = "1"\r
- />\r
- </Settings>\r
- <References>\r
- <Reference\r
- Name = "System.Drawing"\r
- AssemblyName = "System.Drawing"\r
- HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"\r
- />\r
- <Reference\r
- Name = "System"\r
- AssemblyName = "System"\r
- HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"\r
- />\r
- <Reference\r
- Name = "System.Windows.Forms"\r
- AssemblyName = "System.Windows.Forms"\r
- HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"\r
- />\r
- </References>\r
- </Build>\r
- <Files>\r
- <Include>\r
- <File\r
- RelPath = "Charcode.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "Charset.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "CharsetFlags.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "CharsetType.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "ClassDelegate.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "Color.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "DestinationDelegate.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "Font.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "KeysInit.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "KeyStruct.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "Major.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "Minor.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "RTF.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "RTFException.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "StandardCharCode.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "StandardCharName.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "Style.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "StyleElement.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "StyleType.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "test.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "TextMap.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- <File\r
- RelPath = "TokenClass.cs"\r
- SubType = "Code"\r
- BuildAction = "Compile"\r
- />\r
- </Include>\r
- </Files>\r
- </CSHARP>\r
-</VisualStudioProject>\r
-\r
+++ /dev/null
-<VisualStudioProject>\r
- <CSHARP LastOpenVersion = "7.10.3077" >\r
- <Build>\r
- <Settings ReferencePath = "" >\r
- <Config\r
- Name = "Debug"\r
- EnableASPDebugging = "false"\r
- EnableASPXDebugging = "false"\r
- EnableUnmanagedDebugging = "false"\r
- EnableSQLServerDebugging = "false"\r
- RemoteDebugEnabled = "false"\r
- RemoteDebugMachine = ""\r
- StartAction = "Project"\r
- StartArguments = ""\r
- StartPage = ""\r
- StartProgram = ""\r
- StartURL = ""\r
- StartWorkingDirectory = ""\r
- StartWithIE = "false"\r
- />\r
- <Config\r
- Name = "Release"\r
- EnableASPDebugging = "false"\r
- EnableASPXDebugging = "false"\r
- EnableUnmanagedDebugging = "false"\r
- EnableSQLServerDebugging = "false"\r
- RemoteDebugEnabled = "false"\r
- RemoteDebugMachine = ""\r
- StartAction = "Project"\r
- StartArguments = ""\r
- StartPage = ""\r
- StartProgram = ""\r
- StartURL = ""\r
- StartWorkingDirectory = ""\r
- StartWithIE = "false"\r
- />\r
- </Settings>\r
- </Build>\r
- <OtherProjectSettings\r
- CopyProjectDestinationFolder = ""\r
- CopyProjectUncPath = ""\r
- CopyProjectOption = "0"\r
- ProjectView = "ProjectFiles"\r
- ProjectTrust = "0"\r
- />\r
- </CSHARP>\r
-</VisualStudioProject>\r
-\r
+++ /dev/null
-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("\97");
- break;
- }
-
- case Minor.EnDash: {
- Console.Write("\96");
- break;
- }
-
- case Minor.LQuote: {
- Console.Write("\91");
- break;
- }
-
- case Minor.RQuote: {
- Console.Write("\92");
- break;
- }
-
- case Minor.LDblQuote: {
- Console.Write("\93");
- break;
- }
-
- case Minor.RDblQuote: {
- Console.Write("\94");
- 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();
- }
- }
-}
+++ /dev/null
--resource:resources/System.Windows.Forms.resources
--resource:resources/System.Windows.Forms.en.resources
--resource:resources/System.Windows.Forms.de.resources
+++ /dev/null
-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/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/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/IDataObject.cs
-System.Windows.Forms/IFeatureSupport.cs
-System.Windows.Forms/IFileReaderService.cs
-System.Windows.Forms/ImageIndexConverter.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/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/InvalidateEventArgs.cs
-System.Windows.Forms/InvalidateEventHandler.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/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/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/ProgressBar.cs
-System.Windows.Forms/PropertiesTab.cs
-System.Windows.Forms/PropertyGrid.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/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/Theme.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/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
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 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;
- private static bool exiting;
- private static InputLanguage input_language;
- private static bool messageloop_started;
- private static string safe_caption_format;
- private static ArrayList message_filters;
- private static ApplicationContext app_context;
-
- private Application () {
- input_language = InputLanguage.CurrentInputLanguage;
- message_filters = new ArrayList();
- app_context = null;
- browser_embedded= false;
- exiting = false;
- messageloop_started = false;
- safe_caption_format = "{1} - {0} - {2}";
- }
-
- #region Private and Internal Methods
- internal static void ModalRun(Form form) {
- MSG msg = new MSG();
- Queue toplevels = new Queue();
- IEnumerator control = Control.controls.GetEnumerator();
-
- if (form == null) {
- return;
- }
-
- // Both calls are needed, one is for the WM, the other for our focus logic
- XplatUI.Activate(form.window.Handle);
- form.Activate();
-
- while (control.MoveNext()) {
- if ((((Control)control.Current).parent == null) && (((Control)control.Current).is_visible) && (((Control)control.Current).is_enabled)) {
- if ((control.Current is Form) && (((Form)control.Current)!=form)) {
- XplatUI.EnableWindow(((Control)control.Current).window.Handle, false);
- toplevels.Enqueue((Control)control.Current);
- }
- }
- }
-
- form.CreateControl();
-
- while (!exiting && !form.end_modal && XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0)) {
- if ((message_filters != null) && (message_filters.Count > 0)) {
- Message m;
- bool drop;
-
- drop = false;
- m = new Message();
- m.Msg = (int)msg.message;
- m.HWnd = msg.hwnd;
- m.LParam = msg.lParam;
- m.WParam = msg.wParam;
- 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;
- }
- }
-
- XplatUI.TranslateMessage(ref msg);
- XplatUI.DispatchMessage(ref msg);
-
- // Handle exit, Form might have received WM_CLOSE and set 'closing' in response
- if (form.closing) {
- form.end_modal = true;
- }
- }
-
- while (toplevels.Count>0) {
- XplatUI.EnableWindow(((Control)toplevels.Dequeue()).window.Handle, true);
- }
- }
- #endregion // Private and Internal 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 ()
- {
- }
-#endif
-
- public static void Exit() {
- XplatUI.Exit();
- }
-
- public static void ExitThread() {
- exiting=true;
- }
-
- private static void InternalExit(object sender, EventArgs e) {
- Application.Exit();
- }
-
- 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 !later
- else {
- XplatUI.HandleException(t);
- }
-#else
- // TODO: Missing implementation
- //if (SystemInformation.UserInteractive)
- {
- Form form = new ThreadExceptionDialog (t);
- form.ShowDialog ();
- }
- //else
- Console.WriteLine (t.ToString ());
-#endif
- }
-
- public static void RemoveMessageFilter(IMessageFilter filter) {
- message_filters.Remove(filter);
- }
-
- public static void Run() {
- MSG msg = new MSG();
- Form form = null;
-
- if (app_context != null) {
- form = app_context.MainForm;
- }
-
- if (form != null) {
- // Both calls are needed, one is for the WM, the other for our focus logic
- XplatUI.Activate(form.window.Handle);
- form.Activate();
- }
-
- messageloop_started = true;
-
- while (!exiting && XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0)) {
- if ((message_filters != null) && (message_filters.Count > 0)) {
- Message m;
- bool drop;
-
- drop = false;
- m = new Message();
- m.Msg = (int)msg.message;
- m.HWnd = msg.hwnd;
- m.LParam = msg.lParam;
- m.WParam = msg.wParam;
- 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;
- }
- }
-
- XplatUI.TranslateMessage(ref msg);
- XplatUI.DispatchMessage(ref msg);
-
- // Handle exit, Form might have received WM_CLOSE and set 'closing' in response
- if ((form != null) && form.closing) {
- exiting = true;
- }
- }
-
- messageloop_started = false;
-
- if (ThreadExit != null) {
- ThreadExit(null, EventArgs.Empty);
- }
-
- if (ApplicationExit != null) {
- ApplicationExit(null, EventArgs.Empty);
- }
- }
-
- public static void Run(Form mainForm) {
- mainForm.CreateControl();
- Run(new ApplicationContext(mainForm));
- }
-
- public static void Run(ApplicationContext context) {
- app_context=context;
- if (app_context.MainForm!=null) {
- app_context.MainForm.Show();
- app_context.MainForm.PerformLayout();
- app_context.ThreadExit += new EventHandler(InternalExit);
- }
- Run();
- }
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 WeakReference Result;
-#if NET_2_0
- public ExecutionContext Context;
-#else
- public CompressedStack Stack;
-#endif
- }
-
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 Mutex handle;
- private object state;
- private bool completed;
- private object return_value;
-
- public AsyncMethodResult ()
- {
- handle = new Mutex ();
- }
-
- 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 ()
- {
- handle.WaitOne ();
- return return_value;
- }
-
- public void Complete (object result)
- {
- lock (this) {
- handle.WaitOne ();
- completed = true;
- return_value = result;
- handle.ReleaseMutex ();
- }
- }
- }
-
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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) {\r
- throw new NotImplementedException("COM/ActiveX support is not implemented");
- }\r
- }
- #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() {\r
- throw new NotImplementedException("COM/ActiveX support is not implemented");
- }\r
- }
- #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) {\r
- throw new NotImplementedException("COM/ActiveX support is not implemented");
- }\r
-\r
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {\r
- throw new NotImplementedException("COM/ActiveX support is not implemented");
- }\r
-\r
- public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {\r
- throw new NotImplementedException("COM/ActiveX support is not implemented");
- }\r
-\r
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {\r
- throw new NotImplementedException("COM/ActiveX support is not implemented");
- }\r
- }
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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, property_name];
- manager.AddBinding (this);
-
- WirePropertyValueChangedEvent ();
-
- is_null_desc = TypeDescriptor.GetProperties (manager.Current).Find (property_name + "IsNull", false);
-
- PullData ();
- }
-
- internal void PushData ()
- {
- data = prop_desc.GetValue (control);
- data = FormatData (data);
- SetPropertyValue (data);
- }
-
- internal void PullData ()
- {
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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) &&\r
- (this.data_path == ((BindingMemberInfo)otherObject).data_path) &&\r
- (this.data_member == ((BindingMemberInfo)otherObject).data_member));\r
- } else {
- return false;
- }
- }
-
- public override int GetHashCode() {
- return this.data_member.GetHashCode();
- }
- #endregion // Public Instance Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.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.UserPaint, true);
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- SetStyle(ControlStyles.ResizeRedraw, true);
- SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, 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 {
- if (image_list != null) {
- image_list.Dispose();
- }
-
- 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);
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-using System;\r
-using System.Drawing;\r
-\r
-namespace System.Windows.Forms.PropertyGridInternal\r
-{\r
- /// <summary>\r
- /// Summary description for CategoryGridEntry.\r
- /// </summary>\r
- internal class CategoryGridEntry : GridEntry\r
- {\r
- private string label;\r
- public CategoryGridEntry(string category)\r
- {\r
- label = category;\r
- }\r
-\r
- public override GridItemType GridItemType {\r
- get {\r
- return GridItemType.Category;\r
- }\r
- }\r
-\r
-\r
- public override string Label {\r
- get {\r
- return label;\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-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
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
-
- #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)]\r
- public CheckedListBox.CheckedIndexCollection CheckedIndices {
- get {return checked_indices; }
- }
-
- [Browsable (false)]
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
- 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)]\r
- 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 ();
- }
- \r
- protected override ListBox.ObjectCollection CreateItemCollection ()
- {
- return new ObjectCollection (this);
- }
-
- public bool GetItemChecked (int index)
- {
- return (GetItemCheckState (index) != CheckState.Unchecked);
- }
- \r
- 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 (check_onclick) {
- if (focused_item != -1) {
- SetItemChecked (focused_item, !GetItemChecked (focused_item));
- }
- }
-
- if (Click != null)
- Click (this, EventArgs.Empty);
- }
- \r
- 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)
- {
- base.OnMouseDownLB (sender, e);
-
- Rectangle hit_rect, item_rect;
- CheckState value = CheckState.Checked;
- bool set_value = false;
- int index = IndexFromPointDisplayRectangle (e.X, e.Y);
-
- if (index == -1)
- return;
-
- /* CheckBox hit */
- hit_rect = item_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)
- value = CheckState.Unchecked;
-
- if (hit_rect.Contains (e.X, e.Y) == true) {
- set_value = true;
-
- } else {
- if (item_rect.Contains (e.X, e.Y) == true) {
- if (!check_onclick) {
- if ((Items.GetListBoxItem (index)).Selected == true)
- set_value = true;
- }
- }
- }
-
- if (set_value)
- SetItemCheckState (index, value);
-
- }
-
- 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);
-
- }
- \r
- 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));
- 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 ();
- }
- \r
- 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 ();
- }
- \r
- 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
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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();
-
- native_format = -1;
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
-
-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
-
- colorDialogPanel = new ColorDialogPanel( this );
- }
- #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 )
- {
- 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( );
- 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
- 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.BackColor = SystemColors.Control;
- 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 );
- 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.ShowHelp )
- helpButton.Enabled = false;
-
- if ( colorDialog.FullOpen )
- DoButtonDefineColours( );
-
- defineColoursButton.Click += new EventHandler( OnClickButtonDefineColours );
- addColoursButton.Click += new EventHandler( OnClickButtonAddColours );
- 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;
- private bool hasFocus = false;
-
- public SmallColorControl( Color color )
- {
- this.color = color;
-
- Size = new Size( 26, 23 );
-
- SetStyle( ControlStyles.DoubleBuffer, true );
- SetStyle( ControlStyles.AllPaintingInWmPaint, true );
- SetStyle( ControlStyles.UserPaint, true );
- SetStyle( ControlStyles.Selectable, true );
- }
-
- public bool IsSelected
- {
- set
- {
- isSelected = value;
- Invalidate( );
- Update( );
- }
-
- get
- {
- return isSelected;
- }
- }
-
- public Color Color
- {
- set
- {
- color = value;
- Invalidate( );
- Update( );
- }
-
- get
- {
- return color;
- }
- }
-
- protected override void OnPaint( PaintEventArgs pe )
- {
- base.OnPaint( pe );
-
- pe.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.Control ), 0, 0, 26, 23 );
-
- ControlPaint.DrawBorder3D( pe.Graphics, new Rectangle( 3, 3, 20, 18 ) );
-
- pe.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( color ),
- new Rectangle( 4, 4, 16, 14 ) );
-
- if ( isSelected )
- {
- pe.Graphics.DrawRectangle( new Pen( ThemeEngine.Current.ResPool.GetSolidBrush( Color.Black ) ),
- new Rectangle( 2, 2, 20, 18 ) );
- }
-
- if ( hasFocus && isSelected )
- {
- ControlPaint.DrawFocusRectangle(
- pe.Graphics, new Rectangle( 0, 0, 25, 23 )
- );
- }
- }
-
- protected override void OnLostFocus( EventArgs e )
- {
- hasFocus = false;
-
- Invalidate( );
- Update( );
-
- base.OnLostFocus( e );
- }
-
- protected override void OnMouseUp( MouseEventArgs e )
- {
- isSelected = true;
-
- hasFocus = true;
-
- Invalidate( );
- Update( );
-
- base.OnMouseUp( e );
- }
- }
-
- private SmallColorControl[] smallColorControl;
-
- private SmallColorControl[] userSmallColorControl;
-
- private Label userColorLabel;
- private Label baseColorLabel;
-
- private bool panelSelected = false;
-
- 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( );
-
- panelSelected = false;
- }
-
- 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 )
- {
- panelSelected = true;
-
- // 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( )
- {
- Pen pen = new Pen( ThemeEngine.Current.ResPool.GetSolidBrush( cursorColor ), 3 );
-
- 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 )
- {
- Bitmap bmp = new Bitmap( drawingBitmap.Bitmap );
-
- e.Graphics.DrawImage( bmp, 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( new SolidBrush( SystemColors.Control ), 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- private bool has_focus;
-
- [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 {\r
- get {\r
- return base.Name;\r
- }\r
- }\r
-
-
- }
-
- 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);
- }
-
- #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.Remove (listbox_ctrl);
- listbox_ctrl.Dispose ();
- listbox_ctrl = null;
- }
- }
-
- if (dropdown_style != ComboBoxStyle.DropDownList && value == ComboBoxStyle.DropDownList) {
- if (textbox_ctrl != null) {
- Controls.Remove (textbox_ctrl);
- textbox_ctrl.Dispose ();
- textbox_ctrl = null;
- }
- }
-
- dropdown_style = value;
-
- if (dropdown_style == ComboBoxStyle.Simple) {
- CBoxInfo.show_button = false;
- Height = combobox_info.combosimple_height;
-
- CreateComboListBox ();
-
- if (IsHandleCreated == true) {
- Controls.Add (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.TextChanged += new EventHandler (OnTextChangedEdit);
- textbox_ctrl.KeyPress += new KeyPressEventHandler(textbox_ctrl_KeyPress);
-
- if (IsHandleCreated == true) {
- Controls.Add (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 virtual 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.Remove (listbox_ctrl);
- listbox_ctrl = null;
- }
-
- if (textbox_ctrl != null) {
- Controls.Remove (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.Add (listbox_ctrl);
- Height = combobox_info.combosimple_height;
- }
-
- if (textbox_ctrl != null) {
- Controls.Add (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 ();
- 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)
- {
- if ((specified & BoundsSpecified.Height) != 0)
- combobox_info.combosimple_height = height;
-
- 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)
- {\r
- OnKeyPress (e);\r
- }\r
-
- // 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;
- }
-
- OnDrawItem (new DrawItemEventArgs (dc, Font, item_rect,
- selected_index, state, ForeColor, BackColor));
- }
-
- if (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.ColorButtonFace),
- 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)
- {
- 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;
- }
-
- 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 (dropdown_style != ComboBoxStyle.Simple)
- return;
-
- 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.Add (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.MaxDropDownItems;
- show_scrollbar = vscrollbar_ctrl.Visible = true;
-
- }
-
- 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 = 2 + ((height - 2) * (index - first_displayble));
- 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;
-
- if (GetHighLightedItem () == item)
- return;
-
- /* Previous item */
- if (GetHighLightedIndex () != -1) {
- invalidate = GetItemDisplayRectangle (GetHighLightedIndex (), top_item);
- if (ClientRectangle.Contains (invalidate))
- Invalidate (invalidate);
- }
-
- highlighted_item = item;
-
- if (highlighted_item != null) {
- /* Current item */
- invalidate = GetItemDisplayRectangle (GetHighLightedIndex (), top_item);
- if (ClientRectangle.Contains (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;
-
- SetTopItem (0);
- SetHighLightedItem (owner.SelectedItem);
-
- 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)
- {
- top_item = vscrollbar_ctrl.Value;
- UpdateLastVisibleItem ();
- Refresh ();
- }
-
- #endregion Private Methods
- }\r
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)
-//
-//
-
-// 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);
-
- 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) {
- #if broken
- Control owner = null;
-
- if (ownerWin32 != null) {
- owner = Control.FromHandle(ownerWin32.Handle);
- }
- #endif
-
- RunDialog(form.Handle);
-
- if (form.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 (!form.IsHandleCreated) {
- form.CreateControl();
- }
-
- #if broken
- form.form_parent_window.Parent = owner;
- #endif
-
- XplatUI.SetModal(form.window.Handle, true);
-
- form.Show();
-
- form.end_modal = false;
- form.is_modal = true;
- Application.ModalRun(form);
- form.is_modal = false;
- form.Hide();
-
- XplatUI.SetModal(form.window.Handle, false);
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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]
- public bool Validate() {
- throw new NotImplementedException();
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- MenuAPI.TrackPopupMenu (Handle, Handle, Control.MousePosition, false, control);
- }
-
- #endregion Public Methods
-
-
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.ComponentModel.Design.Serialization;
-using System.Collections;
-using System.Diagnostics;
-using System.Drawing;
-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
- private bool create_handled; // 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
- private 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 SizeF size_ratio; // size ratio of our control to it's parent; required for anchoring
- internal Size prev_size; // previous size of the control; required for anchoring
-
- // 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;
-
- #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];
-
- return window.owner;
- }
-
- 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
- internal ArrayList list;
- 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 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)
- {
-
- for (int i = 0; i < list.Count; i++) {
- if (list [i] == value) {
- // Do we need to do anything here?
- 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;
- }
-
- list.Add (value);
- value.Parent = owner;
- owner.UpdateZOrder();
- owner.OnControlAdded(new ControlEventArgs(value));
- }
-
- 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 ();
- }
- }
-
- public virtual void Clear ()
- {
- owner.SuspendLayout();
- for (int i = 0; i < list.Count; i++) {
- owner.OnControlRemoved(new ControlEventArgs((Control)list[i]));
- }
- list.Clear();
- owner.ResumeLayout();
- }
-
- public bool Contains (Control value)
- {
- return list.Contains (value);
- }
-
- public 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();
- }
-
- public override int GetHashCode() {
- return base.GetHashCode();
- }
-
- public int IndexOf(Control control) {
- return list.IndexOf(control);
- }
-
- public virtual void Remove(Control value) {
- owner.OnControlRemoved(new ControlEventArgs(value));
- list.Remove(value);
- value.parent = 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);
- }
- 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");
- }
- list.Insert(index, value);
- }
-
- void IList.Remove(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Object of type Control required", "value");
- }
- 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() {
- creator_thread = Thread.CurrentThread;
-
- prev_size = Size.Empty;
- anchor_style = AnchorStyles.Top | AnchorStyles.Left;
-
- create_handled = 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;
-
- control_style = 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, IntPtr.Zero, 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;
- }
-
- 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;
- }
-
- DestroyHandle();
- controls.Remove(this);
- }
- #endregion // Public Constructors
-
- #region Internal Properties
- internal BorderStyle InternalBorderStyle {
- get {
- return border_style;
- }
-
- set {
- if (border_style != value) {
- border_style = value;
-
- XplatUI.SetBorderStyle(window.Handle, border_style);
- }
- }
- }
- #endregion // Internal Properties
-
- #region Private & Internal Methods
- internal IAsyncResult BeginInvokeInternal (Delegate method, object [] args) {
- AsyncMethodResult result;
- AsyncMethodData data;
- 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 = new WeakReference (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 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.IsHandleCreated) {
- XplatUI.SetWindowBackground(child.window.Handle, child.BackColor);
- }
- 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 void PaintControlBackground (PaintEventArgs pevent)
- {
- if (background_image == null)
- return;
-
- DrawBackgroundImage (pevent.Graphics);
- }
-
- void DrawBackgroundImage (Graphics g)
- {
- using (TextureBrush b = new TextureBrush (background_image)) {
- g.FillRectangle (b, ClientRectangle);
- }
- }
-
- internal void DndEnter (DragEventArgs e)
- {
- OnDragEnter (e);
- }
-
- internal void DndOver (DragEventArgs e)
- {
- OnDragOver (e);
- }
-
- internal void DndDrop (DragEventArgs e)
- {
- OnDragDrop (e);
- }
-
- internal void DndLeave (EventArgs e)
- {
- OnDragLeave (e);
- }
-
- internal void DnDFeedback(GiveFeedbackEventArgs e)
- {
- OnGiveFeedback(e);
- }
-
- internal void DnDContinueDrag(QueryContinueDragEventArgs e) {
- OnQueryContinueDrag(e);
- }
-
- 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);
- }
- }
-
- #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;
- if (this.IsHandleCreated) {
- XplatUI.SetWindowBackground(this.window.Handle, 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;
-
- 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 {
- return is_enabled;
- }
-
- set {
- if (is_enabled == value) {
- return;
- }
-
- 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!=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;
- }
-
- parent=value;
-
- if (!parent.Controls.Contains(this)) {
- parent.Controls.Add(this);
- }
-
- if (IsHandleCreated) {
- XplatUI.SetParent(Handle, value.Handle);
- }
-
- OnParentChanged(EventArgs.Empty);
- InitLayout();
- }
- }
- }
-
- [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 {
- return this.text;
- }
-
- set {
- if (value == null) {
- value = String.Empty;
- }
-
- if (text!=value) {
- text=value;
- if (IsHandleCreated) {
- XplatUI.Text(Handle, text);
- } else {
- // FIXME: Do we need a Refresh() here?
- Refresh();
- }
- 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;
- }
-
- 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) {
- IEnumerator control = Control.controls.GetEnumerator();
-
- while (control.MoveNext()) {
- if (((Control)control.Current).window.Handle == handle) {
- // Found it
- return ((Control)control.Current);
- }
- }
- return null;
- }
-
- 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);
- }
-
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public IAsyncResult BeginInvoke (Delegate method, object[] args) {
- return BeginInvokeInternal (method, args);
- }
-
- 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 (!IsHandleCreated) {
- CreateHandle();
- }
-
- if (!create_handled) {
- create_handled = true;
- OnCreateControl();
- }
-
- for (int i=0; i<child_controls.Count; i++) {
- child_controls[i].CreateControl();
- }
- }
-
- public Graphics CreateGraphics() {
- if (!IsHandleCreated) {
- this.CreateControl();
- }
- 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) {
- return;
- }
-
- NotifyInvalidate(rc);
-
- XplatUI.Invalidate(Handle, rc, false);
-
- if (invalidateChildren) {
- for (int i=0; i<child_controls.Count; i++) child_controls[i].Invalidate();
- }
- OnInvalidated(new InvalidateEventArgs(rc));
- }
-
- public void Invalidate(System.Drawing.Region region) {
- Invalidate(region, false);
- }
-
- [MonoTODO("Figure out if GetRegionScans is usable")]
- public void Invalidate(System.Drawing.Region region, bool invalidateChildren) {
- throw new NotImplementedException();
-
- // FIXME - should use the GetRegionScans function of the region to invalidate each area
- //if (invalidateChildren) {
- // for (int i=0; i<child_controls.Count; i++) child_controls[i].Invalidate();
- //}
- }
-
- public object Invoke (Delegate method) {
- return Invoke(method, null);
- }
-
- public object Invoke (Delegate method, object[] args) {
- if (!this.InvokeRequired) {
- return method.DynamicInvoke(args);
- }
-
- IAsyncResult result = BeginInvoke (method, args);
- 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;
- int diff_width;
- int diff_height;
-
- space=this.DisplayRectangle;
- if (prev_size != Size.Empty) {
- diff_width = space.Width - prev_size.Width;
- diff_height = space.Height - prev_size.Height;
- } else {
- diff_width = 0;
- diff_height = 0;
- }
-
- // Deal with docking; go through in reverse, MS docs say that lowest Z-order is closest to edge
- for (int i = child_controls.Count - 1; i >= 0; i--) {
- child=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 = child_controls.Count - 1; i >= 0; i--) {
- child=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;
-
- // Deal with anchoring
- for (int i=0; i < child_controls.Count; i++) {
- int left;
- int top;
- int width;
- int height;
-
- child=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) {
- // Anchoring to left and right
- width=width+diff_width;
- } else {
- ; // nothing to do
- }
- } else if ((anchor & AnchorStyles.Right) != 0) {
- left+=diff_width;
- } else {
- left+=diff_width/2;
- }
-
- if ((anchor & AnchorStyles.Top) !=0 ) {
- if ((anchor & AnchorStyles.Bottom) != 0) {
- height+=diff_height;
- } else {
- ; // nothing to do
- }
- } else if ((anchor & AnchorStyles.Bottom) != 0) {
- top+=diff_height;
- } else {
- top+=diff_height/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();
- if (!ProcessCmdKey(ref msg, key_data)) {
- if (IsInputKey(key_data)) {
- return true;
- }
-
- return ProcessDialogKey(key_data);
- }
-
- return true;
- } else if (msg.Msg == (int)Msg.WM_CHAR) {
- if (IsInputChar((char)msg.WParam)) {
- return true;
- }
- } else if (msg.Msg == (int)Msg.WM_SYSCHAR) {
- if (IsInputChar((char)msg.WParam)) {
- return true;
- }
- 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) {
- int end;
-
- Invalidate();
- XplatUI.UpdateWindow(window.Handle);
-
- end = child_controls.Count;
- for (int i=0; i < end; i++) {
- child_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;
- }
-
- 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;
- 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);
-
- // Find out where the window manager placed us
- UpdateBounds();
- UpdateStyles();
-
- if (window.Handle!=IntPtr.Zero) {
- if (!controls.Contains(window.Handle)) {
- controls.Add(this);
- }
-
- creator_thread = Thread.CurrentThread;
-
- XplatUI.SetWindowBackground(window.Handle, this.BackColor);
-
- 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) {
- // Destroy our children before we destroy ourselves, to prevent them from
- // being implictly (without us knowing) destroyed
- for (int i=0; i < child_controls.Count; i++) {
- child_controls[i].DestroyHandle();
- }
-
-
- if (window != null) {
- window.DestroyHandle();
- }
- OnHandleDestroyed(EventArgs.Empty);
- }
- }
-
- protected bool GetStyle(ControlStyles flag) {
- return (control_style & flag) != 0;
- }
-
- protected bool GetTopLevel() {
- return is_toplevel;
- }
-
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void InitLayout() {
- if (parent != null) {
- parent.PerformLayout(this, "parent");
- }
- }
-
- [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) {
- if (parent != null) {
- return parent.IsInputChar(charCode);
- }
-
- return false;
- }
-
- 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_KEYDOWN: {
- key_event = new KeyEventArgs ((Keys)msg.WParam.ToInt32 ());
- OnKeyDown (key_event);
- return key_event.Handled;
- }
- case (int)Msg.WM_KEYUP: {
- key_event = new KeyEventArgs ((Keys)msg.WParam.ToInt32 ());
- OnKeyUp (key_event);
- return key_event.Handled;
- }
-
- 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 false;
- }
-
- 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.GetEnumerator();
-
- 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 */
- for (int i=0; i < child_controls.Count; i++) {
- child_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, IntPtr.Zero, 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;
- 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);
- }
- OnVisibleChanged(EventArgs.Empty);
-
- 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();
- }
-
- 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
- if (this.layout_suspended==0) {
- prev_size.Width=client_size.Width;
- prev_size.Height=client_size.Height;
- }
-
- client_size.Width=width-client_x_diff;
- client_size.Height=height-client_y_diff;
-
- 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() {
- int children;
-#if not
- Control ctl;
-
- if (parent == null) {
- return;
- }
-
- ctl = parent;
-
- children = ctl.child_controls.Count;
- for (int i = 1; i < children; i++ ) {
- XplatUI.SetZOrder(ctl.child_controls[i].window.Handle, ctl.child_controls[i-1].window.Handle, false, false);
- }
-#else
- children = child_controls.Count;
- for (int i = 1; i < children; i++ ) {
- XplatUI.SetZOrder(child_controls[i].Handle, child_controls[i-1].Handle, false, false);
- }
-#endif
- }
-
- protected virtual void WndProc(ref Message m) {
-#if debug
- Console.WriteLine("Control received message {0}", (Msg)m.Msg);
-#endif
- if ((this.control_style & ControlStyles.EnableNotifyMessage) != 0) {
- OnNotifyMessage(m);
- }
-
- switch((Msg)m.Msg) {
- 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 ((control_style & ControlStyles.DoubleBuffer) != 0) {
- dc = paint_event.SetGraphics (DeviceContext);
- }
-
- if ((control_style & (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint)) != (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint)) {
- OnPaintBackground(paint_event);
- }
-
- OnPaint(paint_event);
-
- 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);
-
- if (!GetStyle(ControlStyles.UserPaint)) {
- DefWndProc(ref m);
- }
-
- return;
- }
-
- case Msg.WM_ERASEBKGND: {
- if (GetStyle (ControlStyles.UserPaint)) {
- if (!GetStyle(ControlStyles.AllPaintingInWmPaint)) {
- PaintEventArgs eraseEventArgs = new PaintEventArgs (m.WParam == IntPtr.Zero ? Graphics.FromHwnd (m.HWnd) :
- Graphics.FromHdc (m.WParam), new Rectangle (new Point (0,0),Size));
- OnPaintBackground (eraseEventArgs);
- }
- } else {
- XplatUI.EraseWindowBackground(m.HWnd, m.WParam);
- }
- // The DefWndProc will never have to handle this, we don't ever set hbr on the window
- m.Result = (IntPtr)1;
- return;
- }
-
- case Msg.WM_LBUTTONUP: {
- HandleClick(mouse_clicks);
- OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Left,
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- 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 (ProcessKeyEventArgs(ref m)) {
- return;
- }
-
- if (PreProcessMessage(ref m)) {
- return;
- }
-
- if (ProcessKeyMessage(ref m)) {
- return;
- }
- 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);
- }
-
- [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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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() {\r
- base.ClearCore ();\r
- }\r
-
- protected override void RemoveCore(Binding dataBinding) {\r
- if (dataBinding == null) {
- throw new ArgumentNullException ("dataBinding");
- }
-
- base.RemoveCore (dataBinding);\r
- }\r
- #endregion // Protected Instance Methods
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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) {
- if (baseColor == ThemeEngine.Current.ColorButtonFace) {
- return ThemeEngine.Current.ColorButtonLight;
- }
-
- return Light( baseColor, 10.0f);
- }
-
- public static Color Light(Color baseColor,float percOfLightLight) {
- int H, I, S;
-
- ControlPaint.Color2HBS(baseColor, out H, out I, out S);
- int NewIntensity = Math.Min( 255, I + ((255*(int)percOfLightLight)/100));
- return ControlPaint.HBS2Color(H, NewIntensity, S);
- }
-
- public static Color LightLight(Color baseColor) {
- if (baseColor == ThemeEngine.Current.ColorButtonFace) {
- return ThemeEngine.Current.ColorButtonHilight;
- }
-
- return Light( baseColor, 20.0f);
- }
-
- public static Color Dark(Color baseColor) {
- if (baseColor == ThemeEngine.Current.ColorButtonFace) {
- return ThemeEngine.Current.ColorButtonShadow;
- }
-
- return Dark(baseColor, 10.0f);
- }
-
- public static Color Dark(Color baseColor,float percOfDarkDark) {
- int H, I, S;
-
- ControlPaint.Color2HBS(baseColor, out H, out I, out S);
- int NewIntensity = Math.Max(0, I - ((255*(int)percOfDarkDark) / 100));
- return ControlPaint.HBS2Color(H, NewIntensity, S);
- }
-
- public static Color DarkDark(Color baseColor) {
- if (baseColor == ThemeEngine.Current.ColorButtonFace) {
- return ThemeEngine.Current.ColorButtonDkShadow;
- }
-
- return Dark(baseColor, 20.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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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.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;
- }
- }
- }
-
- 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 ();
- }
-
- 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);
- }
-
- public event ItemChangedEventHandler ItemChanged;
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.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() {
- }
-
- ~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 {
- ;
- }
- }
-
- public static Cursor Current {
- get {
- return current;
- }
-
- set {
- if (current != value) {
- current = value;
- 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;
- }
- }
-
- 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();
- if (cursor_dir.idReserved != 0) {
- throw new System.ArgumentException ("Invalid Argument", "stream");
- }
-
- cursor_dir.idType = reader.ReadUInt16();
- if (cursor_dir.idType != 2) { //must be 2
- throw new System.ArgumentException ("Invalid Argument", "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 ToBitmap (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);
- writer.Write(cih.biClrUsed);
- writer.Write(cih.biClrImportant);
-
- // write color table
- if (xor) {
- color_count = ci.cursorColors.Length;
- for (int j = 0; j < color_count; j++) {
- writer.Write (ci.cursorColors[j]);
- }
- } else {
- writer.Write((uint)0x00000000);
- writer.Write((uint)0x00ffffff);
- }
-
- // write image bits
- if (xor) {
- writer.Write(ci.cursorXOR);
- } else {
- writer.Write(ci.cursorAND);
- }
- writer.Flush();
-
- // create bitmap from stream and return
- 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;
- }
-
- #endregion // Private Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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 = 0;
- row = 0;
- 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 base.ToString ();
- }
-
- }
-
- #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 background_color;
- internal BorderStyle border_style;
- 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;
- 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.UserPaint | ControlStyles.AllPaintingInWmPaint, 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 Color BackColor {
- get {
- return base.BackColor;
- }
- set {
- base.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 Image BackgroundImage {
- get {
- return base.BackgroundImage;
- }
-
- set {
- base.BackgroundImage = value;
- }
- }
-
- [DispId(-504)]
- [DefaultValue(BorderStyle.Fixed3D)]
- public BorderStyle BorderStyle {
- get {
- return border_style;
- }
-
- set {
- if (border_style != value) {
- border_style = 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 (true);
- } 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 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;
- }
-
- 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);
- }
-
- 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:
- {
- 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;
- }
- 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 (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);
- }
- }
- }
-
- 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)
- {
- base.OnPaintBackground (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 ()
- {
- base.ResetBackColor ();
- }
-
- 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)
- {
- bool source = SetDataSource (dataSource);
- bool member = SetDataMember (dataMember);
-
- if (source == false && member == false) {
- return;
- }
-
- 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 ()
- {
- 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 && String.Compare (ListManager.ListName, ((DataGridTableStyle)e.Element).MappingName, true) == 0) {
- CurrentTableStyle = (DataGridTableStyle)e.Element;
- ((DataGridTableStyle) e.Element).CreateColumnsForTable (false);
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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]
- public enum CheckState {
- Checked = 0x00000000,
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-
- #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)";
- #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
-
- // 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.ColorButtonHilight),
- bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y);
-
- if (colNum == 0) {
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
- bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height);
- } else {
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
- bounds.X, bounds.Y + 2, bounds.X, bounds.Y + bounds.Height - 2);
- }
-
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
- 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);
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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 client_area; // ClientRectangle - BorderStyle decorations, effetive client area
- 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;
-
- 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 CalcClientArea ()
- {
- client_area = grid.ClientRectangle;
- client_area.X += BorderStyleSize;
- client_area.Y += BorderStyleSize;
- client_area.Width -= BorderStyleSize * 2;
- client_area.Height -= BorderStyleSize * 2;
-
- }
-
- 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;
- CalcClientArea ();
- 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 > client_area.Y + client_area.Height) {
- rowshdrs_area.Height -= grid.horiz_scrollbar.Width;
- rowshdrs_maxheight -= grid.horiz_scrollbar.Width;
- }
- }
-
- // 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 = client_area.X;
- caption_area.Y = client_area.Y;
- caption_area.Width = client_area.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 = client_area.Y;
- }
-
- if (grid.ShowParentRowsVisible) {
- cells_area.Y += parent_rows.Height;
- }
-
- if (grid.columnheaders_visible) {
- cells_area.Y += columnshdrs_area.Height;
- }
-
- cells_area.X = client_area.X + rowshdrs_area.Width;
- cells_area.Width = client_area.X + client_area.Width - cells_area.X;
- cells_area.Height = client_area.Y + client_area.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 = client_area.Y;
- }
-
- if (grid.ShowParentRowsVisible) {
- columnshdrs_area.Y += parent_rows.Height;
- }
-
- columnshdrs_area.X = client_area.X;
- columnshdrs_area.Height = ColumnsHeaderHeight;
- width_all_cols = CalcAllColumnsWidth ();
-
- // TODO: take into account Scrollbars
- columnshdrs_maxwidth = client_area.X + client_area.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 = client_area.Y;
- }
-
- parent_rows.X = client_area.X;
- parent_rows.Width = client_area.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 = client_area.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 = client_area.X;
- rowshdrs_area.Width = grid.RowHeaderWidth;
- rowshdrs_area.Height = grid.visiblerow_count * grid.RowHeight;
- rowshdrs_maxheight = client_area.Height + client_area.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);\r
- 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;
- }
-
- 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;
- 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 (client_area.X, client_area.Y +
- client_area.Height - grid.horiz_scrollbar.Height);
-
- grid.horiz_scrollbar.Size = new Size (client_area.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 = client_area.Y + caption_area.Height;
- height = client_area.Height - caption_area.Height;
- } else {
- y = client_area.Y;
- height = client_area.Height;
- }
-
- grid.vert_scrollbar.Location = new Point (client_area.X +
- client_area.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
- internal int BorderStyleSize {
- get {
- switch (grid.border_style) {
- case BorderStyle.Fixed3D:
- return 2;
- case BorderStyle.FixedSingle:
- return 1;
- case BorderStyle.None:
- default:
- break;
- }
-
- return 0;
- }
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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) {\r
- if ((sourceType == typeof(string)) || (sourceType == typeof(int))) {\r
- return true;\r
- }\r
- return base.CanConvertFrom (context, sourceType);\r
- }\r
-
- public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {\r
- if (value is string) {\r
- if (((string)value).Equals("AutoColumnResize (-1)")) {\r
- return -1;\r
- }\r
-\r
- return Int32.Parse((string)value);\r
- }\r
- return base.ConvertFrom (context, culture, value);\r
- }\r
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {\r
- if (destinationType == typeof(String)) {\r
- if ((int)value == -1) {\r
- return "AutoColumnResize (-1)";\r
- }\r
-\r
- }\r
- return base.ConvertTo (context, culture, value, destinationType);\r
- }\r
- #endregion // Public Instance Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 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].IsDefault == false) {
- 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- #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
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- #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 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;
-
- if (textbox == null) {
- textbox = new DataGridTextBox ();
- textbox.SetDataGrid (DataGridTableStyle.DataGrid);
- DataGridTableStyle.DataGrid.Controls.Add (textbox);
- 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, bounds.Y);
- bounds.X += 2; bounds.Y += 2;
- bounds.Width -= 2; bounds.Height -= 2;
- textbox.Size = new Size (bounds.Width, bounds.Height);
-
- obj = GetColumnValueAtRow (source, rowNum);
- textbox.Text = GetFormattedString (obj);
- 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);
-
- string_format.FormatFlags |= StringFormatFlags.NoWrap;
- g.DrawString (text, DataGridTableStyle.DataGrid.Font, foreBrush, textBounds, string_format);
- PaintGridLine (g, textBounds);
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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);
-}
+++ /dev/null
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-//
-// 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.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.ColorActiveTitle;
- protected static readonly Color DefaultTitleForeColor = ThemeEngine.Current.ColorTitleText;
- 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 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.AllPaintingInWmPaint, true);
- }
-
- #endregion
-
- #region public properties
-
- // no reason why this is overridden
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public 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 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;
-
- #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);
- }
- }
-
- // 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
-
- [MonoTODO("Fix Dropdown location when System.Windows.Forms.Screen gets added")]
- 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);
-// TODO: enable this part when screen comes into the classes
-/*
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-//\r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-//\r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-// Copyright (c) 2004 Novell, Inc.\r
-//\r
-// Authors:\r
-// Jordi Mas i Hernandez, jordi@ximian.com\r
-//\r
-//\r
-\r
-namespace System.Windows.Forms \r
-{\r
- [Serializable]\r
- public enum DrawMode \r
- {\r
- Normal = 0,\r
- OwnerDrawFixed = 1,\r
- OwnerDrawVariable = 2,\r
- }\r
-}\r
-\r
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
- }\r
-\r
- public ErrorIconAlignment Alignment {\r
- get {\r
- return alignment;\r
- }\r
-\r
- set {\r
- if (alignment != value) {\r
- alignment = value;\r
- CalculateAlignment();\r
- }\r
- }\r
- }\r
-\r
- public int Padding {\r
- get {\r
- return padding;\r
- }\r
-\r
- set {\r
- if (padding != value) {\r
- padding = value;\r
- CalculateAlignment();\r
- }\r
- }\r
- }\r
-\r
- private void CalculateAlignment() {\r
- if (visible) {\r
- visible = false;\r
- ep.tooltip.Visible = false;\r
- }\r
-\r
- switch (alignment) {\r
- case ErrorIconAlignment.TopLeft: {\r
- window.Left = control.Left - ep.icon.Width - padding;\r
- window.Top = control.Top;\r
- break;\r
- }\r
-\r
- case ErrorIconAlignment.TopRight: {\r
- window.Left = control.Left + control.Width + padding;\r
- window.Top = control.Top;\r
- break;\r
- }\r
-\r
- case ErrorIconAlignment.MiddleLeft: {\r
- window.Left = control.Left - ep.icon.Width - padding;\r
- window.Top = control.Top + (control.Height - ep.icon.Height) / 2;\r
- break;\r
- }\r
-\r
- case ErrorIconAlignment.MiddleRight: {\r
- window.Left = control.Left + control.Width + padding;\r
- window.Top = control.Top + (control.Height - ep.icon.Height) / 2;\r
- break;\r
- }\r
-\r
- case ErrorIconAlignment.BottomLeft: {\r
- window.Left = control.Left - ep.icon.Width - padding;\r
- window.Top = control.Top + control.Height - ep.icon.Height;\r
- break;\r
- }\r
-\r
- case ErrorIconAlignment.BottomRight: {\r
- window.Left = control.Left + control.Width + padding;\r
- window.Top = control.Top + control.Height - ep.icon.Height;\r
- break;\r
- }\r
- }\r
- }\r
-\r
- private void window_Paint(object sender, PaintEventArgs e) {\r
- if (text != string.Empty) {\r
- e.Graphics.DrawIcon(this.ep.icon, 0, 0);\r
- }\r
- }\r
-\r
- private void window_MouseEnter(object sender, EventArgs e) {\r
- if (!visible) {\r
- Size size;\r
- Point pt;\r
-\r
- visible = true;\r
-\r
- pt = Control.MousePosition;\r
-\r
- size = ThemeEngine.Current.ToolTipSize(ep.tooltip, text);\r
- ep.tooltip.Width = size.Width;\r
- ep.tooltip.Height = size.Height;\r
- ep.tooltip.Text = text;\r
-\r
- if ((pt.X + size.Width) < SystemInformation.WorkingArea.Width) {\r
- ep.tooltip.Left = pt.X;\r
- } else {\r
- ep.tooltip.Left = pt.X - size.Width;\r
- }\r
-\r
- if ((pt.Y + size.Height) < (SystemInformation.WorkingArea.Height - 16)) {\r
- ep.tooltip.Top = pt.Y + 16;\r
- } else {\r
- ep.tooltip.Top = pt.Y - size.Height;\r
- }\r
- ep.tooltip.Visible = true;\r
- }\r
- }\r
-\r
- private void window_MouseLeave(object sender, EventArgs e) {\r
- if (visible) {\r
- visible = false;\r
- ep.tooltip.Visible = false;\r
- }\r
- }\r
-\r
- private void control_SizeLocationChanged(object sender, EventArgs e) {\r
- if (visible) {\r
- visible = false;\r
- ep.tooltip.Visible = false;\r
- }\r
- CalculateAlignment();\r
- }\r
-\r
- private void window_Tick(object sender, EventArgs e) {\r
- if (timer.Enabled) {\r
- Graphics g;\r
-\r
- blink_count++;\r
-\r
- // Dunno why this POS doesn't reliably blink\r
- g = window.CreateGraphics();\r
- if ((blink_count % 2) == 0) {\r
- g.FillRectangle(new SolidBrush(window.parent.BackColor), window.ClientRectangle);\r
- } else {\r
- g.DrawIcon(this.ep.icon, 0, 0);\r
- }\r
- g.Dispose();\r
-\r
- if ((blink_count > 6) && (ep.blinkstyle == ErrorBlinkStyle.BlinkIfDifferentError)) {\r
- timer.Stop();\r
- blink_count = 0;\r
- }\r
- }\r
- }\r
- }
- #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 {\r
- set {\r
- base.Site = value;\r
- }\r
- }\r
- #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) {\r
- base.Dispose (disposing);\r
- }\r
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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:
-// file/path security stuff ???
-
-using System;
-using System.Drawing;
-using System.ComponentModel;
-using System.Resources;
-using System.IO;
-using System.Collections;
-using System.Collections.Specialized;
-
-namespace System.Windows.Forms
-{
- [DefaultProperty( "FileName" )]
- [DefaultEvent( "FileOk" )]
- public abstract class FileDialog : CommonDialog
- {
- internal class FileDialogForm : DialogForm
- {
- internal FileDialogForm( 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;
-
- return cp;
- }
- }
- }
-
- 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()
- {
- }
-
- [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 {
- initialDirectory = value;
- }
- }
-
- [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;
-
- protected override IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam )
- {
- throw new NotImplementedException( );
- }
-
- protected void OnFileOk( CancelEventArgs e )
- {
- if ( FileOk != null ) FileOk( 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 ToolBarButton desktopToolBarButton;
- private ToolBar smallButtonToolBar;
- private DirComboBox dirComboBox;
- private ToolBarButton lastUsedToolBarButton;
- private ComboBox fileNameComboBox;
- private ToolBarButton networkToolBarButton;
- private Label fileNameLabel;
- private MWFFileView mwfFileView;
- private Label searchSaveLabel;
- private ToolBarButton newdirToolBarButton;
- private ToolBarButton backToolBarButton;
- private ToolBarButton homeToolBarButton;
- private ToolBarButton workplaceToolBarButton;
- 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 directoryInfo;
-
- // store DirectoryInfo for backButton
- internal Stack directoryStack = new Stack();
-
- private MenuItem previousCheckedMenuItem;
-
- private bool multiSelect = false;
-
- private string restoreDirectory = "";
-
- public FileDialogPanel( FileDialog fileDialog )
- {
- this.fileDialog = fileDialog;
-
- fileTypeComboBox = new ComboBox( );
- workplaceToolBarButton = new ToolBarButton( );
- homeToolBarButton = new ToolBarButton( );
- backToolBarButton = new ToolBarButton( );
- newdirToolBarButton = new ToolBarButton( );
- searchSaveLabel = new Label( );
- mwfFileView = new MWFFileView( );
- fileNameLabel = new Label( );
- networkToolBarButton = new ToolBarButton( );
- fileNameComboBox = new ComboBox( );
- lastUsedToolBarButton = new ToolBarButton( );
- dirComboBox = new DirComboBox( );
- smallButtonToolBar = new ToolBar( );
- desktopToolBarButton = new ToolBarButton( );
- 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;
-
- // 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;
- helpButton.Hide( );
-
- // 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;
- checkBox.Hide( );
-
- ClientSize = new Size( 554, 405 ); // 384
-
- ContextMenu = contextMenu;
-
- Dock = DockStyle.Fill;
-
- Controls.Add( smallButtonToolBar );
- Controls.Add( cancelButton );
- Controls.Add( openSaveButton );
- Controls.Add( helpButton );
- Controls.Add( mwfFileView );
- Controls.Add( fileTypeLabel );
- Controls.Add( fileNameLabel );
- Controls.Add( fileTypeComboBox );
- Controls.Add( fileNameComboBox );
- Controls.Add( dirComboBox );
- Controls.Add( searchSaveLabel );
- Controls.Add( popupButtonPanel );
- Controls.Add( checkBox );
-
- ResumeLayout( false );
-
- if ( fileDialog.InitialDirectory == String.Empty )
- currentDirectoryName = Environment.CurrentDirectory;
- else
- currentDirectoryName = fileDialog.InitialDirectory;
-
- directoryInfo = new DirectoryInfo( currentDirectoryName );
-
- dirComboBox.CurrentPath = currentDirectoryName;
-
- if ( fileDialog.RestoreDirectory )
- restoreDirectory = currentDirectoryName;
-
- mwfFileView.UpdateFileView( directoryInfo );
-
- openSaveButton.Click += new EventHandler( OnClickOpenSaveButton );
- cancelButton.Click += new EventHandler( OnClickCancelButton );
- helpButton.Click += new EventHandler( OnClickHelpButton );
-
- smallButtonToolBar.ButtonClick += new ToolBarButtonClickEventHandler( OnClickSmallButtonToolBar );
-
- // Key events DONT'T work
- fileNameComboBox.KeyUp += new KeyEventHandler( OnKeyUpFileNameComboBox );
-
- 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 );
-
- dirComboBox.DirectoryChanged += new EventHandler( OnDirectoryChangedDirComboBox );
-
- checkBox.CheckedChanged += new EventHandler( OnCheckCheckChanged );
- }
-
- public ComboBox FileNameComboBox
- {
- set {
- fileNameComboBox = value;
- }
-
- get {
- return fileNameComboBox;
- }
- }
-
- public string CurrentFileName
- {
- set {
- currentFileName = value;
- }
-
- get {
- return currentFileName;
- }
- }
-
- public DirectoryInfo DirectoryInfo
- {
- set {
- directoryInfo = value;
- }
-
- get {
- return directoryInfo;
- }
- }
-
- 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( directoryInfo );
- }
- }
-
- void OnClickOpenSaveButton( object sender, EventArgs e )
- {
- if ( !multiSelect )
- {
- string fileFromComboBox = fileNameComboBox.Text.Trim( );
-
- if ( fileFromComboBox.Length > 0 )
- fileFromComboBox = Path.Combine( currentDirectoryName, fileFromComboBox );
-
- if ( currentFileName != fileFromComboBox )
- currentFileName = fileFromComboBox;
-
- if ( currentFileName.Length == 0 )
- return;
-
-
- 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;
- }
- 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 ( directoryInfo.Parent != null )
- {
- PushDirectory( directoryInfo );
-
- directoryInfo = directoryInfo.Parent;
-
- currentDirectoryName = directoryInfo.FullName;
-
- dirComboBox.CurrentPath = currentDirectoryName;
-
- mwfFileView.UpdateFileView( directoryInfo );
- }
- }
- else
- if ( e.Button == backToolBarButton )
- {
- if ( directoryStack.Count != 0 )
- {
- PopDirectory( );
-
- dirComboBox.CurrentPath = currentDirectoryName;
-
- mwfFileView.UpdateFileView( directoryInfo );
- }
- }
- 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( directoryInfo );
- }
-
- void OnKeyUpFileNameComboBox( object sender, KeyEventArgs e )
- {
- if ( e.KeyCode == Keys.Enter )
- {
- currentFileName = currentDirectoryName + fileNameComboBox.Text;
- ForceDialogEnd( );
- }
- }
-
- void OnSelectedIndexChangedFileTypeComboBox( object sender, EventArgs e )
- {
- fileDialog.FilterIndex = fileTypeComboBox.SelectedIndex + 1;
-
- mwfFileView.FilterIndex = fileDialog.FilterIndex;
-
- mwfFileView.UpdateFileView( directoryInfo );
- }
-
- 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;
- }
-
- 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( directoryInfo );
- }
-
- public void ChangeDirectory( object sender, string path )
- {
- currentDirectoryName = path;
-
- PushDirectory( directoryInfo );
-
- directoryInfo = new DirectoryInfo( path );
-
- if ( sender != dirComboBox )
- dirComboBox.CurrentPath = path;
-
- mwfFileView.UpdateFileView( directoryInfo );
- }
-
- public void ForceDialogEnd( )
- {
- OnClickOpenSaveButton( this, EventArgs.Empty );
- }
-
- private void PushDirectory( DirectoryInfo di )
- {
- directoryStack.Push( directoryInfo );
- backToolBarButton.Enabled = true;
- }
-
- private void PopDirectory( )
- {
- directoryInfo = (DirectoryInfo)directoryStack.Pop( );
-
- currentDirectoryName = directoryInfo.FullName;
-
- if ( directoryStack.Count == 0 )
- backToolBarButton.Enabled = false;
- }
-
- 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 )
- helpButton.Show( );
-
- if ( fileDialog.ShowReadOnly )
- checkBox.Show( );
- }
-
- 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 ImageList imageList = new ImageList();
-
- public PopupButtonPanel( FileDialogPanel fileDialogPanel )
- {
- this.fileDialogPanel = fileDialogPanel;
-
- BorderStyle = BorderStyle.Fixed3D;
- BackColor = Color.FromArgb( 128, 128, 128 );
- Size = new Size( 85, 336 );
-
- // use ImageList to scale the bitmaps
- imageList.ColorDepth = ColorDepth.Depth32Bit;
- imageList.ImageSize = new Size( 38, 38 );
- imageList.Images.Add( (Image)Locale.GetResource( "last_open" ) );
- //imageList.Images.Add( (Image)Locale.GetResource( "desktop" ) );
- imageList.Images.Add( MimeIconEngine.GetIconForMimeTypeAndSize( "desktop/desktop", imageList.ImageSize ) );
- //imageList.Images.Add( (Image)Locale.GetResource( "folder_with_paper" ) );
- imageList.Images.Add( MimeIconEngine.GetIconForMimeTypeAndSize( "directory/home", imageList.ImageSize ) );
- imageList.Images.Add( (Image)Locale.GetResource( "monitor-computer" ) );
- //imageList.Images.Add( (Image)Locale.GetResource( "monitor-planet" ) );
- imageList.Images.Add( MimeIconEngine.GetIconForMimeTypeAndSize( "network/network", imageList.ImageSize ) );
- imageList.TransparentColor = Color.Transparent;
-
- lastOpenButton = new PopupButton( );
- desktopButton = new PopupButton( );
- homeButton = new PopupButton( );
- workplaceButton = new PopupButton( );
- networkButton = new PopupButton( );
-
- lastOpenButton.Size = new Size( 82, 64 );
- lastOpenButton.Image = imageList.Images[ 0 ];
- lastOpenButton.BackColor = BackColor;
- lastOpenButton.ForeColor = Color.White;
- lastOpenButton.Location = new Point( 2, 2 );
- lastOpenButton.Text = "Last Open";
- lastOpenButton.Click += new EventHandler( OnClickButton );
-
- desktopButton.Image = imageList.Images[ 1 ];
- 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 = imageList.Images[ 2 ];
- 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 = imageList.Images[ 3 ];
- 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 = imageList.Images[ 4 ];
- 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 )
- {
-
- }
- else
- if ( sender == desktopButton )
- {
- fileDialogPanel.ChangeDirectory( this, Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) );
- }
- else
- if ( sender == homeButton )
- {
- fileDialogPanel.ChangeDirectory( this, Environment.GetFolderPath( Environment.SpecialFolder.Personal ) );
- }
- else
- if ( sender == workplaceButton )
- {
-// fileDialogPanel.ChangeDirectory(this, Environment.GetFolderPath( Environment.SpecialFolder.MyComputer ) );
- }
- else
- if ( sender == networkButton )
- {
-
- }
- }
- }
- }
- }
-
- 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 )
- {
- this.fullname = fullname;
- this.attributes = attributes;
- }
-
- public string fullname;
- public FileAttributes attributes;
- }
-
- // MWFFileView
- internal class MWFFileView : ListView
- {
-// private ImageList fileViewSmallImageList = new ImageList();
-// private ImageList fileViewBigImageList = new ImageList();
-
- 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 string fileName;
- private string fullFileName;
- private string selectedFilesString;
-
- private int filterIndex;
-
- public MWFFileView( )
- {
- SmallImageList = MimeIconEngine.SmallIcons;
- LargeImageList = MimeIconEngine.LargeIcons;
-
- View = View.List;
- }
-
- 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;
- }
-
- public void UpdateFileView( 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 )
- {
- if ( !ShowHiddenFiles )
- if ( fileInfo.Name.StartsWith( "." ) || fileInfo.Attributes == FileAttributes.Hidden )
- continue;
-
- FileStruct fileStruct = new FileStruct( );
-
- fileStruct.fullname = fileInfo.FullName;
-
- ListViewItem listViewItem = new ListViewItem( fileInfo.Name );
-
- listViewItem.ImageIndex = MimeIconEngine.GetIconIndexForFile( fileStruct.fullname );
-
- long fileLen = 1;
- if ( fileInfo.Length > 1024 )
- fileLen = fileInfo.Length / 1024;
-
- 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( fileInfo.Name, fileStruct );
-
- Items.Add( listViewItem );
- }
-
- EndUpdate( );
- }
-
- 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 );
- }
-
- 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; }
- }
- }
-
- 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 bool firstTime = true;
-
- private EventHandler on_directory_changed;
-
- public DirComboBox( )
- {
- DrawMode = DrawMode.OwnerDrawFixed;
-
- imageList.ColorDepth = ColorDepth.Depth32Bit;
- imageList.ImageSize = new Size( 16, 16 );
- imageList.Images.Add( MimeIconEngine.GetIconForMimeTypeAndSize( "desktop/desktop", imageList.ImageSize ) );
- imageList.Images.Add( MimeIconEngine.GetIconForMimeTypeAndSize( "directory/home", imageList.ImageSize ) );
- imageList.Images.Add( MimeIconEngine.GetIconForMimeTypeAndSize( "inode/directory", imageList.ImageSize ) );
- imageList.TransparentColor = Color.Transparent;
-
- Items.AddRange( new object[] {
- new DirComboBoxItem( 0, "Desktop", Environment.GetFolderPath( Environment.SpecialFolder.Desktop ), 0 ),
- new DirComboBoxItem( 1, "Home", Environment.GetFolderPath( Environment.SpecialFolder.Personal ), 0 )
- }
- );
- }
-
- public string CurrentPath
- {
- set {
- currentPath = value;
-
- ShowPath( );
- }
- get {
- return currentPath;
- }
- }
-
- private void ShowPath( )
- {
- DirectoryInfo di = new DirectoryInfo( currentPath );
-
- Stack dirStack = new Stack( );
-
- dirStack.Push( di );
-
- while ( di.Parent != null )
- {
- di = di.Parent;
- dirStack.Push( di );
- }
-
- BeginUpdate( );
-
- Items.Clear( );
-
- Items.AddRange( new object[] {
- new DirComboBoxItem( 0, "Desktop", Environment.GetFolderPath( Environment.SpecialFolder.Desktop ), 0 ),
- new DirComboBoxItem( 1, "Home", Environment.GetFolderPath( Environment.SpecialFolder.Personal ), 0 )
- }
- );
-
- int sel = -1;
-
- int xPos = -4;
-
- while ( dirStack.Count != 0 )
- {
- DirectoryInfo dii = (DirectoryInfo)dirStack.Pop( );
- sel = Items.Add( new DirComboBoxItem( 2, dii.Name, dii.FullName, xPos + 4 ) );
- xPos += 4;
- }
-
- if ( sel != -1 )
- SelectedIndex = sel;
-
- EndUpdate( );
- }
-
- 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;
-
- // Bug in ComboBox !!!!!
- // we never receive DrawItemState.ComboBoxEdit
- if ( ( e.State & DrawItemState.ComboBoxEdit ) != 0 )
- xPos = 0;
- else
- if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
- {
- backColor = Color.Blue;
- foreColor = Color.White;
- }
-
- 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 );
- }
-
- protected override void OnSelectedIndexChanged( EventArgs e )
- {
- // do not call ChangeDirectory when invoked from FileDialogPanel ctor...
- if ( firstTime )
- {
- firstTime = false;
- return;
- }
-
- if ( Items.Count > 0 )
- {
- DirComboBoxItem dcbi = Items[ SelectedIndex ] as DirComboBoxItem;
-
- currentPath = dcbi.Path;
-
- if ( on_directory_changed != null )
- on_directory_changed( this, EventArgs.Empty );
- }
- }
-
- public event EventHandler DirectoryChanged
- {
- add { on_directory_changed += value; }
- remove { on_directory_changed -= value; }
- }
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
-// 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;
-using System.Threading;
-
-namespace System.Windows.Forms
-{
- [DefaultEvent("HelpRequest")]
- [DefaultProperty("SelectedPath")]
- [Designer("System.Windows.Forms.Design.FolderBrowserDialogDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]\r
- 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;
-
- private FolderBrowserDialogPanel folderBrowserDialogPanel;
-
- private bool treeViewFull = false;
- #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";
-
- folderBrowserDialogPanel = new FolderBrowserDialogPanel( this );
- }
- #endregion // Public Constructors
-
- #region Public Instance Properties
- [Browsable(true)]
- [DefaultValue("")]
- [Localizable(true)]
- public string Description
- {
- set
- {
- description = value;
- folderBrowserDialogPanel.DescriptionLabel.Text = value;
- }
-
- get
- {
- return description;
- }
- }
-
- [Browsable(true)]
- [DefaultValue(Environment.SpecialFolder.Desktop)]
- [Localizable(false)]
- public Environment.SpecialFolder RootFolder
- {
- set
- {
- rootFolder = value;
- folderBrowserDialogPanel.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;
- folderBrowserDialogPanel.SelectedPath = value;
- }
-
- get
- {
- return selectedPath;
- }
- }
-
- [Browsable(true)]
- [DefaultValue(true)]
- [Localizable(false)]
- public bool ShowNewFolderButton
- {
- set
- {
- showNewFolderButton = value;
-
- if ( value )
- folderBrowserDialogPanel.NewFolderButton.Enabled = true;
- else
- folderBrowserDialogPanel.NewFolderButton.Enabled = false;
- }
-
- get
- {
- return showNewFolderButton;
- }
- }
- #endregion // Public Instance Properties
-
- #region Public Instance Methods
- public override void Reset( )
- {
- description = "";
- rootFolder = Environment.SpecialFolder.Desktop;
- selectedPath = "";
- showNewFolderButton = true;
-
- ResetPanelValues( );
- }
-
- private void ResetPanelValues( )
- {
- folderBrowserDialogPanel.NewFolderButton.Enabled = true;
- folderBrowserDialogPanel.RootFolder = rootFolder;
- folderBrowserDialogPanel.SelectedPath = "";
- folderBrowserDialogPanel.DescriptionLabel.Text = "";
- }
-
- protected override bool RunDialog( IntPtr hwndOwner )
- {
- form.Controls.Add( folderBrowserDialogPanel );
- if ( !treeViewFull )
- {
- folderBrowserDialogPanel.FillTreeView( );
- treeViewFull = true;
- }
- 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;
-
- 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 Environment.SpecialFolder rootFolder;
- private string selectedPath;
-
- private ImageList imageList;
-
- private Hashtable dirHashTable = new Hashtable();
-
- private FolderBrowserTreeNode selectedPathNode = null;
-
- private string globalPath = "";
-
- private TreeNode globalTreeNode = null;
-
- private Thread reader_thread = null;
-
- public delegate void ThreadEventHandler( object sender, ThreadEventArgs e );
-
- private ThreadEventHandler OnThreadTreeViewUpdate;
-
- 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 = "";
-
- // 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";
-
- // 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 );
-
- folderBrowserTreeView.AfterSelect += new TreeViewEventHandler( OnAfterSelectFolderBrowserTreeView );
-
- OnThreadTreeViewUpdate = new ThreadEventHandler( ThreadTreeViewUpdate );
- }
-
- public Label DescriptionLabel
- {
- set
- {
- descriptionLabel = value;
- }
-
- get
- {
- return descriptionLabel;
- }
- }
-
- public Button NewFolderButton
- {
- set
- {
- newFolderButton = value;
- }
-
- get
- {
- return newFolderButton;
- }
- }
-
- public Environment.SpecialFolder RootFolder
- {
- set
- {
- rootFolder = value;
- }
-
- get
- {
- return rootFolder;
- }
- }
-
- public string SelectedPath
- {
- set
- {
- selectedPath = value;
- }
-
- get
- {
- return selectedPath;
- }
- }
-
- void OnClickOKButton( object sender, EventArgs e )
- {
- StopThread( );
-
- folderBrowserDialog.SelectedPath = selectedPath;
-
- folderBrowserDialog.form.Controls.Remove( this );
- folderBrowserDialog.form.DialogResult = DialogResult.OK;
- }
-
- void OnClickCancelButton( object sender, EventArgs e )
- {
- StopThread( );
-
- folderBrowserDialog.form.Controls.Remove( this );
- folderBrowserDialog.form.DialogResult = DialogResult.Cancel;
- }
-
- void OnAfterSelectFolderBrowserTreeView( object sender, TreeViewEventArgs e )
- {
- if ( e.Node == null ) return;
-
- FolderBrowserTreeNode tn = e.Node as FolderBrowserTreeNode;
-
- selectedPath = tn.FullPathName;
- }
-
- // FIXME
- // this needs some work, because almost no paths are available for
- // Environment.GetFolderPath( Environment.SpecialFolder.xxx)
- // under non windows platforms !!!!!!!!!
- public void FillTreeView( )
- {
- selectedPathNode = null;
-
- Cursor oldCursor = Cursor;
- Cursor = Cursors.WaitCursor;
-
- if ( rootFolder == Environment.SpecialFolder.Desktop )
- {
- folderBrowserTreeView.BeginUpdate( );
- string path = Environment.GetFolderPath( rootFolder );
- FolderBrowserTreeNode node = new FolderBrowserTreeNode( Path.GetFileName( path ) );
- node.FullPathName = path;
- node.ImageIndex = 1;
- folderBrowserTreeView.Nodes.Add( node );
- folderBrowserTreeView.EndUpdate( );
-
- globalPath = Environment.GetFolderPath( Environment.SpecialFolder.Personal );
- globalTreeNode = null;
-
- StartThread( );
-
-// folderBrowserTreeView.BeginUpdate();
-// GetAllSubDirs( Environment.GetFolderPath( Environment.SpecialFolder.MyComputer ), null );
-// folderBrowserTreeView.EndUpdate();
- }
- else
- {
- folderBrowserTreeView.BeginUpdate( );
- GetAllSubDirs( Environment.GetFolderPath( rootFolder ), null );
- folderBrowserTreeView.EndUpdate( );
- }
-
- if ( selectedPathNode != null )
- {
- folderBrowserTreeView.SelectedNode = selectedPathNode;
- }
-
- Cursor = oldCursor;
- }
-
- void StartThread( )
- {
- reader_thread = new Thread( new ThreadStart( ThreadFunc ) );
- reader_thread.Start( );
- }
-
- void StopThread( )
- {
- if ( reader_thread != null )
- {
- // is there any other safe and clean
- // way to stop a thread that calls a recursive
- // method ??
- // maybe throw some other exception...
- reader_thread.Abort( );
- reader_thread = null;
- }
- }
-
- void ThreadFunc( )
- {
- Console.WriteLine( "Starting thread..." );
-
- try
- {
-
- GetAllSubDirs( globalPath, globalTreeNode );
- }
- catch (ThreadAbortException)
- {
- Console.WriteLine( "Thread aborted..." );
- }
- finally
- {
- Console.WriteLine( "Leaving thread..." );
- reader_thread = null;
- }
- }
-
- void ThreadTreeViewUpdate( object sender, ThreadEventArgs e )
- {
- if ( e.ParentTreeNode == null )
- {
- folderBrowserTreeView.Nodes.Add( e.FolderBrowserTreeNode );
- }
- else
- {
- e.ParentTreeNode.Nodes.Add( e.FolderBrowserTreeNode );
- }
- }
-
- private void GetAllSubDirs( string path, TreeNode parent )
- {
- string shortname = Path.GetFileName( path );
-
- // no hidden dirs in *nix
- if ( shortname.StartsWith( "." ) ) return;
-
- FolderBrowserTreeNode node = new FolderBrowserTreeNode( shortname );
- node.FullPathName = path;
-
- if ( selectedPath == path )
- {
- selectedPathNode = node;
- node.EnsureVisible( );
- }
-
- node.ImageIndex = NodeImageIndex( path );
-
- BeginInvoke( OnThreadTreeViewUpdate, new object[] { this, new ThreadEventArgs( node, parent ) } );
-
- Thread.Sleep( 20 );
-
- try
- {
- string[] directories = Directory.GetDirectories( path );
-
- foreach ( string s in directories )
- GetAllSubDirs( s, node );
- }
- catch ( Exception ex ) // if we have no permission
- {
- Console.WriteLine( ex.ToString( ) );
- }
- }
-
- 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;
- }
-
- public class ThreadEventArgs : EventArgs
- {
- FolderBrowserTreeNode folderBrowserTreeNode;
-
- TreeNode parentTreeNode;
-
- public FolderBrowserTreeNode FolderBrowserTreeNode
- {
- get
- {
- return folderBrowserTreeNode;
- }
- }
-
- public TreeNode ParentTreeNode
- {
- get
- {
- return parentTreeNode;
- }
- }
-
- public ThreadEventArgs( FolderBrowserTreeNode folderBrowserTreeNode, TreeNode parentTreeNode )
- {
- this.folderBrowserTreeNode = folderBrowserTreeNode;
- this.parentTreeNode = parentTreeNode;
- }
- }
-
- internal class FolderBrowserTreeNode : TreeNode
- {
- private string fullPathName = "";
-
- public FolderBrowserTreeNode( string text )
- : base( text )
- {}
-
- public string FullPathName
- {
- set
- {
- fullPathName = value;
- }
-
- get
- {
- return fullPathName;
- }
- }
- }
- }
- #endregion // Internal Methods
-
- #region Events
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler HelpRequest;
- #endregion
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- {
- 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";
-
- fontDialogPanel = new FontDialogPanel( this );
- }
- #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;
- }
- #endregion // Public Instance Methods
-
- #region Protected Instance Methods
- [MonoTODO]
- protected override bool RunDialog( IntPtr hwndOwner )
- {
- form.Controls.Add( fontDialogPanel );
-
- return true;
- }
- #endregion // Protected Instance Methods
- }
-
- 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 )
- {
- 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 );
- 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;
- }
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.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 formBorderStyle;
- private static bool autoscale;
- private static Size autoscale_base_size;
- internal bool is_modal;
- internal bool end_modal; // This var is being monitored by the application modal loop
- 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 MdiChildContext mdi_child_context;
- 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;
- Color transparency_key;\r
-
- #endregion // Local Variables
-
- #region Private & Internal Methods
- #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) {
- for (int i=0; i<list.Count; i++) {
- if (list[i]==value) {
- // Do we need to do anything here?
- return;
- }
- }
- list.Add(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() {
- closing = false;
- is_modal = false;
- end_modal = false;
- dialog_result = DialogResult.None;
- start_position = FormStartPosition.WindowsDefaultLocation;
- formBorderStyle = FormBorderStyle.Sizable;
- key_preview = false;
- opacity = 1D;
- menu = null;
- icon = null;
- 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;
- }
- }
-
- [MonoTODO("Figure out a way for transparency support in windows")]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool AllowTransparency {
- get {
- return false;
- }
-
- set {
- }
- }
-
- [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 && (dialog_result != DialogResult.None)) {
- end_modal = true;
- }
- }
- }
-
- [DefaultValue(FormBorderStyle.Sizable)]
- [DispId(-504)]
- public FormBorderStyle FormBorderStyle {
- get {
- return formBorderStyle;
- }
- set {
- formBorderStyle = 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;
-
- XplatUI.SetIcon(Handle, 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)]
- [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) {
- mdi_child_context = new MdiChildContext (this);
- mdi_parent.MdiContainer.Controls.Add (this);
- }
-
- ResumeLayout ();
- }
- }
-
- internal MdiClient MdiContainer {
- get { return mdi_container; }
- }
-
- [DefaultValue(null)]
- public MainMenu Menu {
- get {
- return menu;
- }
-
- set {
- if (menu != value) {
- menu = value;
-
- if (menu != null) {
- menu.SetForm (this);
- MenuAPI.SetMenuBarWindow (menu.Handle, this);
-
- if (IsHandleCreated) {
- XplatUI.SetMenu (window.Handle, menu.Handle);
- }
-
- UpdateBounds (bounds.X, bounds.Y, bounds.Width, bounds.Height, ClientSize.Width, ClientSize.Height -
- ThemeEngine.Current.CalcMenuBarSize (DeviceContext, menu.Handle, ClientSize.Width));
- } else
- UpdateBounds ();
- }
- }
- }
-
- [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;
- }
- }
-
- [MonoTODO("Investigate ways to implement opacity")]
- [DefaultValue(1D)]
- [TypeConverter(typeof(OpacityConverter))]
- public double Opacity {
- get {
- return opacity;
- }
-
- set {
- opacity = value;
- }
- }
-
-
- [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;
- 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 {\r
- get {\r
- return transparency_key;\r
- }\r
-\r
- set {\r
- AllowTransparency = true;\r
- transparency_key = value;\r
- // TODO: change window attributes; a new driver call\r
- }\r
- }\r
-
- [DefaultValue(FormWindowState.Normal)]
- public FormWindowState WindowState {
- get {
- return XplatUI.GetWindowState(window.Handle);
- }
-
- set {
- XplatUI.SetWindowState(window.Handle, value);
- }
- }
-
- #endregion // Public Instance Properties
-
- #region Protected Instance Properties
- [MonoTODO("Need to add MDI support")]
- protected override CreateParams CreateParams {
- get {
- CreateParams cp;
-
- cp = new CreateParams();
-
- cp.Caption = Text;
- cp.ClassName = XplatUI.DefaultClassName;
- cp.ClassStyle = 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_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN);
-
- 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) {
- cp.ExStyle |= (int)WindowStyles.WS_EX_CONTEXTHELP;
- }
- 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
- [MonoTODO("Figure out the math")]
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static SizeF GetAutoScaleSize(Font font) {
- SizeF result;
-
- result = new SizeF(250, 250);
- result.Width *= font.SizeInPoints / 12;
- result.Height *= font.SizeInPoints / 12;
- return result;
- }
- #endregion // Public Static Methods
-
- #region Public Instance Methods
- 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 () {
- CancelEventArgs args = new CancelEventArgs ();
- OnClosing (args);
- if (!args.Cancel) {
- OnClosed (EventArgs.Empty);
- closing = true;
- return;
- }
- }
-
- 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) {
- this.owner = (Form)Control.FromHandle(ownerWin32.Handle);
- }
-
- if (is_modal) {
- return DialogResult.None;
- }
-
- 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 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();
- }
-
- XplatUI.SetModal(window.Handle, true);
-
- Show();
- PerformLayout();
-
- is_modal = true;
- Application.ModalRun(this);
- is_modal = false;
- Hide();
-
- XplatUI.SetModal(window.Handle, false);
-
- 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() {
- // Hm, not sure what this does
- }
-
- 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 ();
- }
-
- [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;
- }
-
- switch (StartPosition) {
- case FormStartPosition.CenterScreen:
- this.CenterToScreen();
- break;
- case FormStartPosition.CenterParent:
- this.CenterToParent ();
- break;
- }
-
-
- if (menu != null) {
- XplatUI.SetMenu(window.Handle, menu.Handle);
- }
-
- 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) {
- 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);
- }
- }
-
- [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 (menu != null) {
- return menu.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;
-
- IntPtr menu_handle = (menu == null)?IntPtr.Zero:menu.Handle;
-
- if (XplatUI.CalculateWindowRect(Handle, ref ClientRect, cp.Style, cp.ExStyle, menu_handle, 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 (IsMdiChild && mdi_child_context.HandleMessage (ref m)) {
- return;
- }
-
- switch((Msg)m.Msg) {
- case Msg.WM_CLOSE: {
- CancelEventArgs args = new CancelEventArgs();
-
- OnClosing(args);
-
- if (!args.Cancel) {
- OnClosed(EventArgs.Empty);
- closing = true;
- base.WndProc(ref m);
- break;
- }
- break;
- }
-
- 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 (this.menu != null) {
- int x = LowOrder ((int) m.LParam.ToInt32 ()) ;
- int y = HighOrder ((int) m.LParam.ToInt32 ());
- menu.OnMouseDown(this, new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()), mouse_clicks, x, y, 0));
- }
- base.WndProc(ref m);
- return;
- }
-
- case Msg.WM_NCMOUSEMOVE: {
- if (this.menu != null) {
- menu.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 (this.menu != null) {
- Point pnt = XplatUI.GetMenuOrigin(window.Handle);
- MenuAPI.DrawMenuBar (menu.Handle, new Rectangle (pnt.X, pnt.Y, ClientSize.Width, 0));
- }
-
- base.WndProc(ref m);
- return;
- }
-
- // This message is only received under Win32
- case Msg.WM_NCCALCSIZE: {
- XplatUIWin32.NCCALCSIZE_PARAMS ncp;
-
- if ((menu != 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.menu_handle, 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
-
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;\r
- private Rectangle plus_minus_bounds;\r
- private Rectangle bounds;
- #endregion // Local Variables
-
- #region Contructors
- public GridEntry() : base() {\r
- plus_minus_bounds = new Rectangle(0,0,0,0);\r
- 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 {\r
- get {\r
- return top;\r
- }\r
- set {\r
- top = value;\r
- }\r
- }\r
-\r
- internal override Rectangle PlusMinusBounds {\r
- get{\r
- return plus_minus_bounds;\r
- }\r
- set{\r
- plus_minus_bounds = value;\r
- }\r
- }\r
-\r
- internal override Rectangle Bounds\r
- {\r
- get\r
- {\r
- return bounds;\r
- }\r
- set\r
- {\r
- bounds = value;\r
- }\r
- }\r
-
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 Constructors
- protected GridItem() {
- }
- #endregion // Constructors
-
- #region Public Instance Properties
- [MonoTODO]
- public virtual new bool Expandable
- {
- get {
- throw new NotImplementedException();
- }
- }
-
- [MonoTODO]
- public virtual new bool Expanded
- {
- get {
- throw new NotImplementedException();
- }
-
- set {
- throw new NotImplementedException();
- }
- }
-
- 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 \r
- {
- get;
- set;
- }
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- {
- #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\r
- public class GridItemEnumerator : IEnumerator{\r
- int nIndex;\r
- GridItemCollection collection;\r
- public GridItemEnumerator(GridItemCollection coll) {\r
- collection = coll;\r
- nIndex = -1;\r
- }\r
-\r
- public bool MoveNext() {\r
- nIndex++;\r
- return(nIndex < collection.Count);\r
- }\r
-\r
- public void Reset() {\r
- nIndex = -1;\r
- }\r
-\r
- object System.Collections.IEnumerator.Current {\r
- get {\r
- return(collection[nIndex]);\r
- }\r
- }\r
- }
- #endregion
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-//
-// 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, true);
- SetStyle(ControlStyles.Selectable, false);
- SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
- }
-
- #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
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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; }
- }\r
- }
- #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 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() {\r
- return base.ToString() + ", HelpNameSpace: " + helpnamespace;\r
- }\r
-
- #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;\r
-
- 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;
- }
-
-\r
- // This is called when the user does a "what's this" style lookup. It uses the 'text' property\r
- private void HelpRequested(object sender, HelpEventArgs e) {\r
- Size size;\r
- Point pt;\r
- Control control;\r
-\r
- control = (Control)sender;\r
-\r
- if (GetHelpProperty(control).Text == null) {\r
- return;\r
- }\r
-\r
- pt = e.MousePos;\r
-\r
- // Display Tip\r
- tooltip.Text = GetHelpProperty(control).Text;\r
- size = ThemeEngine.Current.ToolTipSize(tooltip, tooltip.Text);\r
- tooltip.Width = size.Width;\r
- tooltip.Height = size.Height;\r
- pt.X -= size.Width / 2;\r
-\r
- if (pt.X < 0) {\r
- pt.X += size.Width / 2;\r
- }\r
-\r
- if ((pt.X + size.Width) < SystemInformation.WorkingArea.Width) {\r
- tooltip.Left = pt.X;\r
- } else {\r
- tooltip.Left = pt.X - size.Width;\r
- }\r
-\r
- if ((pt.Y + size.Height) < (SystemInformation.WorkingArea.Height - 16)) {\r
- tooltip.Top = pt.Y;\r
- } else {\r
- tooltip.Top = pt.Y - size.Height;\r
- }\r
-\r
- \r
- tooltip.Visible = true;\r
- control.KeyPress += HideToolTipKeyHandler;\r
- control.MouseDown += HideToolTipMouseHandler;\r
- control.LostFocus += HideToolTipHandler;\r
- e.Handled = true;\r
- }\r
- #endregion // Private Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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 const int caption_height = 0; // FIXME - Read this value from somewhere
- private const int tool_caption_height = 0; // FIXME - Read this value from somewhere
-
- private IntPtr handle;
- internal IntPtr client_window;
- internal IntPtr whole_window;
- internal IntPtr menu_handle;
- internal TitleStyle title_style;
- internal BorderStyle border_style;
- internal Border3DStyle edge_style;
- internal int x;
- internal int y;
- internal int width;
- internal int height;
- internal Hwnd parent;
- internal bool visible;
- internal Rectangle invalid;
- internal bool expose_pending;
- internal bool erase_pending;
- internal bool nc_expose_pending;
- internal bool configure_pending;
- internal Graphics client_dc;
- internal object user_data;
- internal Rectangle client_rectangle;
- internal ArrayList marshal_free_list;
- #endregion // Local Variables
-
- #region Constructors and destructors
- public Hwnd() {
- x = 0;
- y = 0;
- width = 0;
- height = 0;
- visible = false;
- menu_handle = IntPtr.Zero;
- border_style = BorderStyle.None;
- client_window = IntPtr.Zero;
- whole_window = IntPtr.Zero;
- handle = IntPtr.Zero;
- parent = null;
- invalid = Rectangle.Empty;
- expose_pending = false;
- nc_expose_pending = false;
- edge_style = Border3DStyle.Raised;
- client_rectangle = Rectangle.Empty;
- erase_pending = true;
- marshal_free_list = new ArrayList(2);
- }
-
- 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(BorderStyle border_style, IntPtr menu_handle, TitleStyle title_style, Rectangle client_rect) {
- Rectangle rect;
-
- rect = new Rectangle(client_rect.Location, client_rect.Size);
-
- if (menu_handle != IntPtr.Zero) {
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (menu_handle);
- if (menu != null) {
- int menu_height = menu.Height;
- rect.Y -= menu_height;
- rect.Height += menu_height;
- } else
- Console.WriteLine("Hwnd.GetWindowRectangle: No MENU for menu_handle = {0}", menu_handle);
- }
-
- if (border_style == BorderStyle.Fixed3D) {
- rect.X -= 2;
- rect.Y -= 2;
- rect.Width += 4;
- rect.Height += 4;
- } else if (border_style == BorderStyle.FixedSingle) {
- rect.X -= 1;
- rect.Y -= 1;
- rect.Width += 2;
- rect.Height += 2;
- }
-
- 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(BorderStyle border_style, IntPtr menu_handle, TitleStyle title_style, int width, int height) {
- Rectangle rect;
-
- rect = new Rectangle(0, 0, width, height);
-
- if (menu_handle != IntPtr.Zero) {
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (menu_handle);
- if (menu != null) {
- int menu_height = menu.Height;
- rect.Y += menu_height;
- rect.Height -= menu_height;
- } else
- Console.WriteLine("Hwnd.GetClientRectangle: No MENU for menu_handle = {0}", menu_handle);
- }
-
- if (border_style == BorderStyle.Fixed3D) {
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 4;
- rect.Height -= 4;
- } else if (border_style == BorderStyle.FixedSingle) {
- rect.X += 1;
- rect.Y += 1;
- rect.Width -= 2;
- rect.Height -= 2;
- }
-
- if (title_style == TitleStyle.Normal) {
- rect.Y += caption_height;
- rect.Height -= caption_height;
- } else if (title_style == TitleStyle.Normal) {
- rect.Y += tool_caption_height;
- rect.Height -= tool_caption_height;
- }
-
- return rect;
- }
- #endregion // Static Methods
-
- #region Instance Properties
- public BorderStyle 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 {
- Rectangle rect;
-
- rect = new Rectangle(0, 0, width, height);
-
- if (border_style == BorderStyle.Fixed3D) {
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 4;
- rect.Height -= 4;
- } else if (border_style == BorderStyle.FixedSingle) {
- rect.X += 1;
- rect.Y += 1;
- rect.Width -= 2;
- rect.Height -= 2;
- }
-
- if (this.title_style == TitleStyle.Normal) {
- rect.Y += caption_height;
- rect.Height -= caption_height;
- } else if (this.title_style == TitleStyle.Normal) {
- rect.Y += tool_caption_height;
- rect.Height -= tool_caption_height;
- }
-
- return rect;
- }
- }
-
- public Border3DStyle EdgeStyle {
- get {
- return edge_style;
- }
-
- set {
- edge_style = value;
- }
- }
-
- public bool ErasePending {
- get {
- return erase_pending;
- }
-
- set {
- erase_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 IntPtr MenuHandle {
- get {
- return menu_handle;
- }
-
- set {
- menu_handle = value;
- }
- }
-
- public Point MenuOrigin {
- get {
- Point pt;
-
- pt = new Point(0, 0);
-
- if (border_style == BorderStyle.Fixed3D) {
- pt.X += 2;
- pt.Y += 2;
- } else if (border_style == BorderStyle.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 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;
- }
- invalid = Rectangle.Union (invalid, new Rectangle (x, y, width, height));
- }
-
- 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;
- }
- #endregion // Methods
- }
-}
+++ /dev/null
-//
-// 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 ();
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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();
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-//
-
-// If we ever need to support the Handle property, we should create a static ArrayList,
-// and store the ImageList object in it, and return the index as handle
-// That way, once we try to support P/Invokes, we can make the handle back to the object
-
-
-// COMPLETE
-
-using System.Collections;
-using System.ComponentModel;
-using System.Drawing;
-using System.Drawing.Imaging;
-
-namespace System.Windows.Forms {
- [DefaultProperty("Images")]
- [Designer("System.Windows.Forms.Design.ImageListDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
- [ToolboxItemFilter("System.Windows.Forms", ToolboxItemFilterType.Allow)]
- [TypeConverter("System.Windows.Forms.ImageListConverter, " + Consts.AssemblySystem_Windows_Forms)]
- public sealed class ImageList : System.ComponentModel.Component {
- #region Local Variables
- private ColorDepth color_depth;
- private ImageCollection image_collection;
- private Size size;
- private Color transparency_color;
- private Delegate handler;
- private ImageListStreamer image_stream;
- private IntPtr handle;
- #endregion // Local Variables
-
- #region Sub-classes
- [Editor("System.Windows.Forms.Design.ImageCollectionEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
- public sealed class ImageCollection : IList, ICollection, IEnumerable {
- #region ImageCollection Local Variables
- private ImageList owner;
- private ArrayList list;
- #endregion // ImageCollection Local Variables
-
- #region ImageCollection Private Constructors
- internal ImageCollection(ImageList owner) {
- this.owner=owner;
- this.list=new ArrayList();
- }
- #endregion // ImageCollection Private Constructor
-
- #region ImageCollection Public Instance Properties
- [Browsable(false)]
- public int Count {
- get {
- return list.Count;
- }
- }
-
- public bool Empty {
- get {
- return list.Count==0;
- }
- }
-
- public bool IsReadOnly {
- get {
- return list.IsReadOnly;
- }
- }
-
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Image this[int index] {
- get {
- if (index<0 || index>=list.Count) {
- throw new ArgumentOutOfRangeException("index", index, "ImageCollection does not have that many images");
- }
- return (Image)list[index];
- }
-
- set {
- if (index<0 || index>=list.Count) {
- throw new ArgumentOutOfRangeException("index", index, "ImageCollection does not have that many images");
- }
-
- if (value==null) {
- throw new ArgumentOutOfRangeException("value", value, "Image cannot be null");
- }
-
- list[index]=value;
- // What happens if the bitmap had a previous 'MakeTransparent' done to it?
- ((Bitmap)list[index]).MakeTransparent(owner.transparency_color);
- }
- }
- #endregion // ImageCollection Public Instance Properties
-
- #region ImageCollection Private Instance Methods
- private int AddInternal(Image image) {
- int width;
- int height;
- PixelFormat format;
-
- width=owner.ImageSize.Width;
- height=owner.ImageSize.Height;
- switch(owner.color_depth) {
- case ColorDepth.Depth4Bit: format=PixelFormat.Format4bppIndexed; break;
- case ColorDepth.Depth8Bit: format=PixelFormat.Format8bppIndexed; break;
- case ColorDepth.Depth16Bit: format=PixelFormat.Format16bppRgb555; break;
- case ColorDepth.Depth24Bit: format=PixelFormat.Format24bppRgb; break;
- case ColorDepth.Depth32Bit: format=PixelFormat.Format32bppArgb; break;
- default: format=PixelFormat.Format32bppArgb; break;
- }
-
- // Check if we can add straight or if we have to resize
- if (image.Width!=width || image.Height!=height || image.PixelFormat!=format) {
- Graphics g;
- Bitmap reformatted_image;
-
- reformatted_image = new Bitmap(width, height, format);
- g=Graphics.FromImage(reformatted_image);
-
- g.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
- g.Dispose();
-
- return list.Add(reformatted_image);
- } else {
- return list.Add(image);
- }
- }
-
- internal void Dispose() {
-#if dontwantthis
- if (list!=null) {
- for (int i=0; i<list.Count; i++) {
- ((Image)list[i]).Dispose();
- }
- }
-#endif
- }
- #endregion // ImageCollection Private Instance Methods
-
- #region ImageCollection Public Instance Methods
- public int Add(Image value, Color transparentColor) {
- if (value==null) {
- throw new ArgumentNullException("value", "Cannot add null image");
- }
-
- ((Bitmap)value).MakeTransparent(owner.transparency_color);
- return AddInternal(value);
-
- }
-
- public void Add(Icon value) {
- Image image;
-
- image = value.ToBitmap();
-
- if (value==null || image==null) {
- throw new ArgumentNullException("value", "Cannot add null icon");
- }
-
- ((Bitmap)image).MakeTransparent(owner.transparency_color);
- AddInternal(image);
- }
-
- public void Add(Image value) {
- if (value==null) {
- throw new ArgumentNullException("value", "Cannot add null image");
- }
- ((Bitmap)value).MakeTransparent(owner.transparency_color);
- AddInternal(value);
- }
-
- public int AddStrip(Image value) {
- int image_count;
- int width;
- int height;
- Bitmap image;
- Graphics g;
-
- if (value==null) {
- throw new ArgumentNullException("value", "Cannot add null images");
- }
-
- if ((value.Width % owner.ImageSize.Width) != 0) {
- throw new ArgumentException("Strip is not a multiple of the ImageList with", "value");
- }
-
- // MSDN: The number of images is inferred from the width. A strip is multiple images side-by-side
- width=owner.ImageSize.Width;
- height=owner.ImageSize.Height;
- image_count=value.Width/width;
- for (int i=0; i<image_count; i++) {
- image = new Bitmap(value, width, height);
- g = Graphics.FromImage(image);
-
- g.DrawImage(value, new Rectangle(0, 0, width, height), i*width, 0, width, height, GraphicsUnit.Pixel);
- AddInternal(image);
-
- g.Dispose();
- image.Dispose();
- }
-
- // FIXME - is this right? MSDN says to return the index, but we might have multiple...
- return image_count;
- }
-
- public void Clear() {
- list.Clear();
- }
-
- public bool Contains(Image image) {
- return list.Contains(image);
- }
-
- public IEnumerator GetEnumerator() {
- return list.GetEnumerator();
- }
-
- public int IndexOf(Image image) {
- return list.IndexOf(image);
- }
-
- public void Remove(Image image) {
- list.Remove(image);
- }
-
- public void RemoveAt(int index) {
- if (index<0 || index>=list.Count) {
- throw new ArgumentOutOfRangeException("index", index, "ImageCollection does not have that many images");
- }
-
- list.RemoveAt(index);
- }
- #endregion // ImageCollection Public Instance Methods
-
- #region ImageCollection Interface Properties
- object IList.this[int index] {
- get {
- if (index<0 || index>=list.Count) {
- throw new ArgumentOutOfRangeException("index", index, "ImageCollection does not have that many images");
- }
- return this[index];
- }
-
- set {
- if (!(value is Bitmap)) {
- throw new ArgumentException("Object of type Image required", "value");
- }
-
- this[index]=(Image)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 // ImageCollection Interface Properties
-
- #region ImageCollection Interface Methods
- int IList.Add(object value) {
- if (value == null) {
- throw new ArgumentNullException("value", "Cannot add null images");
- }
-
- if (!(value is Bitmap)) {
- throw new ArgumentException("Object of type Image required", "value");
- }
-
- return list.Add(value);
- }
-
- bool IList.Contains(object value) {
- if (!(value is Bitmap)) {
- throw new ArgumentException("Object of type Image required", "value");
- }
-
- return this.Contains((Image) value);
- }
-
- int IList.IndexOf(object value) {
- if (!(value is Bitmap)) {
- throw new ArgumentException("Object of type Image required", "value");
- }
-
- return this.IndexOf((Image) value);
- }
-
- void IList.Insert(int index, object value) {
- if (!(value is Bitmap)) {
- throw new ArgumentException("Object of type Image required", "value");
- }
- list.Insert(index, value);
- }
-
- void IList.Remove(object value) {
- if (!(value is Bitmap)) {
- throw new ArgumentException("Object of type Image required", "value");
- }
- list.Remove(value);
- }
-
- void ICollection.CopyTo(Array array, int index) {
- if (list.Count>0) {
- list.CopyTo(array, index);
- }
- }
- #endregion // ImageCollection Interface Methods
- }
- #endregion // Sub-classes
-
- #region Public Constructors
- public ImageList() {
- color_depth = ColorDepth.Depth8Bit;
- transparency_color = Color.Transparent;
- size = new Size(16, 16);
- image_collection = new ImageCollection(this);
- handle = IntPtr.Zero;
- }
-
- public ImageList(System.ComponentModel.IContainer container) : this ()
- {
- color_depth = ColorDepth.Depth8Bit;
- transparency_color = Color.Transparent;
- size = new Size(16, 16);
- container.Add (this);
- }
- #endregion // Public Constructors
-
- #region Public Instance Properties
- [DefaultValue(ColorDepth.Depth8Bit)]
- public ColorDepth ColorDepth {
- get {
- return this.color_depth;
- }
-
- set {
- this.color_depth=value;
- }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public IntPtr Handle {
- get {
- if (RecreateHandle!=null) RecreateHandle(this, EventArgs.Empty);
- handle = new IntPtr(1);
- return handle;
- }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool HandleCreated {
- get {
- if (handle != IntPtr.Zero) {
- return true;
- }
- return false;
- }
- }
-
- [DefaultValue(null)]
- [MergableProperty(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public ImageCollection Images {
- get {
- return this.image_collection;
- }
- }
-
- [Localizable(true)]
- public Size ImageSize {
- get {
- return this.size;
- }
-
- 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 255", "value");
- }
- this.size=value;
- }
- }
-
- [Browsable(false)]
- [DefaultValue(null)]
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public ImageListStreamer ImageStream {
- get {
- return image_stream;
- }
-
- set {
- image_stream = value;
-
- size = image_stream.ImageSize;
- color_depth = image_stream.ImageColorDepth;
- transparency_color = image_stream.BackColor;
-
- image_collection.Clear ();
-
- foreach (Image image in image_stream.Images)
- image_collection.Add (image);
- }
- }
-
- public Color TransparentColor {
- get {
- return this.transparency_color;
- }
-
- set {
- this.transparency_color=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) {
- this.Draw(g, x, y, this.size.Width, this.size.Height, index);
- }
-
- public void Draw(Graphics g, int x, int y, int width, int height, int index) {
- Image i;
-
- if ((index < 0) || (index >= this.Images.Count)) {
- throw new ArgumentOutOfRangeException("index", index, "ImageList does not contain that many images");
- }
- i = this.Images[index];
- g.DrawImage(i, x, y, width, height);
- }
-
- public override string ToString() {
- return base.ToString () + " Images.Count: " + Images.Count + ", ImageSize: " + ImageSize;\r
- }
- #endregion // Public Instance Methods
-
- #region Protected Instance Methods
- protected override void Dispose(bool disposing) {\r
- if (image_collection!=null) {\r
- image_collection.Dispose();\r
- }\r
- }\r
-
- #endregion // Protected Instance Methods
-
- #region Events
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public event EventHandler RecreateHandle;
- #endregion // Events
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, 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 Image [] images;
- private Size image_size;
- private Color back_color;
-
- 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 []));
- }
-
- private byte [] GetStreamData ()
- {
- MemoryStream stream = new MemoryStream ();
- BinaryWriter writer = new BinaryWriter (stream);
-
- 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 (new SolidBrush (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 ImageColorDepth {
- get { return ColorDepth.Depth32Bit; }
- }
-
- internal Color BackColor {
- get { return back_color; }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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\80","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;
- }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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) {\r
- 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);
- }\r
-\r
- public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) {\r
- \r
- return false;\r
- }\r
-\r
- public override bool GetStandardValuesSupported(ITypeDescriptorContext context) {\r
- return true;\r
- }\r
-\r
- #endregion // Public Instance Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-//
-//
-
-// 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;
-\r
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler ImeModeChanged; \r
-\r
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event KeyEventHandler KeyDown; \r
-\r
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event KeyPressEventHandler KeyPress; \r
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event KeyEventHandler KeyUp;
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler TabStopChanged;
-
- public event EventHandler TextAlignChanged;
- #endregion
-
- public Label ()
- {
- // Defaults in the Spec
- autosize = false;
- border_style = BorderStyle.None;
- string_format = new StringFormat();
- TextAlign = ContentAlignment.TopLeft;
- image = null;
- UseMnemonic = true;
- image_list = null;
- image_align = ContentAlignment.MiddleCenter;
- SetUseMnemonic (UseMnemonic);
-
- BackColor = ThemeEngine.Current.ColorButtonFace;
- ForeColor = ThemeEngine.Current.ColorWindowText;
-
- CalcPreferredHeight ();
- CalcPreferredWidth ();
-
- AutoSizeChanged = null;
- TextAlignChanged = null;
-
- SetStyle (ControlStyles.ResizeRedraw, true);
- SetStyle (ControlStyles.Selectable, false);
- SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, 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 (new EventArgs ());
- }
- }
-
- [Browsable(false)]
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override Image BackgroundImage {
- get {
- return base.BackgroundImage;
- }
- set {
- if (base.BackgroundImage == value)
- return;
-
- if (BackgroundImageChanged != null)
- BackgroundImageChanged (this, EventArgs.Empty);
-
- base.BackgroundImage = value;
- Refresh ();
- }
- }
-
- [DefaultValue(BorderStyle.None)]
- [DispId(-504)]
- public virtual BorderStyle BorderStyle {
- 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)
- return;
-
- border_style = value;
- Refresh ();
- }
- }
-
- 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 {
- if (value == ImeMode)
- return;
- base.ImeMode = value;
- if (ImeModeChanged != null)
- ImeModeChanged (this, EventArgs.Empty);
- }
- }
-
- [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;}
- }
- \r
- [Browsable(false)]
- [DefaultValue(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new bool TabStop {
- get { return base.TabStop; }
- set {
- if (value == base.TabStop)
- return;
-
- base.TabStop = value;
- if (TabStopChanged != null)
- TabStopChanged (this, EventArgs.Empty);
- }
- }
-
- [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 (new EventArgs ());
- 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;
- }
-
- \r
- protected override AccessibleObject CreateAccessibilityInstance ()
- {
- return base.CreateAccessibilityInstance ();
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose (disposing);
- }
-
- 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
-
- }
- }
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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);
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
-
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;\r
- 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, 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 ();
- }
- }
- \r
- 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;
- }
- }
- }
- }
-\r
- 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);
- }
-
- protected override void OnMouseMove (MouseEventArgs e)
- {
- base.OnMouseMove (e);
-
- Link link = PointInLink (e.X, e.Y);
-
- if (link == null) {
- Cursor = Cursors.Default;
- bool changed = false;
- if (link_behavior == LinkBehavior.HoverUnderline) {
- for (int i = 0; i < Links.Count; i++) {
- if (Links[i].Hoovered == true) {
- changed = true;
- Links[i].Hoovered = false;
- }
- }
-
- if (changed == true)
- Refresh ();
- }
- return;
- }
-
- if (link_behavior == LinkBehavior.HoverUnderline) {
- if (link.Hoovered != true) {
- link.Hoovered = true;
- Refresh ();
- }
- }
-
- Cursor = Cursors.Hand;
- }
-
- 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);
- base.OnPaint(pevent);
- }
-
- 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);
- }
- \r
- 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 ();
- }
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
-
- }
-}
-
+++ /dev/null
-//
-// 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);
-
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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) {\r
- if (destinationType == typeof(string)) {\r
- return true;\r
- }\r
- return base.CanConvertTo (context, destinationType);\r
- }\r
-
- [MonoTODO]
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {\r
- return base.ConvertTo (context, culture, value, destinationType);\r
- }\r
-\r
- public override object CreateInstance(ITypeDescriptorContext context, System.Collections.IDictionary propertyValues) {\r
- return new Binding((string)propertyValues["PropertyName"], (object)propertyValues["DataSource"], (string)propertyValues["DataMember"]);\r
- }\r
-\r
- public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) {\r
- return true;\r
- }\r
- #endregion // Public Instance Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 BorderStyle border_style;
- 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 top_index;
- 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;
-
- 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;
- top_index = 0;
- use_tabstops = true;
- BackColor = ThemeEngine.Current.ColorWindow;
- ColumnWidth = 0;
- suspend_ctrlupdate = false;
- ctrl_pressed = false;
- shift_pressed = false;
- has_focus = 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 | ControlStyles.AllPaintingInWmPaint, true);
- }
-
- #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 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)
- return;
-
- border_style = value;
- base.Refresh ();
- }
- }
-
- [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;
- 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;
- }
-
- itemsHeight += ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle);
- itemsHeight += ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle);
-
- 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 top_index;}
- set {
- if (value == top_index)
- return;
-
- if (value < 0 || value >= Items.Count)
- return;
-
- value = top_index;
- 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;
- for (int i = 0; i < index; i++) {
- rect.Y += GetItemHeight (i);
- }
- } else {
- rect.Y = ItemHeight * index;
- }
- }
- else {
- int which_page;
-
- which_page = index / listbox_info.page_size;
- rect.Y = (index % 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)
- {
- 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);
- listbox_info.item_height = FontHeight;
-
- RellocateScrollBars ();
- CalcClientArea ();
- UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
- }
-
- protected override void OnHandleCreated (EventArgs e)
- {
- base.OnHandleCreated (e);
-
- UpdateInternalClientRect (ClientRectangle);
- Controls.Add (vscrollbar_ctrl);
- Controls.Add (hscrollbar_ctrl);
- 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;
- listbox_info.textdrawing_rect.Y += ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle);
- listbox_info.textdrawing_rect.X += ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle);
- //BUG: Top and Left decorations
- listbox_info.textdrawing_rect.Height -= ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle);
- listbox_info.textdrawing_rect.Width -= ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle);
-
- 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 / listbox_info.item_height;
- }
-
- if (listbox_info.page_size == 0) {
- listbox_info.page_size = 1;
- }
-
- /* Adjust size to visible the maxim 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 -
- ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle) -
- ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle)) %
- listbox_info.item_height;
-
- if (remaining > 0) {
- listbox_info.client_rect.Height -= remaining;
- CalcClientArea ();
- RellocateScrollBars ();
- base.Refresh ();
- }
- }
- }
-
- internal void Draw (Rectangle clip, Graphics dc)
- {
- if (LBoxInfo.textdrawing_rect.Contains (clip) == false) {
- // IntegralHeight has effect, we also have to paint the unused area
- if (ClientRectangle.Height > listbox_info.client_rect.Height) {
- Region area = new Region (ClientRectangle);
- area.Exclude (listbox_info.client_rect);
-
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (Parent.BackColor),
- area.GetBounds (dc));
- }
-
- 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 (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));
- }
- }
-
- ThemeEngine.Current.DrawListBoxDecorations (dc, this);
- }
-
- // 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;
-
- item_rect.Y += ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle);
- item_rect.X += ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle);
- item_rect.Width -= ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle);
-
- return item_rect;
- }
-
- // Value Changed
- private void HorizontalScrollEvent (object sender, EventArgs e)
- {
- if (multicolumn) {
- LBoxInfo.top_item = listbox_info.page_size * hscrollbar_ctrl.Value;
- LBoxInfo.last_item = LastVisibleItem ();
- }
-
- 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 (LBoxInfo.top_item == LBoxInfo.last_item)
- 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 (IntegralHeight) {
- if (item_rect.Y + item_rect.Height > top_y) {
- return i - 1;
- }
- }
- else {
- if (item_rect.Y + item_rect.Height > top_y)
- return i - 1;
- }
- }
- }
- return i - 1;
- }
-
- private void UpdatedTopItem ()
- {
- if (multicolumn) {
- int col = (LBoxInfo.top_item / LBoxInfo.page_size);
- 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) {
- if (focused_item + 1 > 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;
-
- 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,
- listbox_info.client_rect.Height - ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle) -
- ThemeEngine.Current.DrawListBoxDecorationBottom (BorderStyle));
-
- vscrollbar_ctrl.Location = new Point (listbox_info.client_rect.Width - vscrollbar_ctrl.Width
- - ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle),
- ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle));
-
- }
-
- if (listbox_info.show_horizontalsb) {
-
- int width;
-
- width = listbox_info.client_rect.Width - (ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle) + ThemeEngine.Current.DrawListBoxDecorationRight (BorderStyle));
-
- if (listbox_info.show_verticalsb)
- width -= vscrollbar_ctrl.Width;
-
- hscrollbar_ctrl.Size = new Size (width, hscrollbar_ctrl.Height);
-
- hscrollbar_ctrl.Location = new Point (ThemeEngine.Current.DrawListBoxDecorationLeft (BorderStyle),
- listbox_info.client_rect.Height - hscrollbar_ctrl.Height
- - ThemeEngine.Current.DrawListBoxDecorationTop (BorderStyle));
- }
-
- 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.Contains (invalidate))
- Invalidate (invalidate);
-
- }
-
- // An item navigation operation (mouse or keyboard) has caused to select a new item
- private 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);
- }
- }
- }
-
- 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.Contains (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 ();
- }
-
- CalcClientArea ();
- }
-
- // Value Changed
- private void VerticalScrollEvent (object sender, EventArgs e)
- {
- LBoxInfo.top_item = /*listbox_info.page_size + */ vscrollbar_ctrl.Value;
- LBoxInfo.last_item = LastVisibleItem ();
-
- 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
-
- }
-
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
-
- #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, ValueMember];
- data_manager.PositionChanged += new EventHandler (OnPositionChanged);
- }
-
- private void OnPositionChanged (object sender, EventArgs e)
- {
- SelectedIndex = data_manager.Position;
- }
-
- #endregion Private Methods
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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:
-// - Keys to be handled ENTER/PAGE UP/PAGE DOWN/HOME/END/ARROWS/CTRL/SHIFT
-// - Item text editing
-// - Column resizing/reodering
-// - Feedback for item activation, change in cursor types as mouse moves.
-// - HideSelection
-// - Focused item (broken and not drawn)
-// - LabelEdit
-// - Manual column resizing
-// - Drag and drop
-// - Clipping
-
-
-// NOT COMPLETE
-
-
-using System.Collections;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Drawing;
-using System.Runtime.InteropServices;
-
-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;
- private bool draw_headers = true; // Used for painting. Do we need to draw column headers ?
- private 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
- private ScrollBar h_scroll; // used for scrolling horizontally
- private ScrollBar v_scroll; // used for scrolling vertically
- private int h_marker; // Position markers for scrolling
- private int v_marker;
-
- // 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;
-
- // 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.AllPaintingInWmPaint, true);
- }
- #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 border_style; }
- set {
- if (value != BorderStyle.Fixed3D && value != BorderStyle.FixedSingle &&
- value != BorderStyle.None) {
- throw new InvalidEnumArgumentException (string.Format
- ("Enum argument value '{0}' is not valid for BorderStyle", value));
- }
-
- if (border_style != value) {
- border_style = value;
- this.Redraw (true);
- }
- }
- }
-
- [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.Contains (h_marker, 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) {
- view = value;
- Redraw (true);
- }
- }
- }
- #endregion // Public Instance Properties
-
- #region Internal Methods Properties
- 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 ()
- {
- 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 > this.Width) {
- h_scroll.Visible = true;
- if ((layout_ht + h_scroll.Height) > Height)
- v_scroll.Visible = true;
- } else if (layout_ht > Height) {
- v_scroll.Visible = true;
- if ((layout_wd + v_scroll.Width) > Width)
- h_scroll.Visible = true;
- }
-
- if (h_scroll.Visible) {
- h_scroll.Location = new Point (0, Height - 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 = Width - v_scroll.Width;
- }
- else {
- h_scroll.Maximum = layout_wd;
- h_scroll.Width = Width;
- }
-
- h_scroll.LargeChange = Width;
- h_scroll.SmallChange = Font.Height;
- }
-
- // vertical scrollbar
- if (v_scroll.Visible) {
- v_scroll.Location = new Point (Width - v_scroll.Width, 0);
- 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 = Height - h_scroll.Height;
- } else {
- v_scroll.Maximum = layout_ht;
- v_scroll.Height = Height;
- }
-
- v_scroll.LargeChange = Height;
- v_scroll.SmallChange = Font.Height;
- }
- }
-
- // 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) ?
- 2 : this.Font.Height + 5;
- if (columns.Count > 0) {
- foreach (ColumnHeader col in columns) {
- col.X = current_pos_x;
- col.Y = 0;
- 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 = this.Height;
- foreach (ListViewItem item in items) {
- item.location.X = current_pos_x +
- horizontal_spacing;
- item.location.Y = current_pos_y;
- 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) <= this.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 = this.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) <= this.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 = this.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 ();
- }
-
-
- // 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)
- return;
-
- ke.Handled = true;
-
- switch (ke.KeyCode) {
-
- case Keys.ControlKey:
- this.ctrl_pressed = true;
- break;
-
- case Keys.Down:
- // FIXME:TODO
- break;
-
- case Keys.End:
- this.v_scroll.Value = this.v_scroll.Maximum;
- break;
-
- case Keys.Home:
- this.v_scroll.Value = this.v_scroll.Minimum;
- break;
-
- case Keys.Left:
- index = -1;
- if (this.last_clicked_item != null)
- index = this.last_clicked_item.Index;
- else
- break;
-
- if (index > 0)
- index -= 1;
-
- this.last_clicked_item = this.items [index];
- this.last_clicked_item.Selected = true;
- this.EnsureVisible (index);
- break;
-
- case Keys.Right:
- if (this.last_clicked_item != null)
- index = this.last_clicked_item.Index + 1;
- else
- index = 1;
-
- if (index == this.items.Count)
- break;
-
- this.last_clicked_item = this.items [index];
- this.last_clicked_item.Selected = true;
- this.EnsureVisible (index);
- break;
-
- case Keys.ShiftKey:
- this.shift_pressed = true;
- break;
-
- case Keys.Up:
- // FIXME:TODO
- break;
-
- default:
- ke.Handled = false;
- break;
- }
- }
-
- 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.draw_headers = 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
- this.focused_item = this.clicked_item;
-
- if (this.clicked_item != null) {
- this.clicked_item.Selected = true;
- // Raise the event
- this.OnSelectedIndexChanged (new EventArgs ());
-
- this.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.draw_headers = true;
- this.Redraw (false);
- }
- else if (this.clicked_column.pressed &&
- ! this.clicked_column.Rect.Contains (hit)) {
- this.clicked_column.pressed = false;
- this.draw_headers = true;
- 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.draw_headers = true;
- 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);
-
- // We paint on the screen as per the location set
- // by the two scrollbars. In case of details view
- // since column headers can scroll only horizontally
- // and items can scroll in both directions, paiting is
- // done separtely for the column header and the items.
-
- Rectangle srcRect = this.ClientRectangle;
- Rectangle dstRect = this.ClientRectangle;
-
- // set the visible starting point
- if (scrollable) {
- srcRect.X += h_marker;
- srcRect.Y += v_marker;
-
- if (h_scroll.Visible) {
- srcRect.Height -= h_scroll.Height;
- dstRect.Height -= h_scroll.Height;
- }
-
- if (v_scroll.Visible) {
- srcRect.Width -= v_scroll.Width;
- dstRect.Width -= v_scroll.Width;
- }
- }
-
- // We paint the column headers always at the top, in case
- // of vertical scrolling. Therefore, we advance the painting
- // by the amount equal to the column height.
- /*
- if (this.view == View.Details &&
- this.Columns.Count > 0 &&
- this.header_style != ColumnHeaderStyle.None &&
- v_marker > 0 ) {
-
- int col_ht = this.Columns [0].Ht;
-
- if (this.draw_headers) {
- this.draw_headers = false;
- // Move the source rect by the amount of horizontal
- // scrolling done so far.
- Rectangle headerSrc = new Rectangle (h_marker, 0,
- srcRect.Width, col_ht);
- // dest rect is always stable at 0,0
- Rectangle headerDst = new Rectangle (0, 0, srcRect.Width, col_ht);
- pe.Graphics.DrawImage (this.ImageBuffer, headerDst,
- headerSrc, GraphicsUnit.Pixel);
- }
-
- dstRect.Y += col_ht;
- srcRect.Y += col_ht;
- }
- */
-
- // Draw the border of the list view
- // The border is painted here separately, because
- // our imagebuffer might be scrollable
- ThemeEngine.Current.CPDrawBorderStyle (pe.Graphics,
- this.ClientRectangle,
- this.BorderStyle);
-
- // Raise the Paint event
- if (Paint != null)
- Paint (this, pe);
- }
-
- private void ListView_SizeChanged (object sender, EventArgs e)
- {
- CalculateScrollBars ();
- }
-
- private void HorizontalScroller (object sender, EventArgs e)
- {
- // Avoid unnecessary flickering, when button is
- // kept pressed at the end
- if (h_marker != h_scroll.Value) {
- h_marker = h_scroll.Value;
- // draw the headers again
- this.draw_headers = true;
- this.Refresh ();
- }
- }
-
- private void VerticalScroller (object sender, EventArgs e)
- {
- // Avoid unnecessary flickering, when button is
- // kept pressed at the end
- if (v_marker != v_scroll.Value) {
- v_marker = v_scroll.Value;
- this.Refresh ();
- }
- }
- #endregion // Internal Methods Properties
-
- #region Protected Methods
- protected override void CreateHandle ()
- {
- base.CreateHandle ();
- }
-
- protected override void Dispose (bool disposing)
- {
- base.Dispose (disposing);
- }
-
- protected override bool IsInputKey (Keys keyData)
- {
- 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);
- this.Controls.Add (this.v_scroll);
- this.Controls.Add (this.h_scroll);
- }
-
- 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 ();
- this.Redraw (true);
- }
-
- 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 = this.Width - (this.v_scroll.Visible ? this.v_scroll.Width : 0);
- int view_ht = this.Height - (this.h_scroll.Visible ? this.h_scroll.Height : 0);
- // 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 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 { 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 list.SyncRoot; }
- }
-
- 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 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 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 { 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 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 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 ();
-
- 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 ()
- {
- list.Clear ();
- }
-
- 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)
- {
- if (list.Contains (item)) {
- list.Remove (item);
- owner.Redraw (true);
- }
- }
-
- 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)) {
- 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.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 list.SyncRoot; }
- }
-
- 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 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 list.SyncRoot; }
- }
-
- 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 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 ();
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 Color back_color = Color.Empty;
- private Font font = null;
- private Color fore_color = Color.Empty;
- 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;
- this.fore_color = foreColor;
- this.back_color = backColor;
- this.font = font;
- }
- #endregion // Public Constructors
-
- #region Public Instance Properties
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public Color BackColor {
- get {
- if (! back_color.IsEmpty)
- return back_color;
- else if (owner != null)
- return owner.BackColor;
- else
- return ThemeEngine.Current.ColorWindow;
- }
- set { this.back_color = value; }
- }
-
- [Browsable (false)]
- public Rectangle Bounds {
- get {
- return GetBounds (ItemBoundsPortion.Entire);
- }
- }
-
- [DefaultValue (false)]
- [RefreshProperties (RefreshProperties.Repaint)]
- public bool Checked {
- get { return is_checked; }
- set { is_checked = value; }
- }
-
- [Browsable (false)]
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public bool Focused {
- get { return is_focused; }
- set { is_focused = value; }
- }
-
- [Localizable (true)]
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public Font Font {
- get {
- if (font != null)
- return font;
- else if (owner != null)
- return owner.Font;
- else
- return ThemeEngine.Current.DefaultFont;
- }
- set { font = value; }
- }
-
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public Color ForeColor {
- get {
- if (! fore_color.IsEmpty)
- return fore_color;
- else if (owner != null)
- return owner.ForeColor;
- else
- return ThemeEngine.Current.ColorWindowText;
- }
- set { fore_color = 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;
- }
- }
-
- [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) {
- //do we need !owner.SelectedItems.Contains (this))
- owner.SelectedItems.list.Add (this);
- owner.SelectedIndices.list.Add (this.Index);
- }
- else {
- owner.SelectedItems.list.Remove (this);
- owner.SelectedIndices.list.Remove (this.Index);
- }
- }
- }
- }
-
- [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.back_color = this.BackColor;
- clone.font = this.Font;
- clone.fore_color = this.ForeColor;
- 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;
-
- // should we check for dirty flag to optimize this ?
- CalcListViewItem ();
-
- switch (portion) {
-
- case ItemBoundsPortion.Icon:
- return icon_rect;
-
- case ItemBoundsPortion.Label:
- return label_rect;
-
- case ItemBoundsPortion.ItemOnly:
- return item_rect;
-
- case ItemBoundsPortion.Entire:
- return entire_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 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; }
- }
-
- [Localizable (true)]
- public Font Font {
- get {
- if (font != null)
- return font;
- else if (owner != null)
- return owner.Font;
- return font;
- }
- set { font = value; }
- }
-
- public Color ForeColor {
- get { return fore_color; }
- set { fore_color = value; }
- }
-
- [Localizable (true)]
- public string Text {
- get { return text; }
- set { text = value; }
- }
- #endregion // Public Instance Properties
-
- #region Public Methods
- public void ResetStyle ()
- {
- font = ThemeEngine.Current.DefaultFont;
- back_color = ThemeEngine.Current.DefaultControlBackColor;
- fore_color = ThemeEngine.Current.DefaultControlForeColor;
- }
-
- public override string ToString ()
- {
- return string.Format ("ListViewSubItem {{0}}", text);
- }
- #endregion // Public 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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) {\r
- return Locale.GetText(value);\r
- }\r
-
- #endregion // Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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 {\r
- get {\r
- return Locale.GetText(base.Description);\r
- }\r
- }\r
- #endregion // Properties
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
-
-namespace System.Windows.Forms
-{
- [ToolboxItemFilter("System.Windows.Forms.MainMenu", ToolboxItemFilterType.Allow)]
- public class MainMenu : Menu
- {
- private RightToLeft right_to_left;
- private Form form = null;
- private MenuAPI.TRACKER tracker = 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 IntPtr CreateMenuHandle ()
- {
- return MenuAPI.CreateMenu (this);
- }
-
- protected 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 SetForm (Form form)
- {
- this.form = form;
-
- if (tracker == null) {
- tracker = new MenuAPI.TRACKER ();
- tracker.hCurrentMenu = tracker.hTopMenu = Handle;
- }
- }
-
- internal override void MenuChanged ()
- {
- base.MenuChanged ();
- tracker = new MenuAPI.TRACKER ();
- tracker.hCurrentMenu = tracker.hTopMenu = menu_handle;
-
- MenuAPI.SetMenuBarWindow (menu_handle, form);
- // TODO: Need to invalidate & redraw topmenu
- }
-
-
- /* Mouse events from the form */
- internal void OnMouseDown (Form window, MouseEventArgs e)
- {
- MenuAPI.TrackBarMouseEvent (Handle, window, e, MenuAPI.MenuMouseEvent.Down, tracker);
- }
-
- internal void OnMouseMove (Form window, MouseEventArgs e)
- {
- MouseEventArgs ev = new MouseEventArgs (e.Button, e.Clicks, Control.MousePosition.X, Control.MousePosition.Y, e.Delta);
- MenuAPI.TrackBarMouseEvent (Handle, window, ev, MenuAPI.MenuMouseEvent.Move, tracker);
- }
-
- #endregion Private Methods
- }
-}
-
-
+++ /dev/null
-
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-
-namespace System.Windows.Forms {
-
- internal class MdiChildContext {
-
- private static Color titlebar_color;
-
- private int BorderWidth = 3;
- private int TitleBarHeight = 25;
- private Size MinTitleBarSize = new Size (115, 25);
-
- private Form form;
- private Button close_button;
- private Button maximize_button;
- private Button minimize_button;
-
- // moving windows
- private Point start;
- private State state;
- private FormPos sizing_edge;
- private Rectangle virtual_position;
- private Rectangle prev_bounds;
- private bool maximized;
-
-
- 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)
- {
- titlebar_color = Color.FromArgb (255, 0, 0, 255);
- this.form = form;
-
- form.Paint += new PaintEventHandler (PaintWindowDecorations);
-
- minimize_button = new Button ();
- minimize_button.Bounds = new Rectangle (form.Width - 62,
- BorderWidth + 2, 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.Add (close_button);
- form.Controls.Add (maximize_button);
- form.Controls.Add (minimize_button);
- }
-
- public bool HandleMessage (ref Message m)
- {
- switch ((Msg)m.Msg) {
- //case Msg.WM_PAINT:
- //DrawWindowDecorations (form.CreateGraphics ());
- //break;
-
- case Msg.WM_LBUTTONDOWN:
- return HandleLButtonDown (form, ref m);
-
- case Msg.WM_MOUSEMOVE:
- return HandleMouseMove (form, ref m);
-
- case Msg.WM_LBUTTONUP:
- HandleLButtonUp (ref m);
- break;
- }
- return false;
- }
-
-
- private bool HandleLButtonDown (Form form, ref Message m)
- {
- form.BringToFront ();
-
- int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
- int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
- FormPos pos = FormPosForCoords (x, y);
-
- start = new Point (x, y);
- virtual_position = form.Bounds;
-
- if (pos == FormPos.TitleBar) {
- HandleTitleBarDown (x, y);
- return true;
- }
-
- SetCursorForPos (pos);
-
- if ((pos & FormPos.AnyEdge) == 0)
- return false;
-
- state = State.Sizing;
- sizing_edge = pos;
- form.Capture = true;
-
- return true;
- }
-
- private void HandleTitleBarDown (int x, int y)
- {
- 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;
- }
-
- int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
- int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
- FormPos pos = FormPosForCoords (x, y);
-
- SetCursorForPos (pos);
-
- state = State.Idle;
- return false;
- }
-
- 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.Cursor = Cursors.Default;
- 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;
-
- Graphics g = form.Parent.CreateGraphics ();
- DrawVirtualPosition (g);
- }
-
- 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 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;
-
- Graphics g = form.Parent.CreateGraphics ();
- DrawVirtualPosition (g);
- }
-
- private void HandleLButtonUp (ref Message m)
- {
- if (state == State.Idle)
- return;
-
- form.Capture = false;
-
- // Clear the virtual position
- Graphics g = form.Parent.CreateGraphics ();
- g.Clear (form.Parent.BackColor);
-
- form.Bounds = virtual_position;
- state = State.Idle;
- }
-
- private void PaintWindowDecorations (object sender, PaintEventArgs pe)
- {
- Color color = titlebar_color;
- if (maximized)
- color = ThemeEngine.Current.ColorButtonFace;
- pe.Graphics.FillRectangle (new SolidBrush (color),
- BorderWidth, BorderWidth,
- form.Width - BorderWidth, TitleBarHeight);
-
- if (form.Icon != null) {
- pe.Graphics.DrawIcon (form.Icon, BorderWidth, BorderWidth);
- }
-
- Pen bp = new Pen (ThemeEngine.Current.ColorButtonFace,
- BorderWidth);
-
- // HACK: kludge the borders around
- Rectangle border = form.ClientRectangle;
- border.X++;
- border.Y++;
- border.Width -= 4;
- border.Height -= 4;
- pe.Graphics.DrawRectangle (bp, border);
-
- Border3DStyle style = Border3DStyle.Raised | Border3DStyle.Bump;
- border = form.ClientRectangle;
-
- if (maximized) {
- style = Border3DStyle.SunkenInner;
- border.Y = TitleBarHeight + BorderWidth * 2;
- border.Height -= TitleBarHeight;
- }
-
- ControlPaint.DrawBorder3D (pe.Graphics, border,
- style,
- Border3DSide.Left | Border3DSide.Right |
- Border3DSide.Top | Border3DSide.Bottom);
-
- }
-
- private void PaintButtonHandler (object sender, PaintEventArgs pe)
- {
- if (sender == close_button) {
- ControlPaint.DrawCaptionButton (pe.Graphics,
- close_button.ClientRectangle,
- CaptionButton.Close,
- close_button.ButtonState);
- } else if (sender == maximize_button) {
- ControlPaint.DrawCaptionButton (pe.Graphics,
- maximize_button.ClientRectangle,
- CaptionButton.Maximize,
- maximize_button.ButtonState);
- } else if (sender == minimize_button) {
- ControlPaint.DrawCaptionButton (pe.Graphics,
- minimize_button.ClientRectangle,
- CaptionButton.Minimize,
- minimize_button.ButtonState);
- }
- }
-
- private void CloseButtonClicked (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 OnMinimizeHandler (object sender, EventArgs e)
- {
- form.SuspendLayout ();
- form.Width = MinTitleBarSize.Width + (BorderWidth * 2);
- form.Height = MinTitleBarSize.Height + (BorderWidth * 2);
- form.ResumeLayout ();
- }
-
- private void OnMaximizeHandler (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);
- }
-
- // For now just use a solid pen as it is 10 billion times
- // faster then using the hatch, and what we really need is invert
- private void DrawVirtualPosition (Graphics graphics)
- {
- Pen pen = new Pen (Color.Black, 3);
-
- graphics.Clear (form.Parent.BackColor);
- graphics.DrawRectangle (pen, virtual_position);
- pen.Dispose ();
- }
-
- 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;
- }
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- #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);
- }
-
- public override void Remove(Control value) {
- base.Remove (value);
- }
- }
- #endregion // Public Classes
-
- #region Public Constructors
- public MdiClient() {
- BackColor = SystemColors.AppWorkspace;
- Dock = DockStyle.Fill;
- }
- #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);
- }
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 bool is_dirty = true;
- internal bool creating = false;
- internal Menu parent_menu = null;
-
- 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 {
- if (IsDirty && creating == false) {
- Dispose (true);
- }
-
- if (menu_handle == IntPtr.Zero) {
- MenuChanged ();
- }
-
- return menu_handle;
- }
- }
-
- internal virtual void MenuChanged ()
- {
- menu_handle = CreateMenuHandle ();
- CreateItems ();
- IsDirty = false;
- }
-
- [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 bool IsDirty {
- get { return is_dirty; }
- set { is_dirty = value; }
- }
-
- #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 virtual IntPtr CreateMenuHandle ()
- {
- IntPtr menu;
-
- menu = MenuAPI.CreatePopupMenu (this);
- return menu;
- }
-
- protected override void Dispose (bool disposing)
- {
- if (disposing) {
- if (menu_handle != IntPtr.Zero) {
- MenuAPI.DestroyMenu (menu_handle);
- 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.Add (pos, menuSrc.MenuItems[i].CloneMenu ());
-
- break;
- }
-
- default:
- break;
- }
- }
- }
-
- protected internal virtual bool ProcessCmdKey (ref Message msg, Keys keyData)
- {
- return false;
- }
-
- public override string ToString ()
- {
- return base.ToString () + ", Items.Count: " + MenuItems.Count;
- }
-
- #endregion Public Methods
-
- #region Private Methods
-
- internal void CreateItems ()
- {
- creating = true;
-
- for (int i = 0; i < menu_items.Count; i++)
- menu_items[i].Create ();
-
- creating = false;
- }
-
- #endregion Private Methods
-
- [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 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)
- {
- mi.parent_menu = owner;
- mi.Index = items.Count;
- items.Add (mi);
-
- owner.IsDirty = true;
- 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 ();
- owner.IsDirty = true;
-
- return index;
- }
-
- 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 ()
- {
- items.Clear ();
- owner.IsDirty = true;
- }
-
- 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)
- {
- Add (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");
-
- items.RemoveAt (index);
-
- UpdateItemsIndices ();
- owner.IsDirty = true;
- }
-
- #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
- }
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.Drawing;
-using System.Collections;
-
-namespace System.Windows.Forms
-{
-
- /*
- This class mimics the Win32 API Menu functionality
-
- 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 MenuAPI
- {
- static ArrayList menu_list = new ArrayList ();
-
- public class MENU
- {
- public MF Flags; // Menu flags (MF_POPUP, MF_SYSMENU)
- public int X; // Used in MenuBar only
- public int Y; // Used in MenuBar only
- public int Width; // Width of the whole menu
- public int Height; // Height of the whole menu
- public Control Wnd; // In a Popup menu is the PopupWindow and in a MenuBar the Form
- public ArrayList items; // Array of menu items
- public int FocusedItem; // Currently focused item
- public IntPtr hParent;
- public MENUITEM SelectedItem; // Currently selected item
- public bool bMenubar;
- public bool bTracking;
- public Menu menu; // SWF.Menu
-
- public MENU (Menu menu_obj)
- {
- Wnd = null;
- hParent = IntPtr.Zero;
- items = new ArrayList ();
- Flags = MF.MF_INSERT;
- Width = Height = FocusedItem = X = Y = 0;
- bMenubar = false;
- bTracking = false;
- menu = menu_obj;
- }
- }
-
- public class MENUITEM
- {
- public MenuItem item;
- public Rectangle rect;
- public int wID;
- public IntPtr hSubMenu;
- public int pos; /* Position in the menuitems array*/
-
- public MENUITEM ()
- {
- wID = 0;
- pos = 0;
- rect = new Rectangle ();
- }
-
- };
-
- public class TRACKER
- {
- public IntPtr hCurrentMenu;
- public IntPtr hTopMenu;
-
- public TRACKER ()
- {
- hCurrentMenu = hTopMenu = IntPtr.Zero;
- }
- };
-
- public enum MenuMouseEvent
- {
- Down,
- Move,
- }
-
- internal enum ItemNavigation
- {
- First,
- Last,
- Next,
- Previous,
- }
-
- internal enum MF
- {
- MF_INSERT = 0x0,
- MF_APPEND = 0x100,
- MF_DELETE = 0x200,
- MF_REMOVE = 0x1000,
- MF_BYCOMMAND = 0,
- MF_BYPOSITION = 0x400,
- MF_SEPARATOR = 0x800,
- MF_ENABLED = 0,
- MF_GRAYED = 1,
- MF_DISABLED = 2,
- MF_UNCHECKED = 0,
- MF_CHECKED = 8,
- MF_USECHECKBITMAPS = 0x200,
- MF_STRING = 0,
- MF_BITMAP = 4,
- MF_OWNERDRAW = 0x100,
- MF_POPUP = 0x10,
- MF_MENUBARBREAK = 0x20,
- MF_MENUBREAK = 0x40,
- MF_UNHILITE = 0,
- MF_HILITE = 0x80,
- MF_DEFAULT = 0x1000,
- MF_SYSMENU = 0x2000,
- MF_HELP = 0x4000,
- MF_RIGHTJUSTIFY = 0x4000,
- MF_MENUBAR = 0x8000 // Internal
- }
-
- static MenuAPI ()
- {
-
- }
-
- static public IntPtr StoreMenuID (MENU menu)
- {
- int id = menu_list.Add (menu);
- return (IntPtr)(id + 1);
- }
-
- static public MENU GetMenuFromID (IntPtr ptr)
- {
- int id = (int)ptr;
- id = id - 1;
-
- if (menu_list[id] == null) // It has been delete it
- return null;
-
- return (MENU) menu_list[id];
- }
-
- static public IntPtr CreateMenu (Menu menu_obj)
- {
- MENU menu = new MENU (menu_obj);
- return StoreMenuID (menu);
- }
-
- static public IntPtr CreatePopupMenu (Menu menu_obj)
- {
- MENU popMenu = new MENU (menu_obj);
- popMenu.Flags |= MF.MF_POPUP;
- return StoreMenuID (popMenu);
- }
-
- static public int InsertMenuItem (IntPtr hMenu, int uItem, bool fByPosition, MenuItem item, ref IntPtr hSubMenu)
- {
- int id;
-
- if (fByPosition == false)
- throw new NotImplementedException ();
-
- MENU menu = GetMenuFromID (hMenu);
- if ((uint)uItem > menu.items.Count)
- uItem = menu.items.Count;
-
- MENUITEM menu_item = new MENUITEM ();
- menu_item.item = item;
-
- if (item.IsPopup) {
- menu_item.hSubMenu = CreatePopupMenu (menu_item.item);
- MENU submenu = GetMenuFromID (menu_item.hSubMenu);
- submenu.hParent = hMenu;
- }
- else
- menu_item.hSubMenu = IntPtr.Zero;
-
- hSubMenu = menu_item.hSubMenu;
- id = menu.items.Count;
- menu_item.pos = menu.items.Count;
- menu.items.Insert (uItem, menu_item);
-
- return id;
- }
-
- // The Point object contains screen coordinates
- static public bool TrackPopupMenu (IntPtr hTopMenu, IntPtr hMenu, Point pnt, bool bMenubar, Control Wnd)
- {
- TRACKER tracker = new TRACKER ();
- MENU menu = null;
-
- if (hMenu == IntPtr.Zero) // No submenus to track
- return true;
-
- menu = GetMenuFromID (hMenu);
-
- menu.Wnd = new PopUpWindow (hMenu, tracker);
- tracker.hCurrentMenu = hMenu;
- tracker.hTopMenu = hTopMenu;
-
- MENUITEM select_item = GetNextItem (hMenu, ItemNavigation.First);
-
- if (select_item != null) {
- MenuAPI.SelectItem (hMenu, select_item, false, tracker);
- }
-
- menu.Wnd.Location = menu.Wnd.PointToClient (pnt);
-
- if (menu.menu.IsDirty) {
- menu.items.Clear ();
- menu.menu.CreateItems ();
- ((PopUpWindow)menu.Wnd).RefreshItems ();
- menu.menu.IsDirty = false;
- }
-
- ((PopUpWindow)menu.Wnd).ShowWindow ();
-
- Application.Run ();
-
- if (menu.Wnd == null) {
- menu.Wnd.Dispose ();
- menu.Wnd = null;
- }
-
- return true;
- }
-
- /*
- Menu handeling API
- */
-
- static public Point ClientAreaPointToScreen (MENU menu, Point pnt)
- {
- Point rslt;
- int x;
- int y;
-
- pnt.Y -= menu.Y;
-
- x = pnt.X;
- y = pnt.Y;
-
- XplatUI.MenuToScreen(menu.Wnd.window.Handle, ref x, ref y);
-
- rslt = new Point(x, y);
-
- return rslt;
- }
-
- static public Point ClientAreaPointToClient (MENU menu, Point pnt)
- {
- Point rslt;
- int x;
- int y;
-
- x = pnt.X;
- y = pnt.Y;
-
- XplatUI.ScreenToMenu(menu.Wnd.window.Handle, ref x, ref y);
-
- rslt = new Point(x, y);
-
- rslt.Y += menu.Y;
-
- return rslt;
- }
-
- static public MENUITEM FindItemByCoords (IntPtr hMenu, Point pt)
- {
- MENU menu = GetMenuFromID (hMenu);
-
- for (int i = 0; i < menu.items.Count; i++) {
- MENUITEM item = (MENUITEM) menu.items[i];
- if (item.rect.Contains (pt)) {
- return item;
- }
- }
-
- return null;
- }
-
- // Get the current selected item
- static public MENUITEM GetSelected (IntPtr hMenu)
- {
- MENU menu = GetMenuFromID (hMenu);
- MENUITEM it;
-
- /* Loop all items */
- for (int i = 0; i < menu.items.Count; i++) {
- it = (MENUITEM) menu.items[i];
- if ((it.item.Status & DrawItemState.Selected) == DrawItemState.Selected) {
- return it;
- }
- }
-
- return null;
- }
-
- static internal void DrawMenuBar (IntPtr hMenu)
- {
- MENU menu = GetMenuFromID (hMenu);
- DrawMenuBar (hMenu, new Rectangle (menu.X, menu.Y, menu.Width, menu.Height));
- }
-
- // Little helper
- static internal void DrawMenuBar (IntPtr hMenu, Rectangle rect)
- {
- Graphics g;
- MENU menu = GetMenuFromID (hMenu);
-
- menu.X = rect.X;
- menu.Y = rect.Y;
- rect.Height = menu.Height;
-
- g = XplatUI.GetMenuDC(menu.Wnd.window.Handle, IntPtr.Zero);
- ThemeEngine.Current.DrawMenuBar (g, hMenu, rect);
- XplatUI.ReleaseMenuDC(menu.Wnd.window.Handle, g);
- }
-
- static public void UnSelectItem (IntPtr hMenu, MENUITEM item)
- {
- MENU menu = GetMenuFromID (hMenu);
-
- if (item == null)
- return;
-
- item.item.Status = item.item.Status &~ DrawItemState.Selected;
-
- if (menu.bMenubar) {
- DrawMenuBar (hMenu);
- } else {
- menu.Wnd.Invalidate (item.rect);
- }
- }
-
- // Select the item and unselect the previous selecte item
- static public void SelectItem (IntPtr hMenu, MENUITEM item, bool execute, TRACKER tracker)
- {
- MENU menu = GetMenuFromID (hMenu);
- MENUITEM previous_selitem = GetSelected (hMenu);
-
- /* Already selected */
- if (previous_selitem != null && item.rect == previous_selitem.rect) {
- return;
- }
-
- UnSelectItem (hMenu, previous_selitem);
-
- // If the previous item had subitems, hide them
- if (previous_selitem != null && previous_selitem.item.IsPopup)
- HideSubPopups (hMenu);
-
- if (tracker.hCurrentMenu != hMenu) {
- menu.Wnd.Capture = true;
- tracker.hCurrentMenu = hMenu;
- }
-
- menu.SelectedItem = item;
- item.item.Status |= DrawItemState.Selected;
-
- if (menu.bMenubar) {
- DrawMenuBar (hMenu);
- } else {
- menu.Wnd.Invalidate (item.rect);
- }
-
- item.item.PerformSelect ();
-
- if (execute)
- ExecFocusedItem (hMenu, item, tracker);
- }
-
-
- // Used when the user executes the action of an item (press enter, shortcut)
- // or a sub-popup menu has to be shown
- static public void ExecFocusedItem (IntPtr hMenu, MENUITEM item, TRACKER tracker)
- {
- if (item.item.Enabled == false)
- return;
-
-
- if (item.item.IsPopup) {
- ShowSubPopup (hMenu, item.hSubMenu, item, tracker);
- }
- else {
- // Execute function
- }
- }
-
- // Create a popup window and show it or only show it if it is already created
- static public void ShowSubPopup (IntPtr hParent, IntPtr hMenu, MENUITEM item, TRACKER tracker)
- {
- MENU menu = GetMenuFromID (hMenu);
- Point pnt = new Point ();
-
- if (item.item.Enabled == false)
- return;
-
- MENU menu_parent = GetMenuFromID (hParent);
- ((PopUpWindow)menu_parent.Wnd).LostFocus ();
- tracker.hCurrentMenu = hMenu;
-
- if (menu.Wnd != null)
- menu.Wnd.Dispose ();
-
- menu.Wnd = new PopUpWindow (hMenu, tracker);
-
- pnt.X = item.rect.X + item.rect.Width;
- pnt.Y = item.rect.Y + 1;
- pnt = menu_parent.Wnd.PointToScreen (pnt);
- menu.Wnd.Location = pnt;
-
- MENUITEM select_item = GetNextItem (hMenu, ItemNavigation.First);
-
- if (select_item != null)
- MenuAPI.SelectItem (hMenu, select_item, false, tracker);
-
- ((PopUpWindow)menu.Wnd).ShowWindow ();
- }
-
- /* Hides all the submenus open in a menu */
- static public void HideSubPopups (IntPtr hMenu)
- {
- MENU menu = GetMenuFromID (hMenu);
- MENUITEM item;
-
- for (int i = 0; i < menu.items.Count; i++) {
- item = (MENUITEM) menu.items[i];
- if (!item.item.IsPopup)
- continue;
-
- MENU sub_menu = GetMenuFromID (item.hSubMenu);
-
- if (sub_menu.Wnd != null) {
- HideSubPopups (item.hSubMenu);
- ((PopUpWindow)sub_menu.Wnd).Hide ();
- }
- }
- }
-
- static public void DestroyMenu (IntPtr hMenu)
- {
- if (hMenu == IntPtr.Zero)
- return;
-
- MENU menu = GetMenuFromID (hMenu);
- MENUITEM item;
-
- for (int i = 0; i < menu.items.Count; i++) {
- item = (MENUITEM) menu.items[i];
- if (item.item.IsPopup) {
- MENU sub_menu = GetMenuFromID (item.hSubMenu);
- if (sub_menu != null && sub_menu.Wnd != null)
- HideSubPopups (item.hSubMenu);
-
- DestroyMenu (item.hSubMenu);
- }
- }
-
- // Do not destroy the window of a Menubar
- if (menu.Wnd != null && menu.bMenubar == false) {
- ((PopUpWindow)menu.Wnd).Dispose ();
- menu.Wnd = null;
- }
-
- /* Unreference from the array list */
- menu_list[((int)hMenu)-1] = null;
- }
-
- // Find item by screen coordinates
- static public bool FindSubItemByCoord (IntPtr hMenu, Point pnt, ref IntPtr hMenuItem, ref MENUITEM itemfound)
- {
- Point pnt_client;
- Rectangle rect;
- MENU menu = GetMenuFromID (hMenu);
- MENUITEM item;
-
- for (int i = 0; i < menu.items.Count; i++) {
- item = (MENUITEM) menu.items[i];
-
- if (item.item.IsPopup)
- if (FindSubItemByCoord (item.hSubMenu, pnt, ref hMenuItem, ref itemfound) == true)
- return true;
-
- if (menu.Wnd == null) // Menu has not been created yet
- continue;
-
- rect = item.rect;
- pnt_client = menu.Wnd.PointToScreen (new Point (item.rect.X, item.rect.Y));
- rect.X = pnt_client.X;
- rect.Y = pnt_client.Y;
-
- if (rect.Contains (pnt) == true) {
- itemfound = item;
- hMenuItem = hMenu;
- return true;
- }
- }
-
- return false;
- }
-
- static public void SetMenuBarWindow (IntPtr hMenu, Control wnd)
- {
- MENU menu = GetMenuFromID (hMenu);
- menu.Wnd = wnd;
- menu.bMenubar = true;
- }
-
- static private void MenuBarMove (IntPtr hMenu, MENUITEM item, TRACKER tracker)
- {
- MENU menu = GetMenuFromID (hMenu);
- Point pnt = new Point (item.rect.X, item.rect.Y + item.rect.Height + 1);
- pnt = ClientAreaPointToScreen (menu, pnt);
- MenuAPI.SelectItem (hMenu, item, false, tracker);
- HideSubPopups (tracker.hCurrentMenu);
- tracker.hCurrentMenu = hMenu;
- MenuAPI.TrackPopupMenu (hMenu, item.hSubMenu, pnt, false, null);
- }
-
- // Function that process all menubar mouse events. Coordinates in screen position
- static public void TrackBarMouseEvent (IntPtr hMenu, Control wnd, MouseEventArgs e, MenuMouseEvent eventype, TRACKER tracker)
- {
- MENU menu = GetMenuFromID (hMenu);
-
- switch (eventype) {
- case MenuMouseEvent.Down: {
- Point pnt = new Point (e.X, e.Y);
- pnt = ClientAreaPointToClient (menu, pnt);
-
- MenuAPI.MENUITEM item = MenuAPI.FindItemByCoords (hMenu, pnt);
-
- if (item != null) {
- MENU top_menu = GetMenuFromID (tracker.hTopMenu);
-
- top_menu.bTracking = true;
- MenuBarMove (hMenu, item, tracker);
-
- if (item != null) {
- item.item.PerformClick ();
- }
- }
-
- break;
- }
-
- case MenuMouseEvent.Move: {
-
- if (tracker.hTopMenu != IntPtr.Zero && tracker.hCurrentMenu != IntPtr.Zero) {
-
- MENU top_menu = GetMenuFromID (tracker.hTopMenu);
-
- if (top_menu.bTracking == false)
- break;
-
- Point pnt = new Point (e.X, e.Y);
- //pnt = menu.Wnd.PointToClient (pnt);
- pnt = ClientAreaPointToClient (menu, pnt);
-
- MenuAPI.MENUITEM item = MenuAPI.FindItemByCoords (hMenu, pnt);
-
- if (item != null && menu.SelectedItem != item)
- MenuBarMove (hMenu, item, tracker);
- }
- break;
- }
-
- default:
- break;
- }
- }
-
- static public MENUITEM FindItemByKey (IntPtr hMenu, IntPtr key)
- {
- MENU menu = GetMenuFromID (hMenu);
- MENUITEM item;
-
- char key_char = (char ) (key.ToInt32() & 0xff);
- key_char = Char.ToUpper (key_char);
-
- for (int i = 0; i < menu.items.Count; i++) {
- item = (MENUITEM) menu.items[i];
-
- if (item.item.Mnemonic == '\0')
- continue;
-
- if (item.item.Mnemonic == key_char)
- return item;
- }
-
- return null;
- }
-
- // Get the next or previous selectable item on a menu
- static public MENUITEM GetNextItem (IntPtr hMenu, ItemNavigation navigation)
- {
- MENU menu = GetMenuFromID (hMenu);
- int pos = 0;
- bool selectable_items = false;
- MENUITEM item;
-
- // Check if there is at least a selectable item
- for (int i = 0; i < menu.items.Count; i++) {
- item = (MENUITEM)menu.items[i];
- if (item.item.Separator == false && item.item.Visible == true) {
- selectable_items = true;
- break;
- }
- }
-
- if (selectable_items == false)
- return null;
-
- switch (navigation) {
- case ItemNavigation.First: {
- pos = 0;
-
- /* Next item that is not separator and it is visible*/
- for (; pos < menu.items.Count; pos++) {
- item = (MENUITEM)menu.items[pos];
- if (item.item.Separator == false && item.item.Visible == true)
- break;
- }
-
- if (pos >= menu.items.Count) { /* Jump at the start of the menu */
- pos = 0;
- /* Next item that is not separator and it is visible*/
- for (; pos < menu.items.Count; pos++) {
- item = (MENUITEM)menu.items[pos];
- if (item.item.Separator == false && item.item.Visible == true)
- break;
- }
- }
-
- break;
- }
-
- case ItemNavigation.Last: { // Not used
- break;
- }
-
- case ItemNavigation.Next: {
-
- if (menu.SelectedItem != null)
- pos = menu.SelectedItem.pos;
-
- /* Next item that is not separator and it is visible*/
- for (pos++; pos < menu.items.Count; pos++) {
- item = (MENUITEM)menu.items[pos];
- if (item.item.Separator == false && item.item.Visible == true)
- break;
- }
-
- if (pos >= menu.items.Count) { /* Jump at the start of the menu */
- pos = 0;
- /* Next item that is not separator and it is visible*/
- for (; pos < menu.items.Count; pos++) {
- item = (MENUITEM)menu.items[pos];
- if (item.item.Separator == false && item.item.Visible == true)
- break;
- }
- }
- break;
- }
-
- case ItemNavigation.Previous: {
-
- if (menu.SelectedItem != null)
- pos = menu.SelectedItem.pos;
-
- /* Previous item that is not separator and it is visible*/
- for (pos--; pos >= 0; pos--) {
- item = (MENUITEM)menu.items[pos];
- if (item.item.Separator == false && item.item.Visible == true)
- break;
- }
-
- if (pos < 0 ) { /* Jump at the end of the menu*/
- pos = menu.items.Count - 1;
- /* Previous item that is not separator and it is visible*/
- for (; pos >= 0; pos--) {
- item = (MENUITEM)menu.items[pos];
- if (item.item.Separator == false && item.item.Visible == true)
- break;
- }
- }
-
- break;
- }
-
- default:
- break;
- }
-
- return (MENUITEM)menu.items[pos];
- }
-
- static public bool ProcessKeys (IntPtr hMenu, ref Message msg, Keys keyData, TRACKER tracker)
- {
- MENU menu = GetMenuFromID (hMenu);
- MENUITEM item;
-
- switch (keyData) {
- case Keys.Up: {
- item = GetNextItem (hMenu, ItemNavigation.Previous);
- if (item != null)
- MenuAPI.SelectItem (hMenu, item, false, tracker);
-
- break;
- }
-
- case Keys.Down: {
- item = GetNextItem (hMenu, ItemNavigation.Next);
-
- if (item != null)
- MenuAPI.SelectItem (hMenu, item, false, tracker);
- break;
- }
-
- /* Menubar selects and opens next. Popups next or open*/
- case Keys.Right: {
-
- // Try to Expand popup first
- if (menu.SelectedItem.item.IsPopup) {
- ShowSubPopup (hMenu, menu.SelectedItem.hSubMenu, menu.SelectedItem, tracker);
- } else {
-
- MENU parent = null;
- if (menu.hParent != IntPtr.Zero)
- parent = GetMenuFromID (menu.hParent);
-
- if (parent != null && parent.bMenubar == true) {
- MENUITEM select_item = GetNextItem (menu.hParent, ItemNavigation.Next);
- MenuBarMove (menu.hParent, select_item, tracker);
- }
- }
-
- break;
- }
-
- case Keys.Left: {
-
- // Try to Collapse popup first
- if (menu.SelectedItem.item.IsPopup) {
-
- } else {
-
- MENU parent = null;
- if (menu.hParent != IntPtr.Zero)
- parent = GetMenuFromID (menu.hParent);
-
- if (parent != null && parent.bMenubar == true) {
- MENUITEM select_item = GetNextItem (menu.hParent, ItemNavigation.Previous);
- MenuBarMove (menu.hParent, select_item, tracker);
- }
- }
-
- break;
- }
-
- case Keys.Return: {
- MenuAPI.ExecFocusedItem (hMenu, menu.SelectedItem, tracker);
- break;
- }
-
- default:
- break;
- }
-
- /* Try if it is a menu hot key */
- item = MenuAPI.FindItemByKey (hMenu, msg.WParam);
-
- if (item != null) {
- MenuAPI.SelectItem (hMenu, item, false, tracker);
- return true;
- }
-
- return false;
- }
- }
-
- /*
-
- class PopUpWindow
-
- */
- internal class PopUpWindow : Control
- {
- private IntPtr hMenu;
- private MenuAPI.TRACKER tracker;
-
- public PopUpWindow (IntPtr hMenu, MenuAPI.TRACKER tracker): base ()
- {
- this.hMenu = hMenu;
- this.tracker = tracker;
- MouseDown += new MouseEventHandler (OnMouseDownPUW);
- MouseMove += new MouseEventHandler (OnMouseMovePUW);
- MouseUp += new MouseEventHandler (OnMouseUpPUW);
- 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 ();
- Capture = true;
- RefreshItems ();
- Refresh ();
- }
-
- public new void LostFocus ()
- {
- Capture = false;
- }
-
- protected override void OnResize (EventArgs e)
- {
- base.OnResize (e);
- }
-
- private void OnPaintPUW (Object o, PaintEventArgs pevent)
- {
- ThemeEngine.Current.DrawPopupMenu (pevent.Graphics, hMenu, pevent.ClipRectangle, ClientRectangle);
- }
-
- public void HideWindow ()
- {
- Capture = false;
- Hide ();
- MenuAPI.MENU top_menu = MenuAPI.GetMenuFromID (tracker.hTopMenu);
- top_menu.bTracking = false;
-
- MenuAPI.HideSubPopups (tracker.hTopMenu);
-
- if (top_menu.bMenubar) {
- MenuAPI.MENUITEM item = MenuAPI.GetSelected (tracker.hTopMenu);
-
- if (item != null) {
- MenuAPI.UnSelectItem (tracker.hTopMenu, item);
- }
- } else { // Context Menu
- ((PopUpWindow)top_menu.Wnd).Hide ();
- }
- }
-
- private void OnMouseDownPUW (object sender, MouseEventArgs e)
- {
- /* Click outside the client area*/
- if (ClientRectangle.Contains (e.X, e.Y) == false) {
- HideWindow ();
- }
-
- MenuAPI.MENUITEM item = MenuAPI.FindItemByCoords (hMenu, new Point (e.X, e.Y));
-
- if (item != null) {
- MenuAPI.ExecFocusedItem (hMenu, item, tracker);
- }
- }
-
- private void OnMouseUpPUW (object sender, MouseEventArgs e)
- {
- /* Click in an item area*/
- MenuAPI.MENUITEM item = MenuAPI.FindItemByCoords (hMenu, new Point (e.X, e.Y));
-
- if (item != null) {
- if (item.item.Enabled) {
- HideWindow ();
- }
- item.item.PerformClick ();
- }
- }
-
- private void OnMouseMovePUW (object sender, MouseEventArgs e)
- {
- MenuAPI.MENUITEM item = MenuAPI.FindItemByCoords (hMenu, new Point (e.X, e.Y));
-
- if (item != null) {
- MenuAPI.SelectItem (hMenu, item, false, tracker);
- } else {
-
- MenuAPI.MENU menu_parent = null;
-
- if (tracker.hTopMenu != IntPtr.Zero)
- menu_parent = MenuAPI.GetMenuFromID (tracker.hTopMenu);
-
- if (menu_parent == null)
- return;
-
- if (menu_parent.bMenubar) {
- MenuAPI.TrackBarMouseEvent (tracker.hTopMenu,
- this, new MouseEventArgs(e.Button, e.Clicks, MousePosition.X, MousePosition.Y, e.Delta),
- MenuAPI.MenuMouseEvent.Move, tracker);
- }
-
- IntPtr hMenuItem = IntPtr.Zero;
- MenuAPI.MENUITEM item_found = null;
-
- if (MenuAPI.FindSubItemByCoord (tracker.hTopMenu, MousePosition, ref hMenuItem, ref item_found) == false)
- return;
-
- MenuAPI.SelectItem (hMenuItem, item_found, false, tracker);
- }
- }
-
- protected override bool ProcessCmdKey (ref Message msg, Keys keyData)
- {
- return MenuAPI.ProcessKeys (hMenu, ref msg, keyData, tracker);
- }
-
- protected override void CreateHandle ()
- {
- base.CreateHandle ();
- RefreshItems ();
- }
-
- // Called when the number of items has changed
- internal void RefreshItems ()
- {
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
- ThemeEngine.Current.CalcPopupMenuSize (DeviceContext, hMenu);
-
- if ((Location.X + menu.Width) > SystemInformation.WorkingArea.Width) {
- Location = new Point (Location.X - menu.Width, Location.Y);
- }
- if ((Location.Y + menu.Height) > SystemInformation.WorkingArea.Height) {
- Location = new Point (Location.X, Location.Y - menu.Height);
- }
-
- Width = menu.Width;
- Height = menu.Height;
- }
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 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;
-
- 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)
- {
- 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 { index = value; }
- }
-
- [Browsable(false)]
- public override bool IsParent {
- get { return IsPopup; }
- }
-
- [DefaultValue(false)]
- public bool MdiList {
- get { return mdilist; }
- set { mdilist = value; }
- }
-
- 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.IsDirty = true;
- parent_menu.creating = false;
- }
- }
- }
-
- #endregion Public Properties
-
- #region Private Properties
-
- 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 int XTab {
- get { return xtab; }
- set { xtab = 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 Create ()
- {
- IntPtr hSubMenu = IntPtr.Zero;
-
- menuid = index = MenuAPI.InsertMenuItem (Parent.Handle, -1, true, this, ref hSubMenu);
- IsDirty = false;
-
- if (IsPopup) {
- menu_handle = hSubMenu;
- CreateItems ();
- }
- }
-
- internal void PerformDrawItem (DrawItemEventArgs e)
- {
- 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 "";
- }
-
- #endregion Private Methods
-
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)
-// 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 Image error_icon = (Image)Locale.GetResource("mbox_error.png");
- internal static Image question_icon = (Image)Locale.GetResource("mbox_question.png");
- internal static Image warning_icon = (Image)Locale.GetResource("mbox_warn.png");
- internal static Image info_icon = (Image)Locale.GetResource("mbox_info.png");
- 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 = error_icon;
- break;
- }
-
- case MessageBoxIcon.Question: {
- icon_image = question_icon;
- break;
- }
-
- case MessageBoxIcon.Asterisk: { // Same as MessageBoxIcon.Information
- icon_image = info_icon;
- break;
- }
-
- case MessageBoxIcon.Warning: { // Same as MessageBoxIcon.Exclamation:
- icon_image = warning_icon;
- 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);
-
- 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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();
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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__
- // *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;
- }
-#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;
- }
- }
- }
-}
-
+++ /dev/null
-#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
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
-
-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 PlatformMimeIconHandler platformMimeHandler = null;
-
- 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( );
- }
- else
- session = "";
-
- Console.WriteLine( "Desktop session is: " + session );
-
- 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 );
- }
-
- 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 )
- break;
- }
- }
-
- // if oindex is still null check if mime_type is a sub class of an other mime type
- if ( oindex == null )
- {
- string sub_class = MimeGenerated.SubClasses[ mime_type ];
-
- if ( sub_class != null )
- oindex = MimeTypeIconIndexHash[ sub_class ];
- }
- }
- }
-
- 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.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" ) );
-
- 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
- // MWF has no svg support yet (cairo's libsvg!?!)
- if ( SVGOnly( ) )
- 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;
- }
-
- 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" );
-
- 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 )
- {
- ReadDotDesktop( f );
- }
- }
- }
- }
-
- 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;
- }
- }
-
- // GnomeHandler uses the default gnome icon theme (many others are svg only)
- internal class GnomeHandler : PlatformMimeIconHandler
- {
- public override MimeExtensionHandlerStatus Start( )
- {
- if ( !CheckPlatformDirectories( ) )
- return mimeExtensionHandlerStatus;
-
- CreateMimeTypeFromIconName( );
-
- ReadIcons( );
-
- return MimeExtensionHandlerStatus.OK;
- }
-
- protected override bool CheckPlatformDirectories( )
- {
- // add more directories ???
- if ( Directory.Exists( "/opt/gnome/share/icons/gnome/48x48" ) )
- {
- icon_paths.Add( "/opt/gnome/share/icons/gnome/48x48/" );
- }
- else
- if ( Directory.Exists( "/usr/share/icons/gnome/48x48" ) )
- {
- icon_paths.Add( "/usr/share/icons/gnome/48x48/" );
- }
- else
- if ( Directory.Exists( "/usr/local/share/icons/gnome/48x48" ) )
- {
- icon_paths.Add( "/usr/local/share/icons/gnome/48x48/" );
- }
- else
- {
- mimeExtensionHandlerStatus = MimeExtensionHandlerStatus.NO_ICONS;
- return false;
- }
-
- return true;
- }
-
- private void CreateMimeTypeFromIconName( )
- {
- MimeIconEngine.AddMimeTypeAndIconName( "inode/directory", "gnome-fs-directory" );
- MimeIconEngine.AddMimeTypeAndIconName( "unknown/unknown", "gnome-fs-regular" );
- MimeIconEngine.AddMimeTypeAndIconName( "desktop/desktop", "gnome-fs-desktop" );
- MimeIconEngine.AddMimeTypeAndIconName( "directory/home", "gnome-fs-home" );
- MimeIconEngine.AddMimeTypeAndIconName( "network/network", "gnome-fs-network" );
-
- foreach ( string ip in icon_paths )
- {
- string[] files = Directory.GetFiles( ip + "mimetypes" );
-
- foreach ( string file in files )
- {
- string extension = Path.GetExtension( file );
-
- if ( extension != ".png" )
- 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 );
- }
- }
- }
-
- private void ReadIcons( )
- {
- foreach ( string icon_path in icon_paths )
- {
- string[] directories = Directory.GetDirectories( icon_path );
-
- foreach ( string directory in directories )
- {
- DirectoryInfo di = new DirectoryInfo( directory );
-
- FileInfo[] fileinfo = di.GetFiles( );
-
- foreach ( FileInfo fi in fileinfo )
- {
- if ( fi.Extension != ".png" )
- continue;
-
- string name = Path.GetFileNameWithoutExtension( fi.Name );
-
- MimeIconEngine.AddIcon( name, fi.FullName );
- }
- }
- }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-//
-// 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, true);
- SetStyle (ControlStyles.AllPaintingInWmPaint, true);
-
- // 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.ColorActiveTitle;
- title_fore_color = ThemeEngine.Current.ColorTitleText;
- 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 ();
-
- // set up the year up down control
- 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.Add(year_updown);
-
- // 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);
- year_updown.ValueChanged += new EventHandler(UpDownYearChangedHandler);
-
- // this replaces paint so call the control version
- ((Control)this).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 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 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);
- 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 ();
- }
-
- // 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);
- }
-
- // 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 ();
- Application.DoEvents ();
- // 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 != 100) {
- timer.Interval = 100;
- }
- }
- } 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 = 500;
- 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 (last_month, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-
-#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 Static Methods
- internal static NativeWindow FindWindow(IntPtr handle) {
- return (NativeWindow)window_collection[handle];
-
- }
- #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() {
- window_collection.Remove(window_handle);
- XplatUI.DestroyWindow(window_handle);
- window_handle=IntPtr.Zero;
- }
-
- public virtual void ReleaseHandle() {
- window_handle=IntPtr.Zero;
- OnHandleChange();
- }
-
- #endregion // Public Instance Methods
-
- #region Protected Instance Methods
- ~NativeWindow() {
- if (window_handle!=IntPtr.Zero) {
- DestroyHandle();
- }
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }\r
-\r
- protected override CreateParams CreateParams {\r
- get {\r
- CreateParams cp;\r
-\r
- cp = base.CreateParams;\r
-\r
- cp.Parent = IntPtr.Zero;\r
- cp.Style = (int)WindowStyles.WS_POPUP;\r
- cp.Style |= (int)WindowStyles.WS_CLIPSIBLINGS;\r
-\r
- cp.ExStyle = (int)(WindowStyles.WS_EX_TOOLWINDOW);
-\r
- return cp;\r
- }\r
- }\r
-\r
- protected override void WndProc(ref Message m) {\r
- switch((Msg)m.Msg) {\r
- case Msg.WM_NCPAINT: {\r
- PaintEventArgs paint_event;
-
- paint_event = XplatUI.PaintEventStart(Handle, false);
- OnPaint(paint_event);
- XplatUI.PaintEventEnd(Handle, false);\r
- break;\r
- }\r
-\r
- case Msg.WM_USER: {\r
- switch ((Msg)m.LParam.ToInt32()) {\r
- case Msg.WM_LBUTTONDOWN: {\r
- HandleMouseDown(this, new MouseEventArgs(MouseButtons.Left, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));\r
- return;\r
- }\r
-\r
- case Msg.WM_LBUTTONUP: {\r
- HandleMouseUp(this, new MouseEventArgs(MouseButtons.Left, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));\r
- HandleClick(this, EventArgs.Empty);\r
- return;\r
- }\r
-\r
- case Msg.WM_LBUTTONDBLCLK: {\r
- HandleDoubleClick(this, EventArgs.Empty);\r
- return;\r
- }\r
-\r
- case Msg.WM_MOUSEMOVE: {\r
- HandleMouseMove(this, new MouseEventArgs(MouseButtons.None, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));\r
- return;\r
- }\r
-\r
- case Msg.WM_RBUTTONDOWN: {\r
- HandleMouseDown(this, new MouseEventArgs(MouseButtons.Right, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));\r
- return;\r
- }\r
-\r
- case Msg.WM_RBUTTONUP: {\r
- HandleMouseUp(this, new MouseEventArgs(MouseButtons.Right, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));\r
- HandleClick(this, EventArgs.Empty);\r
- return;\r
- }\r
-\r
- case Msg.WM_RBUTTONDBLCLK: {\r
- HandleDoubleClick(this, EventArgs.Empty);\r
- return;\r
- }\r
- }\r
- return;\r
- }\r
- }\r
- base.WndProc (ref m);\r
- }\r
-\r
- internal void CalculateIconRect() {\r
- if (owner != null && owner.icon != null) {\r
- int x;
- int y;
- int size;\r
-\r
- // Icons are always square. Try to center them in the window\r
- if (ClientRectangle.Width < ClientRectangle.Height) {\r
- size = ClientRectangle.Width;\r
- } else {\r
- size = ClientRectangle.Height;\r
- }\r
- x = this.ClientRectangle.Width / 2 - size / 2;\r
- y = this.ClientRectangle.Height / 2 - size / 2;\r
- rect = new Rectangle(x, y, size, size);\r
-\r
- // Force our window to be square\r
- if (Width != size) {\r
- this.Width = size;\r
- }\r
-\r
- if (Height != size) {\r
- this.Height = size;\r
- }\r
- }\r
- }\r
-\r
- private void HandlePaint(object sender, PaintEventArgs e) {\r
- if (owner.icon != null) {\r
- e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(SystemColors.Window), rect);\r
- e.Graphics.DrawImage(owner.icon_bitmap, rect);\r
-\r
- }\r
- }\r
-\r
- private void HandleSizeChanged(object sender, EventArgs e) {\r
- CalculateIconRect();\r
- }\r
-\r
- private void HandleClick(object sender, EventArgs e) {\r
- if (owner.Click != null) {\r
- owner.Click(owner, e);\r
- }\r
- }\r
-\r
- private void HandleDoubleClick(object sender, EventArgs e) {\r
- if (owner.DoubleClick != null) {\r
- owner.DoubleClick(owner, e);\r
- }\r
- }\r
-\r
- private void HandleMouseDown(object sender, MouseEventArgs e) {\r
- if (owner.MouseDown != null) {\r
- owner.MouseDown(owner, e);\r
- }\r
- }\r
-
- private void HandleMouseUp(object sender, MouseEventArgs e) {\r
- if (owner.context_menu != null) {\r
- owner.context_menu.Show(this, new Point(e.X, e.Y));\r
- }\r
-\r
- if (owner.MouseUp != null) {\r
- owner.MouseUp(owner, e);\r
- }\r
- }\r
-\r
- private void HandleMouseMove(object sender, MouseEventArgs e) {\r
- if (owner.MouseMove != null) {\r
- owner.MouseMove(owner, e);\r
- }\r
- }\r
- }
- #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) {
- if (icon != null) {
- icon.Dispose();
- }
- 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) {\r
- if (icon != null) {\r
- icon.Dispose();\r
- }\r
-\r
- if (icon_bitmap != null) {\r
- icon_bitmap.Dispose();\r
- }\r
- base.Dispose (disposing);\r
- }\r
-
- #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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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--;
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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) {\r
- if (feature == Themes) {\r
- return ThemeEngine.Current.Version;\r
- }\r
- return null;\r
- }\r
- #endregion // Public Instance Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software",, to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
-
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
- }
-}
-
+++ /dev/null
-//
-// 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,
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- }
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)
-//
-
-// NOT 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);
- }
- #endregion // Constructors & Destructors
-
- #region Public Instance Properties
- [DefaultValue(BorderStyle.None)]
- [DispId(-504)]
- public BorderStyle BorderStyle {
- get { return border_style; }
- set {
- if (value == border_style)
- return;
- border_style = value;
- Refresh ();
- }
- }
-
- [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) {\r
- base.OnResize (e);\r
- Invalidate(true);\r
- }\r
-
- #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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
-
- [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 border_style; }
- set {
- border_style = value;
- Redraw (true);
- }
- }
-
- [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.Dispose ();
- 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
-
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)]\r
- 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)]\r
- public new event KeyEventHandler KeyDown;
-
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]\r
- public new event KeyPressEventHandler KeyPress;
-
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]\r
- 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)]\r
- public new event EventHandler RightToLeftChanged;
-
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]\r
- 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.AllPaintingInWmPaint, true);
- SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
- }
- #endregion // Public Constructors
-
- #region Public Instance Properties\r
-
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]\r
- public override bool AllowDrop\r
- {\r
- get { return base.AllowDrop; }
- set {
- base.AllowDrop = value;
- }\r
- }\r
-\r
- // Setting this property in MS .Net 1.1 does not have any visual effect and it\r
- // does not fire a BackColorChanged event
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]\r
- public override Color BackColor\r
- {\r
- get { return base.BackColor; }
- set { base.BackColor = value; }
- }
-
- // Setting this property in MS .Net 1.1 does not have any visual effect and it\r
- // does not fire a BackgroundImageChanged event
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]\r
- public override Image BackgroundImage\r
- {\r
- get { return base.BackgroundImage; }
- set { base.BackgroundImage = value; }
- }
-
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]\r
- public new bool CausesValidation\r
- {\r
- get { return base.CausesValidation; }
- set {
- if (base.CausesValidation == value)
- return;
-
- base.CausesValidation = value;
- if (CausesValidationChanged != null)
- CausesValidationChanged (this, new EventArgs ());
- }
- }
-
- protected override CreateParams CreateParams\r
- {
- get { return base.CreateParams; }
- }
-
- protected override ImeMode DefaultImeMode\r
- {
- get { return base.DefaultImeMode; }
- }
-
- protected override Size DefaultSize\r
- {
- get { return ThemeEngine.Current.ProgressBarDefaultSize; }
- }
-
- // Setting this property in MS .Net 1.1 does not have any visual effect and it\r
- // does not fire a FontChanged event
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]
- public override Font Font\r
- {
- get { return base.Font; }
- set { base.Font = value; }
- }
-
- // Setting this property in MS .Net 1.1 does not have any visual effect and it\r
- // does not fire a FontChanged event
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]
- public override Color ForeColor\r
- {
- get { return base.ForeColor; }
- set { base.ForeColor = value; }
- }
-
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]
- public new ImeMode ImeMode\r
- {
- get { return base.ImeMode; }
- set\r
- {
- if (value == base.ImeMode)
- return;
-
- base.ImeMode = value;
- if (ImeModeChanged != null)
- ImeModeChanged (this, EventArgs.Empty);
- }
- }
-
- [RefreshProperties(RefreshProperties.Repaint)]
- [DefaultValue (100)]
- public int Maximum\r
- {
- 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\r
- {
- 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\r
- {
- get { return step; }
- set {
- step = value;
- Refresh ();
- }
- }
-
- [Browsable (false)]
- [EditorBrowsable (EditorBrowsableState.Never)]
- public new bool TabStop\r
- {
- 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\r
- {
- get { return base.Text; }
- set\r
- {
- if (value == base.Text)
- return;
-
- if (TextChanged != null)
- TextChanged (this, EventArgs.Empty);
-
- Refresh ();
- }
- }
-
- [Bindable(true)]
- [DefaultValue (0)]
- public int Value\r
- {
- 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
- }
-}
+++ /dev/null
-using System;\r
-\r
-namespace System.Windows.Forms.PropertyGridInternal\r
-{\r
- /// <summary>\r
- /// Summary description for PropertiesTab.\r
- /// </summary>\r
- public class PropertiesTab : System.Windows.Forms.Design.PropertyTab\r
- {\r
- public PropertiesTab()\r
- {\r
- }\r
-\r
- public override System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes)\r
- {\r
- return null;\r
- }\r
-\r
- public override string TabName\r
- {\r
- get\r
- {\r
- return null;\r
- }\r
- }\r
-\r
-\r
- }\r
-}\r
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-\r
- 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)]\r
- [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)]\r
- [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;
- }
- }
-\r
- public Color HelpBackColor {
- get
- {
- return help_panel.BackColor;\r
- }\r
- set
- {
- if (help_panel.BackColor == value) {\r
- return;
- }
-
- help_panel.BackColor = value;
- }
- }
-
- public Color HelpForeColor {
- get {
- return help_panel.ForeColor;
- }
-
- set {
- if (help_panel.ForeColor == value) {
- return;
- }
-
- help_panel.ForeColor = value;
- }
- }
-\r
- [DefaultValue(true)]
- [Localizable(true)]
- public virtual bool HelpVisible {\r
- 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;
- }
- }
-\r
- [DefaultValue(PropertySort.CategorizedAlphabetical)]
- public PropertySort PropertySort {\r
- 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;\r
-
- ReflectObjects();
- Console.WriteLine("PropertySort");
- property_grid_view.Refresh();
-
- if (PropertySortChanged != null) {
- PropertySortChanged(this, EventArgs.Empty);
- }\r
- }
- }
-
- [BrowsableAttribute(false)]\r
- [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
- [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
- public PropertyTabCollection PropertyTabs {
- get {
- return property_tabs;
- }
- }
-
- [BrowsableAttribute(false)]\r
- [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;\r
- 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));
- \r
- }
- }
-
- 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)
- return;
- 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;
- }
- }
-
-\r
- [DefaultValue(true)]
- public virtual bool ToolbarVisible {\r
- 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)
- {
- }
-\r
- protected override void OnPaint (PaintEventArgs pevent)
- {\r
- base.OnPaint (pevent);
- }
-
- [MonoTODO]
- protected virtual void OnPropertyTabChanged (PropertyTabChangedEventArgs e)
- {
- throw new NotImplementedException();
- }
-
- protected virtual void OnPropertyValueChanged (PropertyValueChangedEventArgs e)
- {
- if (PropertyValueChanged != null) \r
- {
- 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) \r
- {
- SelectedGridItemChanged(this, e);
- }
- }
-
- protected virtual void OnSelectedObjectsChanged (EventArgs e)
- {
- if (SelectedObjectsChanged != null) \r
- {
- 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
-\r
- public PropertyTab this[int index] {
- get {\r
- return (PropertyTab)list[index];
- }
- }
-
- #region ICollection Members\r
- bool ICollection.IsSynchronized
- {
- get {\r
- return list.IsSynchronized;
- }
- }
-
- void ICollection.CopyTo(Array array, int index)
- {
- list.CopyTo(array, index);
- }
-\r
- object ICollection.SyncRoot
- {
- get {\r
- return list.SyncRoot;
- }
- }
-
- #endregion
-
- #region IEnumerable Members
- public IEnumerator GetEnumerator() {
- return list.GetEnumerator();
- }
-
- #endregion
-
- #region ICollection Members\r
- public int Count {
- get {\r
- 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
-\r
- private void toolbar_ButtonClick (object sender, ToolBarButtonClickEventArgs e)
- {
- if (e.Button == alphabetic_toolbarbutton) {\r
- this.PropertySort = PropertySort.Alphabetical;\r
- }
- else if (e.Button == categorized_toolbarbutton) {\r
- this.PropertySort = PropertySort.Categorized;
- }
- UpdateToolBarButtons();
- ReflectObjects();
- Console.WriteLine("toolbar_ButtonClick");
- property_grid_view.Refresh();
- }
-\r
- internal void UpdateToolBarButtons ()
- {
- if (PropertySort == PropertySort.Alphabetical) {\r
- categorized_toolbarbutton.Pushed = false;
- alphabetic_toolbarbutton.Pushed = true;\r
- }
- else if (PropertySort == PropertySort.Categorized) {\r
- categorized_toolbarbutton.Pushed = true;
- alphabetic_toolbarbutton.Pushed = false;\r
- }
- else {\r
- 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;
-
- }
-\r
- private void ReflectObjects ()
- {
- GridItemCollection alphabetical_grid_items = new GridItemCollection();
- GridItemCollection category_grid_items = new GridItemCollection();
- foreach (object obj in selected_objects) {
- if (obj != null) {
- PopulateGridItemCollection(obj,alphabetical_grid_items, category_grid_items);\r
- }
- }
- if (PropertySort == PropertySort.Alphabetical) {
- grid_items = alphabetical_grid_items;
- }
- // need to use categories
- else {
- grid_items = category_grid_items;
- }
- }
-
- private void PopulateGridItemCollection (object obj, GridItemCollection grid_item_coll, GridItemCollection category_grid_item_coll)
- {
- //TypeConverter converter = TypeDescriptor.GetConverter(obj);
- PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj);\r
- foreach (PropertyDescriptor property in properties) {
- if (property.IsBrowsable) {\r
- GridEntry grid_entry = new GridEntry(obj, property);\r
- grid_item_coll.Add(property.Name,grid_entry);
-
- string category = property.Category;
- GridItem cat_item = category_grid_item_coll[category];
- if (cat_item == null) {
- cat_item = new CategoryGridEntry(category);
- category_grid_item_coll.Add(category,cat_item);
- }
- cat_item.GridItems.Add(property.Name,grid_entry);
- }
- }
- }\r
-\r
- #endregion // Private Helper Methods\r
-\r
- private void help_panel_Paint(object sender, PaintEventArgs e)\r
- {\r
- e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(help_panel.BackColor), help_panel.ClientRectangle );\r
- e.Graphics.DrawRectangle(SystemPens.ControlDark, 0,0,help_panel.Width-1,help_panel.Height-1 );\r
- }\r
- }
-}
+++ /dev/null
-using System;\r
-using System.ComponentModel;\r
-\r
-namespace System.Windows.Forms.PropertyGridInternal {\r
- /// <summary>\r
- /// Summary description for PropertyGridEntry.\r
- /// </summary>\r
- internal class PropertyGridEntry : GridEntry {\r
- public PropertyGridEntry() {\r
- //\r
- // TODO: Add constructor logic here\r
- //\r
- }\r
-\r
- public PropertyGridEntry(object obj, PropertyDescriptor prop_desc) : base(obj, prop_desc) {
- }\r
- }\r
-}\r
+++ /dev/null
-using System;\r
-\r
-namespace System.Windows.Forms.PropertyGridInternal {\r
- public class PropertyGridTextBox : System.Windows.Forms.UserControl {\r
- private TextBox textbox;\r
- private Button dialog_button;\r
- private Button dropdown_button;\r
- /// <summary> \r
- /// Required designer variable.\r
- /// </summary>\r
- private System.ComponentModel.Container components = null;\r
-\r
- public PropertyGridTextBox() {\r
- // This call is required by the Windows.Forms Form Designer.\r
- InitializeComponent();\r
- dropdown_button.Paint+=new PaintEventHandler(dropdown_button_Paint);\r
-\r
- // TODO: Add any initialization after the InitializeComponent call\r
-\r
- }\r
-\r
- /// <summary> \r
- /// Clean up any resources being used.\r
- /// </summary>\r
- protected override void Dispose( bool disposing ) {\r
- if( disposing ) {\r
- if(components != null) {\r
- components.Dispose();\r
- }\r
- }\r
- base.Dispose( disposing );\r
- }\r
-\r
- #region Component Designer generated code\r
- /// <summary> \r
- /// Required method for Designer support - do not modify \r
- /// the contents of this method with the code editor.\r
- /// </summary>\r
- private void InitializeComponent() {\r
- this.dialog_button = new System.Windows.Forms.Button();\r
- this.dropdown_button = new System.Windows.Forms.Button();\r
- this.textbox = new System.Windows.Forms.TextBox();\r
- this.SuspendLayout();\r
- // \r
- // dialog_button\r
- // \r
- this.dialog_button.Dock = System.Windows.Forms.DockStyle.Right;\r
- this.dialog_button.Location = new System.Drawing.Point(256, 0);\r
- this.dialog_button.Name = "dialog_button";\r
- this.dialog_button.Size = new System.Drawing.Size(16, 16);\r
- this.dialog_button.TabIndex = 1;\r
- this.dialog_button.Text = "D";\r
- this.dialog_button.Visible = false;\r
- this.dialog_button.Click += new System.EventHandler(this.dialog_button_Click);\r
- // \r
- // dropdown_button\r
- // \r
- this.dropdown_button.Dock = System.Windows.Forms.DockStyle.Right;\r
- this.dropdown_button.Location = new System.Drawing.Point(240, 0);\r
- this.dropdown_button.Name = "dropdown_button";\r
- this.dropdown_button.Size = new System.Drawing.Size(16, 16);\r
- this.dropdown_button.TabIndex = 2;\r
- this.dropdown_button.Visible = false;\r
- this.dropdown_button.Click += new System.EventHandler(this.dropdown_button_Click);\r
- // \r
- // textbox\r
- // \r
- this.textbox.AutoSize = false;\r
- this.textbox.BackColor = System.Drawing.SystemColors.Window;\r
- this.textbox.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
- this.textbox.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.textbox.Location = new System.Drawing.Point(0, 0);\r
- this.textbox.Name = "textbox";\r
- this.textbox.Size = new System.Drawing.Size(240, 16);\r
- this.textbox.TabIndex = 3;\r
- this.textbox.Text = "textbox";\r
- // \r
- // PropertyGridTextBox\r
- // \r
- this.Controls.Add(this.textbox);\r
- this.Controls.Add(this.dropdown_button);\r
- this.Controls.Add(this.dialog_button);\r
- this.Name = "PropertyGridTextBox";\r
- this.Size = new System.Drawing.Size(272, 16);\r
- this.ResumeLayout(false);\r
-\r
- }\r
- #endregion\r
-\r
- private void dropdown_button_Click(object sender, System.EventArgs e) {\r
- if (DropDownButtonClicked != null)\r
- DropDownButtonClicked(this, EventArgs.Empty);\r
- }\r
-\r
- private void dialog_button_Click(object sender, System.EventArgs e) {\r
- if (DialogButtonClicked != null)\r
- DialogButtonClicked(this, EventArgs.Empty);\r
- }\r
-\r
-
- public event EventHandler DropDownButtonClicked;
- public event EventHandler DialogButtonClicked;\r
-\r
- public bool DialogButtonVisible {\r
- get{\r
- return dialog_button.Visible;\r
- }\r
- set {\r
- dialog_button.Visible = value;\r
- dropdown_button.Redraw();\r
- }\r
- }\r
- public bool DropDownButtonVisible {\r
- get{\r
- return dropdown_button.Visible;\r
- }\r
- set {\r
- dropdown_button.Visible = value;\r
- dropdown_button.Redraw();\r
- }\r
- }\r
-\r
- public bool ReadOnly {\r
- get {\r
- return textbox.ReadOnly;\r
- }\r
- set {\r
- textbox.ReadOnly = value;\r
- }\r
- }\r
-\r
- public new string Text {\r
- get {\r
- return textbox.Text;\r
- }\r
- set {\r
- textbox.Text = value;\r
- }\r
- }\r
-\r
- private void dropdown_button_Paint(object sender, PaintEventArgs e)\r
- {\r
- ThemeEngine.Current.CPDrawComboButton(e.Graphics, dropdown_button.ClientRectangle, dropdown_button.ButtonState);\r
- }\r
- }\r
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)\r
-//\r
-// Authors:\r
-// Jonathan Chambers (jonathan.chambers@ansys.com)\r
-//\r
-//\r
-\r
-// NOT COMPLETE\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Drawing;\r
-using System.Drawing.Design;\r
-using System.ComponentModel;\r
-using System.Windows.Forms.Design;\r
-\r
-namespace System.Windows.Forms.PropertyGridInternal \r
-{\r
- public class PropertyGridView : System.Windows.Forms.ScrollableControl, IWindowsFormsEditorService\r
- {\r
-\r
- #region Private Members\r
- private const int V_INDENT = 16;\r
- private const int ROW_HEIGHT = 16;\r
- private const int RESIZE_WIDTH = 3;\r
- private const int BUTTON_WIDTH = 25;\r
- private PropertyGridTextBox grid_textbox;\r
- private PropertyGrid property_grid;\r
- private bool resizing_grid;\r
- private int splitter_location;
- private int open_grid_item_count = -1;
- private int skipped_grid_items;\r
- private PropertyGridDropDown dropdown_form;\r
- private bool dropdown_form_showing;\r
- private Form dialog_form;\r
- private VScrollBar vbar;\r
- #endregion\r
-\r
- #region Contructors\r
- public PropertyGridView (PropertyGrid propertyGrid) \r
- {\r
- property_grid = propertyGrid;\r
-\r
- property_grid.SelectedGridItemChanged+=new SelectedGridItemChangedEventHandler(HandleSelectedGridItemChanged);\r
- property_grid.PropertyValueChanged+=new PropertyValueChangedEventHandler(HandlePropertyValueChanged);\r
-\r
- this.BackColor = Color.Beige;\r
- grid_textbox = new PropertyGridTextBox();\r
- grid_textbox.DropDownButtonClicked +=new EventHandler(DropDownButtonClicked);\r
- grid_textbox.DialogButtonClicked +=new EventHandler(DialogButtonClicked);\r
-\r
- \r
- dropdown_form = new PropertyGridDropDown();\r
- dropdown_form.FormBorderStyle = FormBorderStyle.None;
- dropdown_form.ShowInTaskbar = false;
- \r
- dialog_form = new Form();\r
- //dialog_form.FormBorderStyle = FormBorderStyle.None;\r
-\r
- \r
-\r
- grid_textbox.Visible = true;\r
- grid_textbox.Font = this.Font;//new Font(this.Font,FontStyle.Bold);\r
- grid_textbox.BackColor = this.BackColor;\r
- // Not working at all, used to??\r
- grid_textbox.Validating += new CancelEventHandler(TextBoxValidating);\r
-\r
- vbar = new VScrollBar();\r
- vbar.Visible = false;\r
- vbar.Scroll+=new ScrollEventHandler(HandleScroll);\r
- vbar.Dock = DockStyle.Right;\r
- this.Controls.Add(vbar);\r
-\r
- splitter_location = 65;\r
- resizing_grid = false;\r
-\r
- ForeColorChanged+=new EventHandler(RedrawEvent);\r
- BackColorChanged+=new System.EventHandler(RedrawEvent);\r
- FontChanged+=new EventHandler(RedrawEvent);\r
- SizeChanged+=new EventHandler(RedrawEvent);\r
- \r
- SetStyle(ControlStyles.DoubleBuffer, true);\r
- SetStyle(ControlStyles.UserPaint, true);\r
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);\r
- SetStyle(ControlStyles.ResizeRedraw, false);\r
- SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);\r
- }\r
-\r
- #endregion\r
-\r
- #region Protected Instance Methods\r
- \r
- protected override void OnPaint(PaintEventArgs e)\r
- {\r
- if (property_grid.SelectedGridItem != null && property_grid.SelectedGridItem.GridItemType == GridItemType.Property) \r
- {\r
- this.Controls.Add(grid_textbox);\r
- if (!grid_textbox.Focused)\r
- grid_textbox.Focus();\r
- }\r
- else \r
- {\r
- this.Controls.Remove(grid_textbox);\r
- }\r
-\r
- // Decide if we need a scrollbar
- open_grid_item_count = 0;\r
-\r
- // draw grid outline
- //DrawBackground(e);\r
-
- e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), ClientRectangle);\r
-\r
- // 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);\r
-\r
- DrawGrid(e, yLoc);\r
- e.Graphics.DrawRectangle(SystemPens.ControlDark, 0,0,Width-1,Height-1 );\r
- \r
- \r
-
-\r
- UpdateScrollBar();\r
- \r
- base.OnPaint(e);\r
- }\r
-\r
- protected override void OnMouseMove (MouseEventArgs e) \r
- {\r
- if (resizing_grid) \r
- {\r
- splitter_location = Math.Max(e.X,V_INDENT);\r
- Refresh();\r
- }\r
- base.OnMouseMove (e);\r
- }\r
-\r
- private GridItem GetSelectedGridItem (GridItemCollection grid_items, int y) \r
- {\r
- foreach (GridItem child_grid_item in grid_items) \r
- {\r
- if (y > child_grid_item.Top && y < child_grid_item.Top + ROW_HEIGHT) \r
- {\r
- return child_grid_item;\r
- }\r
- GridItem foundItem = GetSelectedGridItem(child_grid_item.GridItems, y);\r
- if (foundItem != null)\r
- return foundItem;\r
- }\r
- return null;\r
- }\r
-\r
- protected override void OnMouseDown (MouseEventArgs e) \r
- {\r
- if (e.X > splitter_location - RESIZE_WIDTH && e.X < splitter_location + RESIZE_WIDTH) \r
- {\r
- resizing_grid = true;\r
- }\r
- else \r
- {\r
- GridItem foundItem = GetSelectedGridItem(property_grid.grid_items, e.Y);\r
- \r
- if (foundItem != null)\r
- {\r
- if (foundItem.Expandable) \r
- {\r
- if (foundItem.PlusMinusBounds.Contains(e.X,e.Y))\r
- {\r
- foundItem.Expanded = !foundItem.Expanded;\r
- }\r
- }\r
- this.property_grid.SelectedGridItem = foundItem;\r
- }\r
- \r
- base.OnMouseDown (e);\r
- }\r
- }\r
-\r
- protected override void OnMouseUp (MouseEventArgs e) \r
- {\r
- resizing_grid = false;\r
- base.OnMouseUp (e);\r
- }\r
-\r
- protected override void OnKeyDown (KeyEventArgs e) \r
- {\r
- base.OnKeyDown (e);\r
- }\r
-\r
- #endregion\r
-\r
- #region Private Helper Methods\r
-\r
- private void UpdateScrollBar()\r
- {\r
- int visible_rows = this.ClientRectangle.Height/ROW_HEIGHT;\r
- if (open_grid_item_count > visible_rows)\r
- {\r
- vbar.Visible = true;\r
- vbar.SmallChange = 1;\r
- vbar.Minimum = 0;\r
- vbar.Maximum = open_grid_item_count-1;\r
- vbar.LargeChange = visible_rows;\r
- }\r
- else\r
- {\r
- vbar.Visible = false;\r
- }\r
-\r
- }\r
-\r
- private GridItem GetGridItemAt (int y) \r
- {\r
- return null;\r
- }\r
-\r
- #region Drawing Code\r
-\r
- private void DrawGrid(PaintEventArgs pevent, int yLoc)\r
- {\r
- Pen pen = ThemeEngine.Current.ResPool.GetPen(property_grid.LineColor);\r
- // vertical divider line\r
- pevent.Graphics.DrawLine(pen, splitter_location, 0, splitter_location, yLoc);\r
- \r
- while (yLoc >= 0)\r
- {\r
- // horizontal lines\r
- pevent.Graphics.DrawLine(pen, 0, yLoc, ClientRectangle.Width, yLoc);\r
- yLoc -= ROW_HEIGHT;\r
- }\r
- }\r
-\r
- private void DrawGridItems(GridItemCollection grid_items, PaintEventArgs pevent, int depth, ref int yLoc)\r
- {\r
- foreach (GridItem grid_item in grid_items) \r
- {
- DrawGridItem (grid_item, pevent, depth, ref yLoc);
- if (grid_item.Expanded)
- DrawGridItems(grid_item.GridItems, pevent, depth, ref yLoc);
- }\r
- }\r
-\r
- private void DrawGridItemLabel(GridItem grid_item, PaintEventArgs pevent, Rectangle rect)\r
- {\r
- int x = rect.X+1;\r
- if (grid_item.Parent != null && grid_item.Parent.GridItemType != GridItemType.Category)\r
- x += V_INDENT;\r
-\r
- Font font = this.Font;\r
- Brush brush = SystemBrushes.WindowText;\r
- if (grid_item.GridItemType == GridItemType.Category)\r
- {\r
- font = new Font(font, FontStyle.Bold);\r
- brush = SystemBrushes.ControlDark;\r
- }\r
-\r
- if (grid_item == property_grid.SelectedGridItem && grid_item.GridItemType != GridItemType.Category)\r
- {\r
- pevent.Graphics.FillRectangle (SystemBrushes.Highlight, rect);\r
- // Label\r
- brush = SystemBrushes.HighlightText;\r
- }\r
-\r
- \r
- pevent.Graphics.DrawString(grid_item.Label,font,brush,new Rectangle(x, rect.Y + 2,x-rect.X+rect.Width,rect.Height-2));\r
- }\r
-\r
- private void DrawGridItemValue(GridItem grid_item, PaintEventArgs pevent, Rectangle rect)\r
- {\r
- // Value\r
- if (grid_item.PropertyDescriptor != null)\r
- {\r
-\r
- bool paintsValue = false;\r
- UITypeEditor editor = null;\r
- object temp = grid_item.PropertyDescriptor.GetEditor(typeof(UITypeEditor));\r
- editor = (UITypeEditor)temp;//grid_item.PropertyDescriptor.GetEditor(typeof(UITypeEditor));\r
- if (editor != null) \r
- {\r
- paintsValue = editor.GetPaintValueSupported();\r
- }\r
-\r
- if (grid_item == property_grid.SelectedGridItem)\r
- {\r
- grid_textbox.DropDownButtonVisible = false;\r
- grid_textbox.DialogButtonVisible = false;\r
- if (editor != null) \r
- {\r
- UITypeEditorEditStyle style = editor.GetEditStyle();\r
- \r
- switch (style)\r
- {\r
- case UITypeEditorEditStyle.DropDown:\r
- grid_textbox.DropDownButtonVisible = true;\r
- break;\r
- case UITypeEditorEditStyle.Modal:\r
- grid_textbox.DialogButtonVisible = true;\r
- break;\r
- }\r
- }\r
- else \r
- {
- try
- {\r
- if (grid_item.PropertyDescriptor.Converter != null)\r
- {\r
- if (grid_item.PropertyDescriptor.Converter.GetStandardValuesSupported()) \r
- {\r
- \r
- grid_textbox.DropDownButtonVisible = true;\r
- grid_textbox.ReadOnly = true;
- }\r
- }\r
- else\r
- {\r
- System.Console.WriteLine("Converter not available for type {0}",grid_item.PropertyDescriptor.PropertyType);\r
- }\r
- \r
- }
- catch (Exception ex)
- {
- }
- }\r
- }\r
-\r
- \r
-\r
- int xLoc = splitter_location+1;\r
- if (paintsValue)\r
- {\r
- pevent.Graphics.DrawRectangle(ThemeEngine.Current.ResPool.GetPen(Color.Black), splitter_location+2,rect.Y+2, 20, ROW_HEIGHT-4);\r
- try\r
- {\r
- editor.PaintValue(grid_item.Value, pevent.Graphics, new Rectangle(splitter_location+3,rect.Y+3, 19, ROW_HEIGHT-5));\r
- }\r
- catch (Exception ex)\r
- {\r
- System.Console.WriteLine(ex.Message);\r
- System.Console.WriteLine("Paint Value failed for type {0}",grid_item.PropertyDescriptor.PropertyType);\r
- // design time stuff is not playing nice\r
- }\r
- xLoc += 27;\r
- }\r
-\r
- Font font = this.Font;\r
- try \r
- {
- if (grid_item.PropertyDescriptor.Converter != null)
- {
- string value = grid_item.PropertyDescriptor.Converter.ConvertToString(grid_item.Value);\r
- if (grid_item.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))\r
- font = new Font(font, FontStyle.Bold);\r
-
- pevent.Graphics.DrawString(value,font,SystemBrushes.WindowText,new RectangleF(xLoc,rect.Y+2, ClientRectangle.Width-(xLoc), ROW_HEIGHT));\r
- }\r
- else\r
- {\r
- System.Console.WriteLine("No converter for type {0}",grid_item.PropertyDescriptor.PropertyType);\r
- }\r
-\r
- }
- catch (Exception e)
- {
- }
- if (grid_item == property_grid.SelectedGridItem && grid_item.GridItemType != GridItemType.Category)\r
- {\r
- grid_textbox.Location = new Point(xLoc, rect.Top);\r
- grid_textbox.Size = new Size(ClientRectangle.Width-xLoc,ROW_HEIGHT);\r
- }\r
- }\r
- }\r
-\r
- private void DrawGridItem (GridItem grid_item, PaintEventArgs pevent, int depth, ref int yLoc) \r
- {\r
- if (yLoc > -ROW_HEIGHT && yLoc < ClientRectangle.Height)\r
- {\r
- \r
- // left column\r
- pevent.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (property_grid.LineColor), 0,yLoc,V_INDENT, ROW_HEIGHT);\r
-\r
- if (grid_item.Expandable) \r
- {\r
- grid_item.PlusMinusBounds = DrawPlusMinus(pevent, 3, yLoc+3, grid_item.Expanded, grid_item.GridItemType == GridItemType.Category);\r
- }\r
- \r
- if (grid_item.GridItemType == GridItemType.Category)\r
- {\r
- pevent.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (property_grid.LineColor), depth*V_INDENT,yLoc,ClientRectangle.Width-(depth*V_INDENT), ROW_HEIGHT);\r
- }\r
-\r
- DrawGridItemLabel(grid_item, pevent, new Rectangle(V_INDENT,yLoc, splitter_location-V_INDENT, ROW_HEIGHT));\r
- DrawGridItemValue(grid_item, pevent, new Rectangle(splitter_location+2,yLoc, ClientRectangle.Width-splitter_location-2, ROW_HEIGHT));\r
- \r
- \r
- \r
- }\r
- grid_item.Top = yLoc;
- yLoc += ROW_HEIGHT;
- open_grid_item_count++;\r
- }\r
-\r
- 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;
- }\r
-\r
- #endregion\r
-\r
- #region Event Handling\r
- private void RedrawEvent (object sender, System.EventArgs e) \r
- {\r
- Refresh();\r
- }
-\r
- private void TextBoxValidating (object sender, CancelEventArgs e) \r
- {\r
- if (this.property_grid.SelectedGridItem != null) \r
- {\r
- PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;\r
- if (desc != null) \r
- {\r
- try \r
- {\r
- if (desc.Converter != null)\r
- {\r
- SetPropertyValue(desc.Converter.ConvertFromString(grid_textbox.Text));\r
- }\r
- else\r
- {\r
- System.Console.WriteLine("No converter for type {0}",desc.PropertyType);\r
- }\r
- }\r
- catch (Exception ex)\r
- {\r
- Console.WriteLine("Error converting string");\r
- }\r
- }\r
- }\r
- }\r
-
- #endregion
-\r
- \r
- #endregion\r
-\r
- private void dropdown_form_Deactivate (object sender, EventArgs e) \r
- {\r
- dropdown_form_showing = false;\r
- dropdown_form.Hide();\r
- //dropdown_form = new Form();\r
- }\r
-\r
- private void listBox_SelectedIndexChanged (object sender, EventArgs e) \r
- {\r
- if (this.property_grid.SelectedGridItem != null) \r
- {\r
- PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;\r
- if (desc != null) \r
- {\r
- SetPropertyValue(((ListBox)sender).SelectedItem);\r
- }\r
- }\r
- dropdown_form.Hide();\r
- //dropdown_form = new Form();\r
- Refresh();\r
- }\r
-\r
- private void SetPropertyValue(object newVal)\r
- {\r
- if (this.property_grid.SelectedGridItem != null) \r
- {\r
- PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;\r
- if (desc != null) \r
- {\r
- desc.SetValue(property_grid.SelectedObject, newVal);\r
- }\r
- }\r
- }\r
-\r
- private void DropDownButtonClicked (object sender, EventArgs e) \r
- {\r
- if (property_grid.SelectedGridItem.PropertyDescriptor.GetEditor(typeof(UITypeEditor)) == null)\r
- {\r
- //dropdown_form.FormBorderStyle = FormBorderStyle.None;\r
- dropdown_form.Deactivate +=new EventHandler(dropdown_form_Deactivate);\r
- ListBox listBox = new ListBox();\r
- listBox.Dock = DockStyle.Fill;\r
- listBox.SelectedIndexChanged +=new EventHandler(listBox_SelectedIndexChanged);\r
- foreach (object obj in property_grid.SelectedGridItem.PropertyDescriptor.Converter.GetStandardValues())\r
- listBox.Items.Add(obj);\r
- dropdown_form.Controls.Clear();\r
- dropdown_form.Controls.Add(listBox);\r
- dropdown_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+ROW_HEIGHT));\r
- dropdown_form.Width = grid_textbox.Width;\r
- dropdown_form.Show();\r
- }\r
- else // use editor\r
- {\r
- UITypeEditor editor = (UITypeEditor)property_grid.SelectedGridItem.PropertyDescriptor.GetEditor(typeof(UITypeEditor));\r
- System.ComponentModel.Design.ServiceContainer service_container = new System.ComponentModel.Design.ServiceContainer();\r
- service_container.AddService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService), this);\r
- SetPropertyValue(editor.EditValue(new ITypeDescriptorContextImpl(this.property_grid), service_container,property_grid.SelectedGridItem.Value));\r
- }\r
- }\r
- \r
- private void DialogButtonClicked(object sender, EventArgs e) \r
- {\r
- //dialog_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+ROW_HEIGHT));\r
- //dropdown_form.Width = grid_textbox.Width;\r
- dialog_form.Show();\r
- }\r
-\r
- private void HandleScroll(object sender, ScrollEventArgs e)\r
- {\r
- if (e.NewValue <= 0)\r
- {\r
- e.NewValue = 0;\r
- if (e.NewValue == vbar.Value)return;\r
- }\r
- if (e.NewValue > vbar.Maximum-ClientRectangle.Height/ROW_HEIGHT)\r
- {\r
- e.NewValue = vbar.Maximum-ClientRectangle.Height/ROW_HEIGHT+1;\r
- if (e.NewValue == vbar.Value)return;\r
- }\r
-\r
- switch (e.Type)\r
- {\r
- case ScrollEventType.SmallDecrement:\r
- XplatUI.ScrollWindow(Handle, 0, ROW_HEIGHT, false);\r
- grid_textbox.Top += ROW_HEIGHT;\r
- Invalidate(ClientRectangle);\r
- //Invalidate(new Rectangle(0,0,ClientRectangle.Width,ROW_HEIGHT));\r
- break;\r
- case ScrollEventType.SmallIncrement:\r
- XplatUI.ScrollWindow(Handle, 0, -ROW_HEIGHT, false);\r
- grid_textbox.Top -= ROW_HEIGHT;\r
- Invalidate(ClientRectangle);\r
- //Invalidate(new Rectangle(0,ClientRectangle.Bottom-ROW_HEIGHT,ClientRectangle.Width,ROW_HEIGHT));\r
- break;\r
- case ScrollEventType.LargeDecrement:\r
- XplatUI.ScrollWindow(Handle, 0, ROW_HEIGHT, false);\r
- Invalidate(ClientRectangle);\r
- break;\r
- case ScrollEventType.LargeIncrement:\r
- XplatUI.ScrollWindow(Handle, 0, -ROW_HEIGHT, false);\r
- Invalidate(ClientRectangle);\r
- break;\r
- case ScrollEventType.ThumbTrack:\r
- XplatUI.ScrollWindow(Handle, 0, -(vbar.Value-e.NewValue), false);\r
- Invalidate(ClientRectangle);\r
- break;\r
- case ScrollEventType.ThumbPosition:\r
- Invalidate(ClientRectangle);\r
- break;\r
- }\r
- }\r
-\r
-\r
- private void HandleSelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e)\r
- { \r
- // Region not working correctly\r
- //Region clip = new Region();\r
- //if (property_grid.SelectedGridItem != null)\r
- // clip.Union(new Rectangle(0,property_grid.SelectedGridItem.Top, ClientRectangle.Width, ROW_HEIGHT));\r
- // clip.Union(new Rectangle(0,property_grid.SelectedGridItem.Top, ClientRectangle.Width, ROW_HEIGHT));\r
-\r
- if (e.NewSelection.PropertyDescriptor != null)\r
- {\r
- grid_textbox.Text = e.NewSelection.PropertyDescriptor.Converter.ConvertToString(e.NewSelection.Value);\r
- if (e.NewSelection.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))\r
- grid_textbox.Font = new Font(this.Font, FontStyle.Bold);\r
- else\r
- grid_textbox.Font = this.Font;\r
- }\r
-\r
- Invalidate(/*clip*/this.ClientRectangle);\r
- Update();\r
- }\r
-\r
- private void HandlePropertyValueChanged(object s, PropertyValueChangedEventArgs e)\r
- {\r
- if (e.ChangedItem.PropertyDescriptor != null)\r
- {\r
- grid_textbox.Text = e.ChangedItem.PropertyDescriptor.Converter.ConvertToString(e.ChangedItem.Value);\r
- if (e.ChangedItem.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))\r
- grid_textbox.Font = new Font(this.Font, FontStyle.Bold);\r
- else\r
- grid_textbox.Font = this.Font;\r
- }\r
- }\r
- \r
- #region IWindowsFormsEditorService Members\r
-\r
- public void CloseDropDown()\r
- {\r
- dropdown_form_showing = false;\r
- dropdown_form.Hide();\r
- }\r
-\r
- public void DropDownControl(Control control)\r
- {\r
- //dropdown_form.FormBorderStyle = FormBorderStyle.None;\r
- dropdown_form.Deactivate +=new EventHandler(dropdown_form_Deactivate);\r
- dropdown_form.Size = control.Size;\r
- control.Dock = DockStyle.Fill;\r
- dropdown_form.Controls.Clear();\r
- dropdown_form.Controls.Add(control);\r
- dropdown_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+ROW_HEIGHT));\r
- dropdown_form.Width = grid_textbox.Width;\r
-\r
- dropdown_form_showing = true;\r
- dropdown_form.Show();\r
- System.Windows.Forms.MSG msg = new MSG();\r
- while (XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0) && dropdown_form_showing) \r
- {\r
- XplatUI.TranslateMessage(ref msg);\r
- XplatUI.DispatchMessage(ref msg);\r
- }\r
- }\r
-\r
- public System.Windows.Forms.DialogResult ShowDialog(Form dialog)\r
- {\r
- return dialog.ShowDialog(this);\r
- }\r
-\r
- #endregion\r
-\r
- #region DropDownForm Class\r
- #endregion DropDownForm Class\r
-\r
- #region Internal Classes\r
- internal class ITypeDescriptorContextImpl : System.ComponentModel.ITypeDescriptorContext\r
- {\r
- private PropertyGrid property_grid;\r
- public ITypeDescriptorContextImpl(PropertyGrid propertyGrid)\r
- {\r
- property_grid = propertyGrid;\r
- }\r
- #region ITypeDescriptorContext Members\r
-\r
- public void OnComponentChanged()\r
- {\r
- // TODO: Add SystemComp.OnComponentChanged implementation\r
- }\r
-\r
- public IContainer Container\r
- {\r
- get\r
- {\r
- return property_grid as IContainer;\r
- }\r
- }\r
-\r
- public bool OnComponentChanging()\r
- {\r
- // TODO: Add SystemComp.OnComponentChanging implementation\r
- return false;\r
- }\r
-\r
- public object Instance\r
- {\r
- get\r
- {\r
- return property_grid.SelectedGridItem.Value;\r
- }\r
- }\r
-\r
- public PropertyDescriptor PropertyDescriptor\r
- {\r
- get\r
- {\r
- return property_grid.SelectedGridItem.PropertyDescriptor;\r
- }\r
- }\r
-\r
- #endregion\r
-\r
- #region IServiceProvider Members\r
-\r
- public object GetService(Type serviceType)\r
- {\r
- // TODO: Add SystemComp.GetService implementation\r
- return null;\r
- }\r
-\r
- #endregion\r
-\r
- }\r
-\r
-\r
-
- /*
- class ComboListBox
- */
- internal class PropertyGridDropDown : Form
- {
- protected override CreateParams CreateParams
- {
- get \r
- {
- 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;
- }
- }
-
- }\r
- #endregion\r
-\r
- }\r
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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);
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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) {\r
- OnClick(e);\r
- }\r
- #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\r
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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.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 Font rtf_font;
- 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;
- this.LostFocus +=new EventHandler(RichTextBox_LostFocus);
- this.BackColor = ThemeEngine.Current.ColorWindow;
- this.ForeColor = ThemeEngine.Current.ColorWindowText;
-
- Console.WriteLine("A friendly request: Do not log a bug about debug messages being emitted when\n" +
- "using RichTextBox. It's not yet finished, it will spew debug information, and\n" +
- "it may not work the way you like it just yet. Some methods also are also not yet\n" +
- "implemented. And we're also aware that text gets bolder with every change.");
- Console.WriteLine("To quote Sean Gilkes: Patience is a virtue, waiting doesn't hurt you :-)");
- }
- #endregion // Public Constructors
-
- #region Private & Internal Methods
- private void RichTextBox_LostFocus(object sender, EventArgs e) {\r
- has_focus = false;\r
- Invalidate();\r
- }\r
- #endregion // Private & Internal Methods
-
- #region Public Instance Properties
- public override bool AllowDrop {\r
- get {\r
- return base.AllowDrop;\r
- }\r
-\r
- set {\r
- base.AllowDrop = value;\r
- }\r
- }\r
-\r
- [DefaultValue(false)]\r
- public override bool AutoSize {\r
- get {\r
- return auto_size;\r
- }\r
-\r
- set {\r
- base.AutoSize = value;\r
- }\r
- }\r
-\r
- [DefaultValue(false)]\r
- public bool AutoWordSelection {\r
- get {\r
- return auto_word_select;\r
- }\r
-\r
- set {\r
- auto_word_select = true;\r
- }\r
- }\r
-\r
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override System.Drawing.Image BackgroundImage {\r
- get {\r
- return background_image;\r
- }\r
-\r
- set {\r
- base.BackgroundImage = value;\r
- }\r
- }\r
-\r
- [DefaultValue(0)]\r
- [Localizable(true)]\r
- 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 {\r
- get {\r
- return base.Font;\r
- }\r
-\r
- set {\r
- if (font != value) {\r
- if (auto_size) {\r
- if (PreferredHeight != Height) {
- Height = PreferredHeight;
- }
- }\r
-\r
- base.Font = value;\r
- }\r
- }\r
- }\r
-
- public override Color ForeColor {\r
- get {\r
- return base.ForeColor;\r
- }\r
-\r
- set {\r
- base.ForeColor = value;\r
- }\r
- }\r
-
- [DefaultValue(Int32.MaxValue)]
- public override int MaxLength {\r
- get {\r
- return base.max_length;\r
- }\r
-\r
- set {\r
- base.max_length = value;\r
- }\r
- }\r
-
- [DefaultValue(true)]
- public override bool Multiline {\r
- get {\r
- return multiline;\r
- }\r
-\r
- set {\r
- base.Multiline = value;\r
- }\r
- }\r
-
- [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)]
- [MonoTODO("finish and plug in the rtf parser/generator")]
- public string Rtf {
- get {
- // FIXME
- return null;
- }
-
- set {
- // FIXME
- }
- }
-
- [DefaultValue(RichTextBoxScrollBars.Both)]
- [Localizable(true)]
- public RichTextBoxScrollBars ScrollBars {
- get {
- return scrollbars;
- }
-
- set {
- scrollbars = value;
- }
- }
-
- [MonoTODO("finish and plug in rtf parser/generator")]
- public string SelectedRtf {
- get {
- // FIXME
- return null;
- }
-
- set {
- // FIXME
- }
- }
-
- public override string SelectedText {\r
- get {\r
- return base.SelectedText;\r
- }\r
-\r
- set {\r
- base.SelectedText = value;\r
- }\r
- }\r
-
- [Browsable(false)]
- [DefaultValue(HorizontalAlignment.Left)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public HorizontalAlignment SelectionAlignment {
- get {
- HorizontalAlignment align;
- int line_no;
- Line start;
- Line end;
- Line line;
-
- start = document.ParagraphStart(document.selection_start.line);
- align = start.alignment;
- line_no = start.line_no;
-
- 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 {
- HorizontalAlignment align;
- int line_no;
- Line start;
- Line end;
- Line line;
-
- start = document.ParagraphStart(document.selection_start.line);
- line_no = start.line_no;
-
- 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();
- }
- }
-
-
- 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, 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();
-
- }
- }
-
- [Localizable(true)]
- public override string Text {\r
- get {\r
- return base.Text;\r
- }\r
-\r
- set {\r
- base.Text = value;\r
- }\r
- }\r
-
- [Browsable(false)]
- public override int TextLength {\r
- get {\r
- return base.TextLength;\r
- }\r
- }\r
-
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public string UndoActionName {
- get {
- return undo_action_name;
- }
- }
-
- [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 {\r
- get {\r
- return base.CreateParams;\r
- }\r
- }\r
-
- protected override Size DefaultSize {\r
- get {\r
- return new Size(100, 96);\r
- }\r
- }\r
- #endregion // Protected Instance Properties
-
- #region Public Instance Methods
- 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;\r
- int count;\r
- byte[] buffer;\r
-\r
- try {\r
- sb = new StringBuilder((int)data.Length);\r
- buffer = new byte[1024];\r
- }\r
-\r
- catch {\r
- throw new IOException("Not enough memory to load document");\r
- return;\r
- }\r
-\r
- count = 0;\r
- while (count < data.Length) {\r
- count += data.Read(buffer, count, 1024);\r
- sb.Append(buffer);\r
- }\r
- base.Text = sb.ToString();\r
- return;\r
- }\r
-
-
- 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_font = Font;
- rtf_color = new SolidBrush(ForeColor);
- rtf_rtffont_size = this.Font.Height;
- rtf_rtfalign = HorizontalAlignment.Left;
- rtf_rtffont = null;
- rtf_cursor_x = 0;
- rtf_cursor_y = 1;
-
- rtf_text_map = new RTF.TextMap();
- RTF.TextMap.SetupStandardTable(rtf_text_map.Table);
-
- rtf.Read(); // That's it
- document.RecalculateDocument(CreateGraphics());
- }
-
- 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 SaveFile(Stream data, RichTextBoxStreamType fileType) {
- }
-
- 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;
- Encoding encoding;
-
- data = null;
- if (fileType == RichTextBoxStreamType.UnicodePlainText) {
- encoding = Encoding.Unicode;
- } else {
- encoding = Encoding.ASCII;
- }
-
- 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 override void OnBackColorChanged(EventArgs e) {\r
- base.OnBackColorChanged (e);\r
- }\r
-\r
- protected override void OnContextMenuChanged(EventArgs e) {\r
- base.OnContextMenuChanged (e);\r
- }\r
-\r
- protected override void OnHandleCreated(EventArgs e) {\r
- base.OnHandleCreated (e);\r
- }\r
-\r
- protected override void OnHandleDestroyed(EventArgs e) {\r
- base.OnHandleDestroyed (e);\r
- }\r
-\r
- protected override void OnRightToLeftChanged(EventArgs e) {\r
- base.OnRightToLeftChanged (e);\r
- }\r
-\r
- protected override void OnSystemColorsChanged(EventArgs e) {\r
- base.OnSystemColorsChanged (e);\r
- }\r
-\r
- protected override void OnTextChanged(EventArgs e) {\r
- base.OnTextChanged (e);\r
- }\r
-\r
- protected override void WndProc(ref Message m) {\r
- base.WndProc (ref m);\r
- }\r
- #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;
-
- [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 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
- 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;
- int num;
-
- color = System.Windows.Forms.RTF.Color.GetColor(rtf, rtf.Param);
- if (color != null) {
- FlushText(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: {
- 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(false);
- this.rtf_rtffont = font;
- }
- break;
- }
-
- case Minor.Plain: {
- FlushText(false);
- rtf_rtfstyle = FontStyle.Regular;
- break;
- }
-
- case Minor.Bold: {
- FlushText(false);
- if (rtf.Param == RTF.RTF.NoParam) {
- rtf_rtfstyle |= FontStyle.Bold;
- } else {
- rtf_rtfstyle &= ~FontStyle.Bold;
- }
- break;
- }
-
- case Minor.Italic: {
- FlushText(false);
- if (rtf.Param == RTF.RTF.NoParam) {
- rtf_rtfstyle |= FontStyle.Italic;
- } else {
- rtf_rtfstyle &= ~FontStyle.Italic;
- }
- break;
- }
-
- case Minor.StrikeThru: {
- FlushText(false);
- if (rtf.Param == RTF.RTF.NoParam) {
- rtf_rtfstyle |= FontStyle.Strikeout;
- } else {
- rtf_rtfstyle &= ~FontStyle.Strikeout;
- }
- break;
- }
-
- case Minor.Underline: {
- FlushText(false);
- if (rtf.Param == RTF.RTF.NoParam) {
- rtf_rtfstyle |= FontStyle.Underline;
- } else {
- rtf_rtfstyle &= ~FontStyle.Underline;
- }
- break;
- }
-
- case Minor.NoUnderline: {
- FlushText(false);
- rtf_rtfstyle &= ~FontStyle.Underline;
- break;
- }
- }
- break;
- }
-
- case RTF.Major.SpecialChar: {
- Console.Write("[Got SpecialChar control {0}]", rtf.Minor);
- SpecialChar(rtf);
- break;
- }
- }
- }
-
- void SpecialChar(RTF.RTF rtf) {
- switch(rtf.Minor) {
- case Minor.Page:
- case Minor.Sect:
- case Minor.Row:
- case Minor.Line:
- case Minor.Par: {
- FlushText(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("\97");
- break;
- }
-
- case Minor.EnDash: {
- Console.Write("\96");
- break;
- }
-
- case Minor.LQuote: {
- Console.Write("\91");
- break;
- }
-
- case Minor.RQuote: {
- Console.Write("\92");
- break;
- }
-
- case Minor.LDblQuote: {
- Console.Write("\93");
- break;
- }
-
- case Minor.RDblQuote: {
- Console.Write("\94");
- break;
- }
-
- default: {
- rtf.SkipGroup();
- break;
- }
- }
- }
-
-
- 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);
- }
- }
- }
-
- void FlushText(bool newline) {
- int length;
- Font font;
-
- length = rtf_line.Length;
- if (length == 0) {
- return;
- }
-
- if (rtf_rtffont != null) {
- font = new Font(rtf_rtffont.Name, rtf_rtffont_size, rtf_rtfstyle);
- } else {
- font = this.Font;
- }
-
- 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, line, rtf_cursor_x + length, font, rtf_color);
- }
-
- if (newline) {
- rtf_cursor_x = 0;
- rtf_cursor_y++;
- } else {
- rtf_cursor_x += length;
- }
- rtf_line.Length = 0; // Empty line
- }
- #endregion // Private Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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,
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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,
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-<VisualStudioProject>\r
- <CSHARP LastOpenVersion = "7.10.3077" >\r
- <Build>\r
- <Settings ReferencePath = "" >\r
- <Config\r
- Name = "Debug"\r
- EnableASPDebugging = "false"\r
- EnableASPXDebugging = "false"\r
- EnableUnmanagedDebugging = "false"\r
- EnableSQLServerDebugging = "false"\r
- RemoteDebugEnabled = "false"\r
- RemoteDebugMachine = ""\r
- StartAction = "Project"\r
- StartArguments = ""\r
- StartPage = ""\r
- StartProgram = ""\r
- StartURL = ""\r
- StartWorkingDirectory = ""\r
- StartWithIE = "true"\r
- />\r
- <Config\r
- Name = "Release"\r
- EnableASPDebugging = "false"\r
- EnableASPXDebugging = "false"\r
- EnableUnmanagedDebugging = "false"\r
- EnableSQLServerDebugging = "false"\r
- RemoteDebugEnabled = "false"\r
- RemoteDebugMachine = ""\r
- StartAction = "Project"\r
- StartArguments = ""\r
- StartPage = ""\r
- StartProgram = ""\r
- StartURL = ""\r
- StartWorkingDirectory = ""\r
- StartWithIE = "false"\r
- />\r
- </Settings>\r
- </Build>\r
- <OtherProjectSettings\r
- CopyProjectDestinationFolder = ""\r
- CopyProjectUncPath = ""\r
- CopyProjectOption = "0"\r
- ProjectView = "ProjectFiles"\r
- ProjectTrust = "0"\r
- />\r
- </CSHARP>\r
-</VisualStudioProject>\r
-\r
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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) {\r
- if (obj is Screen) {\r
- Screen s = (Screen)obj;\r
-\r
- if (name.Equals(s.name) && (primary == s.primary) && (bounds.Equals(s.Bounds)) && (workarea.Equals(s.workarea))) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-
- public override int GetHashCode() {\r
- return base.GetHashCode ();\r
- }\r
-\r
- public override string ToString() {\r
- return "Screen[Bounds={" + this.Bounds + "} WorkingArea={" + this.WorkingArea + "} Primary={" + this.Primary + "} DeviceName=" + this.DeviceName;\r
- }\r
-\r
-
- #endregion // Public Instance Methods
- }
-}
+++ /dev/null
-//
-// 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.AllPaintingInWmPaint, true);
- SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
- }
-
- #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)
- SmallDecrement();
-
- if ((secondbutton_state & ButtonState.Pushed) == ButtonState.Pushed)
- 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
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- #endregion // DockPaddingEdges Local Variables
-
- #region DockPaddingEdges Constructor
- internal DockPaddingEdges() {
- all = 0;
- left = 0;
- right = 0;
- top = 0;
- bottom = 0;
- }
- #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;
- }
- }
-
- [RefreshProperties(RefreshProperties.All)]
- public int Bottom {
- get {
- return bottom;
- }
-
- set {
- bottom = value;
- all = 0;
- }
- }
-
- [RefreshProperties(RefreshProperties.All)]
- public int Left {
- get {
- return left;
- }
-
- set {
- left=value;
- all = 0;
- }
- }
-
- [RefreshProperties(RefreshProperties.All)]
- public int Right {
- get {
- return right;
- }
-
- set {
- right=value;
- all = 0;
- }
- }
-
- [RefreshProperties(RefreshProperties.All)]
- public int Top {
- get {
- return top;
- }
-
- set {
- top=value;
- all = 0;
- }
- }
-
- #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();
-
- 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);
- 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();
- 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) {
- Controls.Remove(hscrollbar);
- hscrollbar.Dispose();
- hscrollbar = null;
-
- Controls.Remove(vscrollbar);
- vscrollbar.Dispose();
- vscrollbar = null;
-
- Controls.Remove(sizegrip);
- sizegrip.Dispose();
- sizegrip = null;
- } else {
- hscrollbar = new HScrollBar();
- hscrollbar.Visible = false;
- hscrollbar.ValueChanged += new EventHandler(HandleScrollBar);
- hscrollbar.Height = SystemInformation.HorizontalScrollBarHeight;
- this.Controls.Add(hscrollbar);
-
- vscrollbar = new VScrollBar();
- vscrollbar.Visible = false;
- vscrollbar.ValueChanged += new EventHandler(HandleScrollBar);
- vscrollbar.Width = SystemInformation.VerticalScrollBarWidth;
- this.Controls.Add(vscrollbar);
-
- sizegrip = new SizeGrip();
- sizegrip.Visible = false;
- this.Controls.Add(sizegrip);
- }
- }
- }
-
- [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;
- }
- }
- 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;
- }
-
- // DockPadding is documented as 'get' only ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsScrollableControlClassAutoScrollTopic.asp )
- // but Microsoft's examples on that page show 'set' usage
-// set {
-// dock_padding = value;
-// }
- }
- #endregion // Public Instance Properties
-
- #region Protected Instance Methods
- protected override CreateParams CreateParams {
- get {
- CreateParams ret;
-
- ret = base.CreateParams;
-
- ret.Style |= (int)(WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_VISIBLE);
-
- return ret;
- }
- }
-
- 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 + SystemInformation.VerticalScrollBarWidth;
- canvas.Height += auto_scroll_margin.Height + SystemInformation.HorizontalScrollBarHeight;
-
- // || (scroll_position.X == 0 && scroll_position.Y == 0)
-
- if ((canvas.Width >= client.Width) || (auto_scroll_min_size.Width > client.Width) || force_hscroll_visible) {
- // Need horz
-
- hscrollbar.Left = 0;
- hscrollbar.Top = client.Height - SystemInformation.HorizontalScrollBarHeight;
- hscrollbar.Maximum = Math.Max(0, canvas.Width - client.Width + SystemInformation.VerticalScrollBarWidth);
-
- hscroll_visible = true;
- } else {
- hscroll_visible = false;
- scroll_position.X = 0;
- }
-
- if ((canvas.Height >= 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.Maximum = Math.Max(0, canvas.Height - client.Height + SystemInformation.HorizontalScrollBarHeight);
- 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
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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]\r
- [ComVisible(true)]
- public enum SelectionMode
- {
- None = 0,
- One = 1,
- MultiSimple = 2,
- MultiExtended = 3,
-
- }
-}
-
+++ /dev/null
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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;\r
- DateTime start;\r
- DateTime end;\r
-\r
- if ((value == null) || !(value is String)) {\r
- return base.ConvertFrom (context, culture, value);\r
- }\r
-\r
- if (culture == null) {\r
- culture = CultureInfo.CurrentCulture;\r
- }\r
-\r
- parts = ((string)value).Split(culture.TextInfo.ListSeparator.ToCharArray());\r
-\r
- start = (DateTime)TypeDescriptor.GetConverter(typeof(DateTime)).ConvertFromString(context, culture, parts[0]);\r
- end = (DateTime)TypeDescriptor.GetConverter(typeof(DateTime)).ConvertFromString(context, culture, parts[1]);\r
-\r
- return new SelectionRange(start, end);\r
- }
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
- SelectionRange s;\r
-\r
- if ((value == null) || !(value is SelectionRange) || (destinationType != typeof(string))) {\r
- return base.ConvertTo (context, culture, value, destinationType);\r
- }\r
-\r
- if (culture == null) {\r
- culture = CultureInfo.CurrentCulture;\r
- }\r
-\r
- s = (SelectionRange)value;\r
-\r
-\r
- return s.Start.ToShortDateString() + culture.TextInfo.ListSeparator + s.End.ToShortDateString();\r
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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,\r
- 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,
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)
-// Jonathan Chambers (jonathan.chambers@ansys.com)
-//
-
-
-using System;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-
-namespace System.Windows.Forms \r
-{
- [DefaultEvent("SplitterMoved")]
- [Designer("System.Windows.Forms.Design.SplitterDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
- [DefaultProperty("Dock")]
- public class Splitter : Control, IMessageFilter \r
- {
- #region Fields
- private int min_extra;
- private int min_size;
- private int cursor_offset_x;
- private int cursor_offset_y;
-
- private int thickness;
- private bool moving;
- private bool horz;
-
- private SplitterEventHandler on_splitter_moved;
- private SplitterEventHandler on_splitter_moving;
- private SplitterForm drag_form;
-
- private Control adjacent;
- #endregion // Fields
-
- #region Public Constructors
- public Splitter ()
- {
- SetStyle (ControlStyles.StandardClick, true);
- SetStyle (ControlStyles.StandardDoubleClick, true);
- SetStyle (ControlStyles.Selectable, false);
-
- Dock = DockStyle.Left;
- drag_form = new SplitterForm();
- drag_form.FormBorderStyle = FormBorderStyle.None;
- drag_form.MinimumSize = new Size(1,1);
- drag_form.ShowInTaskbar = false;
-
- min_extra = 25;
- min_size = 25;
- }
-
- #endregion // Public Constructors
-
- #region Public Instance Properties
-
- public BorderStyle BorderStyle {
- get { return drag_form.InternalBorderStyle; }
- set { drag_form.InternalBorderStyle = value; }
- }
-
- [DefaultValue(DockStyle.Left)]
- [Localizable(true)]
- public override DockStyle Dock \r
- {
- get { return base.Dock; }
- set \r
- {
- if (value == base.Dock)
- return;
-
- switch (value) \r
- {
- case DockStyle.Bottom:
- case DockStyle.Top:
- horz = true;
- break;
- case DockStyle.Left:
- case DockStyle.Right:
- horz = false;
- break;
- default:
- throw new ArgumentException ("A splitter control must be docked left, right, top, or bottom.");
- }
- base.Dock = value;
- }
- }
-
- [DefaultValue(25)]
- [Localizable(true)]
- public int MinExtra \r
- {
- get { return min_extra; }
- set \r
- {
- if (value < 0)
- value = 0;
- min_extra = value;
- }
- }
-
- [DefaultValue(25)]
- [Localizable(true)]
- public int MinSize \r
- {
- get \r
- {
- return min_size;
- }
- set \r
- {
- if(value < 0)
- value = 0;
- min_size = value;
- }
- }
-
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public int SplitPosition \r
- {
- get \r
- {
- Control adjacent = FindAdjacentControl ();
- if (adjacent == null)
- return -1;
-
- if (horz)
- return adjacent.Width;
- return adjacent.Height;
- }
- set \r
- {
- adjacent = FindAdjacentControl ();
- if (adjacent == null)
- return;
-
- if (horz) \r
- {
- if (adjacent.Height == value)
- return;
- OnSplitterMoved (new SplitterEventArgs (Left, Top, Left, value));
- return;
- }
- if (adjacent.Width == value)
- return;
- OnSplitterMoved (new SplitterEventArgs (adjacent.Width / 2, adjacent.Height / 2, value, Top));
- adjacent = null;
- }
- }
-
- #endregion // Public Instance Properties
-
- #region Protected Instance Properties
- protected override CreateParams CreateParams \r
- {\r
- get \r
- {\r
- return base.CreateParams;\r
- }\r
- }\r
-\r
- protected override ImeMode DefaultImeMode \r
- {\r
- get \r
- {\r
- return base.DefaultImeMode;\r
- }\r
- }\r
-\r
- protected override Size DefaultSize \r
- {
- get \r
- {
- return new Size (3, 3);
- }
- }
-
- #endregion // Protected Instance Properties
-
- #region Public Instance Methods
- [MonoTODO]
- public bool PreFilterMessage(ref Message m) \r
- {
- return false;
- }
- #endregion // Public Instance Methods
-
- #region Protected Instance Methods
- protected override void OnMouseDown (MouseEventArgs e)
- {
- base.OnMouseDown (e);
-
- if (!moving && e.Button == MouseButtons.Left) \r
- {
- adjacent = FindAdjacentControl ();
-
- cursor_offset_x = e.X;
- cursor_offset_y = e.Y;
-
- moving = true;
- Capture = true;
- drag_form.Height = this.Height;
- drag_form.Width = this.Width;
- drag_form.Location = PointToScreen(new Point(0,0));
- drag_form.Show();
- }
- }
-
- protected override void OnMouseMove (MouseEventArgs e)
- {
-
- base.OnMouseMove (e);
- if (moving) \r
- {
-
- Point splitterLocation;
-
- if (horz)
- splitterLocation = new Point(0,e.Y-cursor_offset_y);\r
- else
- splitterLocation = new Point(e.X-cursor_offset_x,0);
-
- drag_form.Location = PointToScreen(splitterLocation);
-
- OnSplitterMoving (new SplitterEventArgs (e.X, e.Y, splitterLocation.X, splitterLocation.Y));
-
- }
- }
-
- protected override void OnMouseUp (MouseEventArgs e)
- {
- base.OnMouseUp (e);
- moving = false;
- Capture = false;
-
- drag_form.Hide();
-
-
- if (horz)\r
- Move (e.X, e.Y-cursor_offset_y);\r
- else
- Move (e.X-cursor_offset_x, e.Y);
-
- OnSplitterMoved(new SplitterEventArgs (e.X, e.Y, Location.X, Location.Y));
- adjacent = null;
- }
-
- protected virtual void OnSplitterMoved (SplitterEventArgs e) \r
- {
- if (on_splitter_moved != null)
- on_splitter_moved (this, e);
- }
-
- protected virtual void OnSplitterMoving (SplitterEventArgs e) \r
- {
- if (on_splitter_moving != null)
- on_splitter_moving (this, e);
- }
-
- protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
- {
- if (horz) \r
- {
- if (height <= 0)
- thickness = 3;
- else
- thickness = height;
- } \r
- else \r
- {
- if (width <= 0)
- thickness = 3;
- else
- thickness = width;
- }
-
- base.SetBoundsCore (x, y, width, height, specified);
- }
-
- #endregion // Protected Instance Methods
-
- #region Internal & Private Methods
-
- private void Move (int x, int y) \r
- {
- if (adjacent == null)
- return;
-
- Point parentPoint = Parent.PointToClient(PointToScreen(new Point(x,y)));
-
- if (horz) \r
- {
- if (adjacent.Height == parentPoint.Y)
- return;\r
-\r
- if (this.Dock == DockStyle.Top)\r
- {\r
- int height = parentPoint.Y - adjacent.Top;\r
- adjacent.SetBounds(adjacent.Left, adjacent.Top, adjacent.Width, height);\r
- }\r
- else if (this.Dock == DockStyle.Bottom)\r
- {\r
- int height = adjacent.Bottom - parentPoint.Y;\r
- adjacent.SetBounds(adjacent.Left, this.Bottom, adjacent.Width, height);\r
- adjacent.Top = this.Bottom; // need this for some reason\r
- }
- return;
- }
-
- if (adjacent.Width == parentPoint.X)
- return;\r
- if (this.Dock == DockStyle.Right)\r
- {\r
- int width = adjacent.Right - parentPoint.X;//parentPoint.X-adjacent.Left;\r
- adjacent.SetBounds(this.Right, adjacent.Top, width, adjacent.Height);\r
- adjacent.Left = this.Right; // need this for some reason\r
- }\r
- else if (this.Dock == DockStyle.Left)\r
- {\r
- int width = parentPoint.X - adjacent.Left;\r
- adjacent.SetBounds(adjacent.Left, adjacent.Top, width, adjacent.Height);\r
- }
- }
-
- private Control FindAdjacentControl () \r
- {
- if (Parent == null)
- return null;
-
- foreach (Control sibling in Parent.Controls) \r
- {
-
- if (!sibling.Visible)
- continue;
-
- switch (Dock) \r
- {
-
- case DockStyle.Left:
- if (sibling.Right == Left)
- return sibling;
- break;
-
- case DockStyle.Right:
- if (sibling.Left == Right)
- return sibling;
- break;
-
- case DockStyle.Top:
- if (sibling.Bottom == Top)
- return sibling;
- break;
-
- case DockStyle.Bottom:
- if (sibling.Top == Bottom)
- return sibling;
- break;
- }
- }
-
- return null;
- }
- #endregion // Internal & Private Methods
-
-
- #region Events
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler BackgroundImageChanged \r
- {
- add { base.BackgroundImageChanged += value; }
- remove { base.BackgroundImageChanged -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler Enter \r
- {
- add { base.Enter += value; }
- remove { base.Enter -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler FontChanged \r
- {
- add { base.FontChanged += value; }
- remove { base.FontChanged -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler ForeColorChanged \r
- {
- add { base.ForeColorChanged += value; }
- remove { base.ForeColorChanged -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler ImeModeChanged \r
- {
- add { base.ImeModeChanged += value; }
- remove { base.ImeModeChanged -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event KeyEventHandler KeyDown \r
- {
- add { base.KeyDown += value; }
- remove { base.KeyDown -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event KeyPressEventHandler KeyPress \r
- {
- add { base.KeyPress += value; }
- remove { base.KeyPress -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event KeyEventHandler KeyUp \r
- {
- add { base.KeyUp += value; }
- remove { base.KeyUp -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler Leave \r
- {
- add { base.Leave += value; }
- remove { base.Leave -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler TabStopChanged \r
- {
- add { base.TabStopChanged += value; }
- remove { base.TabStopChanged -= value; }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new event EventHandler TextChanged \r
- {
- add { base.TextChanged += value; }
- remove { base.TextChanged -= value; }
- }
-
- public event SplitterEventHandler SplitterMoved \r
- {
- add { on_splitter_moved += value; }
- remove { on_splitter_moved -= value; }
- }
-
- public event SplitterEventHandler SplitterMoving \r
- {
- add { on_splitter_moving += value; }
- remove { on_splitter_moving -= value; }
- }
- #endregion
-\r
- #region Private Class\r
- public class SplitterForm : Form
- {\r
- private HatchBrush hatch;
-
- public SplitterForm()\r
- {\r
- SetStyle (ControlStyles.UserPaint, true);
- SetStyle (ControlStyles.AllPaintingInWmPaint, true);\r
-\r
- // TODO: This has to be here, or the form doesn't draw right\r
- this.MinimumSize = new System.Drawing.Size(1, 1);\r
- this.Text = "Form2";\r
-
- hatch = new HatchBrush (HatchStyle.SmallCheckerBoard, Color.White, Color.Black);
- }
-
- 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_TOPMOST;
-
- return cp;
- }
- }\r
-\r
- protected override void OnPaint(PaintEventArgs e)\r
- {
- e.Graphics.FillRectangle (hatch,ClientRectangle);
- base.OnPaint (e);\r
- }\r
-\r
- }\r
- #endregion Private Class\r
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Windows.Forms {
- [ComVisible(true)]
- public class SplitterEventArgs : EventArgs
- {
- #region Private fields
-
- private int split_x;
- private int split_y;
- private readonly int x;
- private readonly 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
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 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;
- Anchor = AnchorStyles.Top | AnchorStyles.Left;
- this.TabStop = false;
- this.SetStyle(ControlStyles.ResizeRedraw, true);
- }
- #endregion // Public Constructors
-
- #region Public Instance Properties
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Color BackColor {
- get { return base.BackColor; }
- set {
- if (value == BackColor)
- return;
- base.BackColor = value;
- if (BackColorChanged != null)
- BackColorChanged (this, EventArgs.Empty);
- Refresh ();
- }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public 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;
- Refresh ();
- }
- }
-
- [Localizable(true)]
- public override Font Font {
- get { return base.Font; }
- set {
- if (value == Font)
- return;
- base.Font = value;
- Refresh ();
- }
- }
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Color ForeColor {
- get { return base.ForeColor; }
- set {
- if (value == ForeColor)
- return;
- if (ForeColorChanged != null)
- ForeColorChanged (this, EventArgs.Empty);
- Refresh ();
- }
- }
-
- [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;
- }
- }
-
- [DefaultValue(true)]
- public bool SizingGrip {
- get { return sizing_grip; }
- set {
- if (sizing_grip == value)
- return;
- sizing_grip = value;
- }
- }
-
- [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;
- Refresh ();
- }
-
- }
-
- #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);
- }
-
- 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;
-
- CalcPanelSizes ();
- }
-
- 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);
- }
-
- private void DoPaint (PaintEventArgs pevent)
- {
- if (Width <= 0 || Height <= 0 || Visible == false)
- return;
-
- CalcPanelSizes ();
- Draw (pevent.Graphics, pevent.ClipRectangle);
- }
-
- private void CalcPanelSizes ()
- {
- if (panels == null || !show_panels)
- return;
-
- if (Width == 0 || Height == 0)
- return;
-
- int gap = ThemeEngine.Current.StatusBarHorzGapWidth;
- int taken = 0;
- ArrayList springs = null;
- 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.Width = (int) (len * 1.5F);
- 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 - ThemeEngine.Current.StatusBarSizeGripWidth;
- for (int i = 0; i < spring_total; i++) {
- StatusBarPanel p = (StatusBarPanel) springs [i];
- p.Width = total_width / spring_total;
- }
- }
-
- 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 virtual bool Contains (StatusBarPanel panel) {
- return panels.Contains (panel);
- }
-
- public virtual IEnumerator GetEnumerator () {
- return panels.GetEnumerator ();
- }
-
- public virtual 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
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- #endregion // Local Variables
-
- #region Constructors
- public StatusBarPanel ()
- {
- }
- #endregion // Constructors
-
- [DefaultValue(HorizontalAlignment.Left)]
- [Localizable(true)]
- public HorizontalAlignment Alignment {
- get { return alignment; }
- set { alignment = value; }
- }
-
- [DefaultValue(StatusBarPanelAutoSize.None)]
- public StatusBarPanelAutoSize AutoSize {
- get { return auto_size; }
- set { auto_size = value; }
- }
-
- [DefaultValue(StatusBarPanelBorderStyle.Sunken)]
- [DispId(-504)]
- public StatusBarPanelBorderStyle BorderStyle {
- get { return border_style; }
- set { border_style = value; }
- }
-
- [DefaultValue(null)]
- [Localizable(true)]
- public Icon Icon {
- get { return icon; }
- set { icon = value; }
- }
-
- [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;
- }
- }
-
- [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;
- }
- }
-
- [DefaultValue(StatusBarPanelStyle.Text)]
- public StatusBarPanelStyle Style {
- get { return style; }
- set { style = value; }
- }
-
- [DefaultValue("")]
- [Localizable(true)]
- public string Text {
- get { return text; }
- set { text = value; }
- }
-
- [DefaultValue("")]
- [Localizable(true)]
- public string ToolTipText {
- get { return tool_tip_text; }
- set { tool_tip_text = value; }
- }
-
- [Browsable(false)]
- public StatusBar Parent {
- get { return parent; }
- }
-
- internal void SetParent (StatusBar parent)
- {
- this.parent = parent;
- }
-
- 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;
- }
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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, true);
- 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 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 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.Prior:
- case Keys.Home:
- 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 {
- if (TabPages [TabCount - 1].TabBounds.Right > ClientRectangle.Right - 40)
- return true;
- return false;
- }
- }
-
- 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 ();
- Refresh ();
- } else {
- Invalidate (right);
- }
- return;
- } else if (left.Contains (e.X, e.Y)) {
- left_slider_state = ButtonState.Pushed;
- if (CanScrollLeft) {
- slider_pos--;
- SizeTabs ();
- Refresh ();
- } 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;
-
- 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)
- {
- if (this.Width <= 0 || this.Height <= 0 || this.Visible == false)
- return;
-
- 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 TabPage.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 ();
- }
- }
- }
- #endregion // Class TabPage.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
- }
-}
-
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
-
- 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 void Add (Control value)
- {
- base.Add (value);
- }
- }
- #endregion // Class TabPageControlCollection
- }
-
-
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 Local Variables
- internal char password_char;
- #endregion // Local Variables
-
- #region Public Constructors
- public TextBox() {
- accepts_return = false;
- password_char = '\u25cf';
- scrollbars = RichTextBoxScrollBars.None;
- alignment = HorizontalAlignment.Left;
- this.LostFocus +=new EventHandler(TextBox_LostFocus);
- this.BackColor = ThemeEngine.Current.ColorWindow;
- this.ForeColor = ThemeEngine.Current.ColorWindowText;
- }
- #endregion // Public Constructors
-
-\r
- #region Private & Internal Methods
- private void TextBox_LostFocus(object sender, EventArgs e) {\r
- has_focus = false;\r
- Invalidate();\r
- }\r
- #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("")]
- public char PasswordChar {
- get {
- return password_char;
- }
-
- set {
- if (value != password_char) {
- password_char = value;
- }
- }
- }
-
- [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 {\r
- get {\r
- return base.SelectionLength;\r
- }\r
- set {\r
- base.SelectionLength = value;\r
- }\r
- }\r
-
-
- 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\r
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-#define Debug
-
-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 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 HScrollBar hscroll;
- internal VScrollBar vscroll;
- internal RichTextBoxScrollBars scrollbars;
- internal bool grabbed;
- internal bool richtext;
- internal int requested_height;
- internal int canvas_width;
- internal int canvas_height;
- internal int track_width = 20;
- #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;
- read_only = false;
- word_wrap = false;
- richtext = false;
- document = new Document(this);
- document.WidthChanged += new EventHandler(document_WidthChanged);
- //document.CaretMoved += new EventHandler(CaretMoved);
- document.Wrap = false;
- requested_height = -1;
-
- 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);
-
- scrollbars = RichTextBoxScrollBars.None;
-
- hscroll = new HScrollBar();
- hscroll.ValueChanged += new EventHandler(hscroll_ValueChanged);
- hscroll.control_style &= ~ControlStyles.Selectable;
- hscroll.Enabled = false;
- hscroll.Visible = false;
-
- vscroll = new VScrollBar();
- vscroll.ValueChanged += new EventHandler(vscroll_ValueChanged);
- vscroll.control_style &= ~ControlStyles.Selectable;
- vscroll.Enabled = false;
- vscroll.Visible = false;
-
- this.Controls.Add(hscroll);
- this.Controls.Add(vscroll);
-
- //SetStyle(ControlStyles.ResizeRedraw, true);
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- SetStyle(ControlStyles.UserPaint, true);
-
- canvas_width = this.Width;
- canvas_height = this.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 != Height) {
- Height = 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 border_style;
- }
-
- set {
- if (value != border_style) {
- border_style = 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 {
- 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;
- } else {
- document.wrap = false;
- }
- }
- }
-
- [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);
- }
- 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;
- 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;
- }
-
- 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) {
- string[] lines;
- int linecount;
-
- // Break the string into separate lines
- lines = text.Split(new char[] {'\n'});
- linecount = lines.Length;
- for (int i = 0; i < linecount; i++) {
- if (lines[i].EndsWith("\r")) {
- lines[i] = lines[i].Substring(0, lines[i].Length - 1);
- }
- }
-
- // Grab the formatting for the last element
- document.MoveCaret(CaretDirection.CtrlEnd);
-
- // Insert the first line
- document.InsertString(document.CaretLine, document.CaretPosition, lines[0]);
-
- for (int i = 1; i < linecount; i++) {
- document.Add(document.CaretLine.LineNo+i, CaseAdjust(lines[i]), alignment, document.CaretTag.font, document.CaretTag.color);
- }
-
- CalculateDocument();
- document.MoveCaret(CaretDirection.CtrlEnd);
- } else {
- document.MoveCaret(CaretDirection.CtrlEnd);
- document.InsertStringAtCaret(text, true);
-//blah Console.WriteLine("TextBox.cs(582) Invalidate called in AppendText");\r
- Invalidate();
- }
- OnTextChanged(EventArgs.Empty);
- }
-
- public void Clear() {
- Text = null;
- }
-
- public void ClearUndo() {
- // FIXME
- throw new NotImplementedException();
- }
-
- public void Copy() {
- // FIXME
- throw new NotImplementedException();
- }
-
- public void Cut() {
- // FIXME
- throw new NotImplementedException();
- }
-
- public void Paste() {
- // FIXME
- throw new NotImplementedException();
- }
-
- public void ScrollToCaret() {
- // FIXME
- throw new NotImplementedException();
- }
-
- 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() {
- StringBuilder sb;
- int i;
- int end;
-
- if (document == null) {
- return String.Empty;
- }
-
- sb = new StringBuilder();
-
- end = document.Lines;
-
- for (i = 1; i < end; i++) {
- sb.Append(document.GetLine(i).text.ToString() + "\n");
- }
-
- return sb.ToString();
- }
-
- public void Undo() {
- return;
- }
- #endregion // Public Instance Methods
-
- #region Protected Instance Methods
- protected override void CreateHandle() {
- base.CreateHandle ();
- }
-
- protected override bool IsInputKey(Keys keyData) {
- switch (keyData) {
-#if not
- // We handle Enter in ProcessDialogKey
- case Keys.Enter: {
- if (multiline && (accepts_return || ((keyData & Keys.Control) != 0))) {
- return true;
- }
- return false;
- }
-#endif
-
- case Keys.Tab: {
- if (accepts_tab) {
- return true;
- }
- return false;
- }
- }
- 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 != 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) {
- switch (keyData & Keys.KeyCode) {
- case Keys.Left: {
- document.SetSelectionToCaret(true);
-
- if ((Control.ModifierKeys & Keys.Control) != 0) {
- document.MoveCaret(CaretDirection.WordBack);
- } else {
- document.MoveCaret(CaretDirection.CharBack);
- }
- CaretMoved(this, null);
- return true;
- }
-
- case Keys.Right: {
- document.SetSelectionToCaret(true);
-
- if ((Control.ModifierKeys & Keys.Control) != 0) {
- document.MoveCaret(CaretDirection.WordForward);
- } else {
- document.MoveCaret(CaretDirection.CharForward);
- }
- CaretMoved(this, null);
- return true;
- }
-
- case Keys.Up: {
- document.SetSelectionToCaret(true);
- document.MoveCaret(CaretDirection.LineUp);
- CaretMoved(this, null);
- return true;
- }
-
- case Keys.Down: {
- document.SetSelectionToCaret(true);
- document.MoveCaret(CaretDirection.LineDown);
- CaretMoved(this, null);
- return true;
- }
-
- case Keys.Home: {
- document.SetSelectionToCaret(true);
-
- if ((Control.ModifierKeys & Keys.Control) != 0) {
- document.MoveCaret(CaretDirection.CtrlHome);
- } else {
- document.MoveCaret(CaretDirection.Home);
- }
- CaretMoved(this, null);
- return true;
- }
-
- case Keys.End: {
- document.SetSelectionToCaret(true);
-
- if ((Control.ModifierKeys & Keys.Control) != 0) {
- document.MoveCaret(CaretDirection.CtrlEnd);
- } else {
- document.MoveCaret(CaretDirection.End);
- }
- CaretMoved(this, null);
- return true;
- }
-
- case Keys.Enter: {
- if (!read_only && multiline && (accepts_return || ((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) {
- 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 {
- document.DeleteChar(document.CaretTag, document.CaretPosition, false);
- document.MoveCaret(CaretDirection.CharBack);
- OnTextChanged(EventArgs.Empty);
- }
- CaretMoved(this, null);
- return true;
- }
-
- case Keys.Delete: {
- if (read_only) {
- break;
- }
-
- // delete 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);
- OnTextChanged(EventArgs.Empty);
-
- #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 {
- document.DeleteChar(document.CaretTag, document.CaretPosition, true);
- OnTextChanged(EventArgs.Empty);
- }
- document.AlignCaret();
- document.UpdateCaret();
- CaretMoved(this, null);
- return true;
- }
- }
- return base.ProcessDialogKey (keyData);
- }
-
- 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();
-Console.WriteLine("Creating caret");
- base.WndProc(ref m);
- return;
- }
-
- case Msg.WM_KILLFOCUS: {
- // Kill caret
- document.CaretLostFocus();
-Console.WriteLine("Destroying caret");
- base.WndProc(ref m);
- return;
- }
-
- case Msg.WM_CHAR: {
- if (ProcessKeyEventArgs(ref m)) {
- return;
- }
-
- if (PreProcessMessage(ref m)) {
- return;
- }
-
- if (ProcessKeyMessage(ref m)) {
- return;
- }
-
- 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: {
- document.InsertCharAtCaret((char)m.WParam, true);
- OnTextChanged(EventArgs.Empty);
- CaretMoved(this, null);
- return;
- }
-
- case CharacterCasing.Lower: {
- document.InsertCharAtCaret(Char.ToLower((char)m.WParam), true);
- OnTextChanged(EventArgs.Empty);
- CaretMoved(this, null);
- return;
- }
-
- case CharacterCasing.Upper: {
- document.InsertCharAtCaret(Char.ToUpper((char)m.WParam), true);
- OnTextChanged(EventArgs.Empty);
- CaretMoved(this, null);
- return;
- }
- }
- }
- DefWndProc(ref m);
- 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;
- #endregion // Events
-
- #region Private Methods
- internal Document Document {
- get {
- return document;
- }
-
- set {
- document = value;
- }
- }
-
-static int current;
-
- private void PaintControl(PaintEventArgs pevent) {
- // Fill background
- pevent.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), pevent.ClipRectangle);
- pevent.Graphics.TextRenderingHint=TextRenderingHint.AntiAlias;
-//blah Console.WriteLine("Redrawing {0}", pevent.ClipRectangle);
- // 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.ColorButtonShadow), 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) {
- LineTag tag;
- Line line;
- int pos;
-
- if (e.Button == MouseButtons.Left) {
- document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
- document.SetSelectionToCaret(true);
- this.grabbed = true;
- this.Capture = true;
- return;
- }
-
- #if Debug
- 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;
- this.grabbed = false;
- if (e.Button == MouseButtons.Left) {
- document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
- document.SetSelectionToCaret(false);
- document.DisplayCaret();
- return;
- }
- }
- #endregion // Private Methods
-
-
- private void TextBoxBase_SizeChanged(object sender, EventArgs e) {
- canvas_width = this.Width;
- canvas_height = this.Height;
- // We always move them, they just might not be displayed
- hscroll.Bounds = new Rectangle (ClientRectangle.Left, ClientRectangle.Bottom - hscroll.Height, Width, hscroll.Height);
- vscroll.Bounds = new Rectangle (ClientRectangle.Right - vscroll.Width, ClientRectangle.Top, vscroll.Width, Height);
-
- }
-
- protected void CalculateDocument() {
- document.RecalculateDocument(CreateGraphics());
- CalculateScrollBars();
-//blah Console.WriteLine("TextBox.cs(1175) Invalidate called in CalculateDocument");\r
- Invalidate(); // FIXME - do we need this?
- }
-
- protected void CalculateScrollBars() {
- // FIXME - need separate calculations for center and right alignment
- // No scrollbars for a single line
- if (document.Width >= this.Width) {
- hscroll.Enabled = true;
- hscroll.Minimum = 0;
- hscroll.Maximum = document.Width - this.Width;
- } else {
- hscroll.Maximum = document.ViewPortWidth;
- hscroll.Enabled = false;
- }
-
- if (document.Height >= this.Height) {
- vscroll.Enabled = true;
- vscroll.Minimum = 0;
- vscroll.Maximum = document.Height - this.Height;
- } else {
- vscroll.Maximum = document.ViewPortHeight;
- vscroll.Enabled = false;
- }
-
-
- if (!multiline) {
- return;
- }
-
- 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 = this.Height - hscroll.Height;
- }
-
- if (vscroll.Visible) {
- hscroll.Maximum += vscroll.Width * 2;
- canvas_width = this.Width - vscroll.Width * 2;
- }
- }
-
- private void document_WidthChanged(object sender, EventArgs e) {\r
- CalculateScrollBars();\r
- }\r
-
- 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();
- //Console.WriteLine("Dude scrolled horizontal");
- }
-
- private void vscroll_ValueChanged(object sender, EventArgs e) {\r
- XplatUI.ScrollWindow(this.Handle, 0, document.ViewPortY-this.vscroll.Value, false);
- document.ViewPortY = this.vscroll.Value;
- document.UpdateCaret();
- //Console.WriteLine("Dude scrolled vertical");
- }\r
-
- private void TextBoxBase_MouseMove(object sender, MouseEventArgs e) {
- // FIXME - handle auto-scrolling if mouse is to the right/left of the window
- if (grabbed) {
- document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
- document.SetSelectionToCaret(false);
- document.DisplayCaret();
- }
- }
-
- 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();
- }
- }\r
-\r
- /// <summary>Ensure the caret is always visible</summary>\r
- internal void CaretMoved(object sender, EventArgs e) {\r
- Point pos;\r
- int height;\r
- \r
- pos = document.Caret;\r
- //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);\r
-\r
- // Handle horizontal scrolling\r
- if (document.CaretLine.alignment == HorizontalAlignment.Left) {\r
- if (pos.X < (document.ViewPortX + track_width)) {\r
- do {\r
- if ((hscroll.Value - track_width) >= hscroll.Minimum) {\r
- hscroll.Value -= track_width;\r
- } else {\r
- hscroll.Value = hscroll.Minimum;\r
- }\r
- } while (hscroll.Value > pos.X);\r
- }\r
-\r
- if ((pos.X > (this.canvas_width + document.ViewPortX - track_width)) && (hscroll.Value != hscroll.Maximum)) {\r
- do {\r
- if ((hscroll.Value + track_width) <= hscroll.Maximum) {\r
- hscroll.Value += track_width;\r
- } else {\r
- hscroll.Value = hscroll.Maximum;\r
- }\r
- } while (pos.X > (hscroll.Value + this.canvas_width));\r
- }\r
- } else if (document.CaretLine.alignment == HorizontalAlignment.Right) {\r
- if (pos.X < document.ViewPortX) {\r
- if (pos.X > hscroll.Minimum) {\r
- hscroll.Value = pos.X;\r
- } else {\r
- hscroll.Value = hscroll.Minimum;\r
- }\r
- }\r
-\r
- if ((pos.X > (this.canvas_width + document.ViewPortX)) && (hscroll.Value != hscroll.Maximum)) {\r
- hscroll.Value = hscroll.Maximum;\r
- }\r
- } else {\r
- }\r
-\r
- if (!multiline) {\r
- return;\r
- }\r
-\r
- // Handle vertical scrolling\r
- height = document.CaretLine.Height;\r
-\r
- if (pos.Y < document.ViewPortY) {\r
- vscroll.Value = pos.Y;\r
- }\r
-\r
- if ((pos.Y + height) > (document.ViewPortY + canvas_height)) {\r
- vscroll.Value = pos.Y - canvas_height + height;\r
- }\r
- }\r
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-// - Finish selection calculations (invalidate only changed, more ways to select)
-// - Implement C&P
-
-
-// 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 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)
- }
-
- // 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
-
-
- // 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 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>
- /// 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;
- widths[0] = 0;
- 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);
-
- w = size.Width;
-
- if (Char.IsWhiteSpace(text[pos])) {
- wrap_pos = pos + 1;
- wrap_width = tag.width + w;
- }
-
- if (doc.wrap) {
- if ((widths[pos] + w) + 27 > doc.viewport_width) {
- 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 = 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
- internal struct Marker {
- internal Line line;
- internal LineTag tag;
- internal int pos;
- internal int height;
- }
- #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 bool multiline;
- internal bool wrap;
-
- internal Marker caret;
- internal Marker selection_start;
- internal Marker selection_end;
- internal bool selection_visible;
- internal Marker selection_anchor;
- 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;
-
- // Tree related stuff
- sentinel = new Line();
- sentinel.color = LineColor.Black;
-
- document = sentinel;
- last_found = sentinel;
-
- // We always have a blank line
- Add(1, "", owner.Font, new SolidBrush(owner.ForeColor));
- this.RecalculateDocument(owner.CreateGraphics());
- PositionCaret(0, 0);
- lines=1;
-
- selection_visible = false;
- selection_start.line = this.document;
- selection_start.pos = 0;
- selection_end.line = this.document;
- selection_end.pos = 0;
-
- viewport_x = 0;
- viewport_y = -2;
-
- 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 int ViewPortX {
- get {
- return viewport_x;
- }
-
- set {
- viewport_x = value;
- }
- }
-
- 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 Wrap {
- get {
- return wrap;
- }
-
- set {
- wrap = value;
- // FIXME - force recalc/redisplay
- }
- }
-
- #endregion // Internal Properties
-
- #region Private Methods
- // For debugging
- internal void DumpTree(Line line, bool with_tags) {
- 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;
-
- tag = line.tags;
- count = 1;
- Console.Write(" Tags: ");
- while (tag != null) {
- Console.Write("{0} <{1}>-<{2}> ", count++, tag.start, 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(", ");
- }
- }
- Console.WriteLine("");
- }
- if (line.left != null) {
- if (line.left != sentinel) {
- 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) {
- DumpTree(line.right, with_tags);
- }
- } else {
- if (line != sentinel) {
- throw new Exception("Right should not be NULL");
- }
- }
- }
-
- 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 (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
-//blah Console.WriteLine("TextControl.cs(961) Invalidate called in UpdateView(line, 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(965) Invalidate called in UpdateView(line, pos)");
- owner.Invalidate();
- }
- } else {
-//blah Console.WriteLine("TextControl.cs(969) Invalidate called in UpdateView(line, pos)");
- 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, new SolidBrush(owner.ForeColor));
- this.RecalculateDocument(owner.CreateGraphics());
- PositionCaret(0, 0);
-
- selection_visible = false;
- selection_start.line = this.document;
- selection_start.pos = 0;
- selection_end.line = this.document;
- selection_end.pos = 0;
-
- viewport_x = 0;
- viewport_y = 0;
-
- document_x = 0;
- document_y = 0;
- }
-
- internal void PositionCaret(Line line, int pos) {
- 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) {
- 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) {
- 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() {
- 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() {
- 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) {
- 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.ToString(caret.pos, 1) != " ")) {
- caret.pos++;
- }
- if (caret.pos < len) {
- // Skip any whitespace
- while ((caret.pos < len) && (caret.line.text.ToString(caret.pos, 1) == " ")) {
- 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.ToString(caret.pos, 1) == " ")) {
- caret.pos--;
- }
-
- while ((caret.pos > 0) && (caret.line.text.ToString(caret.pos, 1) != " ")) {
- 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;
- }
- }
- }
-
- // 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
- //string s; // String representing the current line
- int line_no; //
- 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
-
- hilight = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorHilight);
- hilight_text = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorHilightText);
-
- while (line_no <= end) {
- line = GetLine(line_no);
- tag = line.tags;
- //s = line.text.ToString();
- while (tag != null) {
- 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);
- g.DrawString(line.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
- line.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
- line.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
- line.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
- line.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
- line.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
- line.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
- line.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
- line.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
- line.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
- line.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
-
- }
-
-
- // 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;
-
- 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;
-
- 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;
-
- 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;
-
- 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();
- }
- }
-
- // Inserts 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;
-
- 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 -= pos - tag.start + 1;
- tag.length -= pos - tag.start + 1;
-
- tag = tag.next;
- while ((tag != null) && (left > 0)) {
- 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;
- }
- }
-
- 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;
-
- 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;
-
- move_caret = false;
-
- // Adjust selection and cursors
- if (soft && (caret.line == line) && (caret.pos >= pos)) {
- move_caret = true;
- }
-
- // cover the easy case first
- if (pos == line.text.Length) {
- Add(line.line_no + 1, "", line.alignment, tag.font, tag.color);
- if (soft) {
- if (move_caret) {
- caret.line = GetLine(line.line_no + 1);
- caret.line.soft_break = true;
- caret.tag = selection_start.line.tags;
- caret.pos = 0;
- } else {
- GetLine(line.line_no + 1).soft_break = true;
- }
- }
- 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;
-
- 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;
- }
-
- 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;
-
- 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) {
- if (LineNo>lines) {
- return;
- }
-
- Delete(GetLine(LineNo));
- }
-
- 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;
- }
-
- 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;
- }
-
- // 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 - viewport_y));
- }
-
- // 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));
- }
-
-
- 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.line != caret.line) || (selection_start.pos != caret.pos)) {
- this.Invalidate(selection_start.line, selection_start.pos, caret.line, caret.pos);
- }
- } else {
- if ((selection_end.line != caret.line) || (selection_end.pos != caret.pos)) {
- this.Invalidate(selection_end.line, selection_end.pos, caret.line, caret.pos);
- }
- }
-
- if ((caret.line.line_no < selection_anchor.line.line_no) || ((caret.line == selection_anchor.line) && (caret.pos <= selection_anchor.pos))) {
- 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.line == selection_end.line) && (selection_start.pos == selection_end.pos)) {
- 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) {
- // The easiest is to break the lines where the selection tags are and delete those lines
- if ((selection_start.pos == selection_end.pos) && (selection_start.line == selection_end.line)) {
- // Nothing to delete, simply insert
- InsertString(selection_start.tag, selection_start.pos, s);
- }
-
- if (!multiline || (selection_start.line == selection_end.line)) {
- 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);
-
- InsertString(selection_start.tag, selection_start.pos, s);
- } else {
- int i;
- int start;
- int end;
- int base_line;
- string[] ins;
- int insert_lines;
-
- start = selection_start.line.line_no;
- end = selection_end.line.line_no;
-
- // Delete first line
- DeleteChars(selection_start.tag, selection_start.pos, selection_start.line.text.Length - selection_start.pos);
-
- start++;
- if (start < end) {
- for (i = end - 1; i >= start; i--) {
- Delete(i);
- }
- }
-
- // Delete last line
- DeleteChars(selection_end.line.tags, 0, selection_end.pos);
-
- 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(selection_start.line, selection_start.pos);
-
- // Reminder of start line is now in startline+1
-
- // if the last line does not end with a \n we will insert the last line in front of the just moved text
- if (s.EndsWith("\n")) {
- insert_lines--; // We don't want to insert the last line as part of the loop anymore
-
- InsertString(GetLine(selection_start.line.line_no + 1), 0, ins[insert_lines - 1]);
- }
- }
-
- // Insert the first line
- InsertString(selection_start.line, selection_start.pos, ins[0]);
-
- if (insert_lines > 1) {
- base_line = selection_start.line.line_no + 1;
-
- for (i = 1; i < insert_lines; i++) {
- Add(base_line + i, ins[i], selection_start.line.alignment, selection_start.tag.font, selection_start.tag.color);
- }
- }
- }
- selection_end.line = selection_start.line;
- selection_end.pos = selection_start.pos;
- selection_end.tag = selection_start.tag;
- selection_visible = false;
- PositionCaret(selection_start.line, selection_start.pos);
- InvalidateSelectionArea();
- }
-
- 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
- LineTag.FormatText(start_line, start_pos, start_line.text.Length - start_pos + 1, font, color);
-
- // Format last line
- if (end_line != start_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);
- }
- }
-
- 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 (!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;
- }
- }
-
- 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 bool SetCursor(int x, int y) {
- return true;
- }
-
- internal int Size() {
- return lines;
- }
- #endregion // Internal Methods
-
- #region Events
- internal event EventHandler CaretMoved;
- internal event EventHandler WidthChanged;
- internal event EventHandler HeightChanged;
- #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;
- }
-
- start_tag = FindTag(line, start);
-
- tag = new LineTag(line, start, length);
- tag.font = font;
- tag.color = color;
-
- if (start == 1) {
- line.tags = tag;
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Collections;
-
-namespace System.Windows.Forms
-{
-
-
- // Implements a pool of system resources
- internal class SystemResPool
- {
- private Hashtable pens = new Hashtable ();
- private Hashtable solidbrushes = new Hashtable ();
- private Hashtable hatchbrushes = 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;
- }
-
- }
-
- internal abstract class Theme
- {
- protected Array syscolors;
- protected Font default_font;
- protected Color defaultWindowBackColor;
- protected Color defaultWindowForeColor;
- internal SystemResPool ResPool = new SystemResPool ();
-
- /* OS Feature support */
- public abstract Version Version {
- get;
- }
-
- /* Default properties */
- public virtual Color ColorScrollbar {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_SCROLLBAR);}
- }
-
- public virtual Color ColorBackground {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BACKGROUND);}
- }
-
- public virtual Color ColorActiveTitle {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_ACTIVECAPTION);}
- }
-
- public virtual Color ColorInactiveTitle {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTION);}
- }
-
- public virtual Color ColorMenu {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_MENU);}
- }
-
- public virtual Color ColorWindow {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_WINDOW);}
- }
-
- public virtual Color ColorWindowFrame {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_WINDOWFRAME);}
- }
-
- public virtual Color ColorMenuText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_MENUTEXT);}
- }
-
- public virtual Color ColorWindowText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_WINDOWTEXT);}
- }
-
- public virtual Color ColorTitleText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_CAPTIONTEXT);}
- }
-
- public virtual Color ColorActiveBorder {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_ACTIVEBORDER);}
- }
-
- public virtual Color ColorInactiveBorder{
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INACTIVEBORDER);}
- }
-
- public virtual Color ColorAppWorkSpace {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_APPWORKSPACE);}
- }
-
- public virtual Color ColorHilight {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHT);}
- }
-
- public virtual Color ColorHilightText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHTTEXT);}
- }
-
- public virtual Color ColorButtonFace {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNFACE);}
- }
-
- public virtual Color ColorButtonShadow {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNSHADOW);}
- }
-
- public virtual Color ColorGrayText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_GRAYTEXT);}
- }
-
- public virtual Color ColorButtonText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNTEXT);}
- }
-
- public virtual Color ColorInactiveTitleText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTIONTEXT);}
- }
-
- public virtual Color ColorButtonHilight {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNHIGHLIGHT);}
- }
-
- public virtual Color ColorButtonDkShadow {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_3DDKSHADOW);}
- }
-
- public virtual Color ColorButtonLight {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_3DLIGHT);}
- }
-
- public virtual Color ColorInfoText {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INFOTEXT);}
- }
-
- public virtual Color ColorInfoWindow {
- get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INFOBK);}
- }
-
- public virtual Color DefaultControlBackColor {
- get { return ColorButtonFace; }
- }
-
- public virtual Color DefaultControlForeColor {
- get { return ColorButtonText; }
- }
-
- 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;
- }
- }
- #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 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 DrawListBoxDecorations (Graphics dc, ListBox ctrl);
- public abstract void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e);
-
- // Sizing
- public abstract int DrawListBoxDecorationTop (BorderStyle border_style);
- public abstract int DrawListBoxDecorationBottom (BorderStyle border_style);
- public abstract int DrawListBoxDecorationRight (BorderStyle border_style);
- public abstract int DrawListBoxDecorationLeft (BorderStyle border_style);
- #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, MenuAPI.MENUITEM item, int y, int x, bool menuBar);
- public abstract void CalcPopupMenuSize (Graphics dc, IntPtr hMenu);
- public abstract int CalcMenuBarSize (Graphics dc, IntPtr hMenu, int width);
- public abstract void DrawMenuBar (Graphics dc, IntPtr hMenu, Rectangle rect);
- public abstract void DrawMenuItem (MenuItem item, DrawItemEventArgs e);
- public abstract void DrawPopupMenu (Graphics dc, IntPtr hMenu, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- theme = new ThemeWin32Classic ();
- }
-
-
- public static Theme Current {
- get { return theme; }
- }
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-//
-// 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 no a device context. We should inverstigate if we
-// we can encapsulate a dc in a gtkwindow.
-//
-
-
-// NOT COMPLETE
-
-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_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);
-
- /* 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);
-
- /* Data */
- static protected IntPtr dispmgr;
- static protected IntPtr gdkdisplay;
- static protected IntPtr widget;
- static protected IntPtr style;
- static protected SolidBrush br_buttonface;
- static protected SolidBrush br_buttontext;
-
- 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 ();
-
- br_buttonface = new SolidBrush (defaultWindowBackColor);
- br_buttontext = new SolidBrush (defaultWindowForeColor);
- }
-
- public override bool DoubleBufferingSupported {
- get {return false; }
- }
-
-
- public void DrawScrollButton (Graphics dc, Rectangle area, ScrollButton type, ButtonState state,
- IntPtr gdkwindow, IntPtr style)
- {
- ArrowType arrow_type = 0;
-
- gtk_paint_box (style,
- gdkwindow,
- (int) StateType.Normal,
- (int) ShadowType.Out,
- IntPtr.Zero,
- IntPtr.Zero,
- "trough",
- area.X, area.Y,
- area.Width, area.Height);
-
- /* Calc arrows coordinates */
- switch (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;
- }
-
-
- gtk_paint_arrow (style,
- gdkwindow,
- (int) StateType.Normal,
- (int) ShadowType.In,
- IntPtr.Zero,
- IntPtr.Zero,
- "",
- (int) arrow_type, true,
- area.X + ((area.Width - (area.Width/2) ) / 2),
- area.Y + ((area.Height - (area.Height/2) ) / 2),
- area.Width / 2, area.Height / 2);
-
- }
-#if updated
- public override 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)
- {
- IntPtr gdkwindow = gdk_window_foreign_new_for_display (gdkdisplay, (uint) bar.Handle);
- IntPtr adj = gtk_adjustment_new (0, 0, 0, 0, 0, 0);
- IntPtr scrollbar = gtk_vscrollbar_new (adj);
- IntPtr style;
-
- style = gtk_rc_get_style (scrollbar);
- style = gtk_style_attach (style, gdkwindow); // need it
-
- /* Background */
- gtk_paint_box (style,
- gdkwindow,
- (int) StateType.Active,
- (int) ShadowType.In,
- IntPtr.Zero,
- IntPtr.Zero,
- "trough",
- area.X, area.Y,
- area.Width, area.Height);
-
- /* See gtk_range_expose */
- first_arrow_area.X = first_arrow_area. Y = 0;
- first_arrow_area.Width = scrollbutton_width;
- first_arrow_area.Height = scrollbutton_height;
-
- if (vert) {
-
- second_arrow_area.X = 0;
- second_arrow_area.Y = area.Height - scrollbutton_height;
- second_arrow_area.Width = scrollbutton_width;
- second_arrow_area.Height = scrollbutton_height;
-
- /* First button*/
- DrawScrollButton (dc, first_arrow_area, ScrollButton.Up, first_arrow,
- gdkwindow, style);
-
- /* Second button*/
- DrawScrollButton (dc, second_arrow_area, ScrollButton.Down, second_arrow,
- gdkwindow, style);
-
- } else {
-
- second_arrow_area.Y = 0;
- second_arrow_area.X = area.Width - scrollbutton_width;
- second_arrow_area.Width = scrollbutton_width;
- second_arrow_area.Height = scrollbutton_height;
-
- /* First button*/
- DrawScrollButton (dc, first_arrow_area, ScrollButton.Left, first_arrow,
- gdkwindow, style);
-
- /* Second button*/
- DrawScrollButton (dc, second_arrow_area, ScrollButton.Right, second_arrow,
- gdkwindow, style);
-
- }
-
- /* Slider */
- gtk_paint_slider (style,
- gdkwindow,
- (int) StateType.Normal,
- (int) ShadowType.Out,
- IntPtr.Zero,
- IntPtr.Zero,
- "",
- thumb_pos.X, thumb_pos.Y,
- thumb_pos.Width, thumb_pos.Height,
- (int) Orientation.Vertical);
-
- //gtk_style_detach (style);
- }
-#endif
-
- private static Color ColorFromGdkColor (GdkColorStruct gtkcolor)
- {
- return Color.FromArgb (255,
- (gtkcolor.red >> 8) & 0xff,
- (gtkcolor.green >> 8) & 0xff,
- (gtkcolor.blue >> 8) & 0xff );
- }
-
- } //class
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 : Theme
- {
- public override Version Version
- {
- get {
- return new Version( 0, 1, 0, 0 );
- }
- }
-
- /* Default colors for Win32 classic theme */
- uint [] theme_colors = { /* AARRGGBB */
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_SCROLLBAR, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BACKGROUND, 0xff008080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_ACTIVECAPTION, 0xff000080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTION, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENU, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOW, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOWFRAME, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENUTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOWTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_CAPTIONTEXT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_ACTIVEBORDER, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVEBORDER, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_APPWORKSPACE, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHT, 0xff000080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHTTEXT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNFACE, 0xffefebe7, //0xffe7e8ec, //0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNSHADOW, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_GRAYTEXT, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTIONTEXT, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNHIGHLIGHT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_3DDKSHADOW, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_3DLIGHT, 0xffe0e0e0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INFOTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INFOBK, 0xffffffff,
-
- };
-
- /* Hardcoded colour values not exposed in the API constants in all configurations */
- static readonly Color arrow_color = Color.Black;
- static readonly Color pen_ticks_color = Color.Black;
- static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
-
- 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 uint uifc = 0xff00c0ff;
-// static readonly Color xFocusColor = Color.FromArgb( (int)uifc );
- static readonly Color LightColor = Color.LightGray;
- static readonly Color BorderColor = MouseOverColor;
- static readonly Color NiceBackColor = Color.FromArgb( System.Convert.ToInt32( "0xffefebe7", 16 ) );
-
- static StringFormat string_format_menu_text;
- static StringFormat string_format_menu_shortcut;
- 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 ThemeNice( )
- {
- /* Init Default colour array*/
- syscolors = Array.CreateInstance( typeof (Color), (uint) XplatUIWin32.GetSysColorIndex.COLOR_MAXVALUE + 1 );
-
- for ( int i = 0; i < theme_colors.Length; i += 2 )
- syscolors.SetValue( Color.FromArgb( (int)theme_colors[ i + 1 ] ), (int) theme_colors[ i ] );
-
- defaultWindowBackColor = SystemColors.Window;
- defaultWindowForeColor = ColorButtonText;
- 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;
- }
-
- public override void ResetDefaults( )
- {
- throw new NotImplementedException( "Need to implement ResetDefaults() for Nice 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( ColorButtonFace );
- return new SolidBrush( c );
- }
-
- protected SolidBrush GetControlForeBrush( Color c )
- {
- if ( c == DefaultControlForeColor )
- return ResPool.GetSolidBrush( ColorButtonText );
- return new SolidBrush( 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 )
- {
- int width;
- int height;
- Rectangle buttonRectangle;
- //Rectangle borderRectangle;
-
- width = button.ClientSize.Width;
- height = button.ClientSize.Height;
-
- dc.FillRectangle( ResPool.GetSolidBrush( button.BackColor ), button.ClientRectangle );
-
- // set up the button rectangle
- buttonRectangle = button.ClientRectangle;
-
- Color use_color;
-
- 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, -2, -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, Color.White );
- else
- lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, height - 1 ), Color.White, use_color );
- dc.FillRectangle( lgbr, lgbRectangle );
- lgbr.Dispose( );
-
- Pen pen = ResPool.GetPen( BorderColor );
- dc.DrawLine( pen, 3, 0, width - 4, 0 );
- dc.DrawLine( pen, width - 1, 3, width - 1, height - 4 );
- dc.DrawLine( pen, 3, height - 1, width - 4, height - 1 );
- dc.DrawLine( pen, 0, 3, 0, height - 4 );
-
- dc.DrawCurve( pen, new Point[] { new Point( 0, 4 ), new Point( 4, 0 ) } );
- dc.DrawCurve( pen, new Point[] { new Point( 0, height - 4 ), new Point( 4, height ) } );
- dc.DrawCurve( pen, new Point[] { new Point( width - 4, 0 ), new Point( width, 4 ) } );
- dc.DrawCurve( pen, new Point[] { new Point( width, height - 4 ), new Point( width - 4, height ) } );
- }
-
- // Image
- if ( ( button.image != null ) || ( button.image_list != null ) )
- {
- // Need to draw a picture
- Image i;
- int image_x;
- int image_y;
- int image_width;
- int image_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, ColorButtonFace );
- }
- }
-
- // Focus
- if ( ( button.has_focus && button.flat_style != FlatStyle.Popup ) && button.is_enabled )
- {
- Pen pen = ResPool.GetPen( FocusColor );
- dc.DrawLine( pen, 4, 1, width - 5, 1 );
- dc.DrawLine( pen, width - 2, 4, width - 2, height - 5 );
- dc.DrawLine( pen, 4, height - 2, width - 5, height - 2 );
- dc.DrawLine( pen, 1, 4, 1, height - 5 );
-
- dc.DrawCurve( pen, new Point[] { new Point( 1, 5 ), new Point( 5, 1 ) } );
- dc.DrawCurve( pen, new Point[] { new Point( 1, height - 5 ), new Point( 5, height - 1 ) } );
- dc.DrawCurve( pen, new Point[] { new Point( width - 5, 1 ), new Point( width - 1, 5 ) } );
- dc.DrawCurve( pen, new Point[] { new Point( width - 1, height - 5 ), new Point( width - 5, height - 1 ) } );
- }
-
- // Text, draw only if type is Button
- if ( button.text != null && button.text != String.Empty && button.GetType( ) == typeof( Button ) )
- {
- 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.ColorButtonFace ) ), text_rect, button.text_format );
- }
- else
- {
- CPDrawStringDisabled( dc, button.text, button.Font, ColorButtonText, text_rect, button.text_format );
- }
- }
- }
- }
-
- 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;
- SolidBrush sb;
- 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
-
- 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 );
- }
- }
-
- // 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.ColorButtonFace ) ), text_rectangle, text_format );
- }
- else
- {
- CPDrawStringDisabled( dc, checkbox.Text, checkbox.Font, ColorButtonText, text_rectangle, text_format );
- }
-
- if ( checkbox.Focused )
- {
- if ( checkbox.appearance != Appearance.Button )
- 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
- private 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, ColorButtonShadow, 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.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
- }
- 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.DrawRectangle( ResPool.GetPen( BorderColor ) , cl.X + 1, cl.Y + 1, cl.Width - 3, cl.Height - 3 );
- }
-
- // 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( 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.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
- }
- 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 );
- }
- }
-
- #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 DataGridBackgroundColor
- { get { return ColorAppWorkSpace;} }
- public override Color DataGridCaptionBackColor
- { get { return ColorActiveTitle;} }
- public override Color DataGridCaptionForeColor
- { get { return SystemColors.ActiveCaptionText;} }
- public override Color DataGridGridLineColor
- { get { return SystemColors.Control;} }
- public override Color DataGridHeaderBackColor
- { get { return SystemColors.Control;} }
- public override Color DataGridHeaderForeColor
- { get { return SystemColors.ControlText;} }
- public override Color DataGridLinkColor
- { get { return SystemColors.HotTrack;} }
- public override Color DataGridLinkHoverColor
- { get { return SystemColors.HotTrack;} }
- public override Color DataGridParentRowsBackColor
- { get { return SystemColors.Control;} }
- public override Color DataGridParentRowsForeColor
- { get { return SystemColors.WindowText;} }
- public override Color DataGridSelectionBackColor
- { get { return ColorActiveTitle;} }
- public override Color DataGridSelectionForeColor
- { get { return ColorTitleText;} }
-
- 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.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width - grid.horiz_scrollbar.Height,
- grid.grid_drawing.client_area.Y + grid.grid_drawing.client_area.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 );
- }
- }
-
- ThemeEngine.Current.CPDrawBorderStyle( pe.Graphics, grid.ClientRectangle, grid.border_style );
- }
-
- 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 prev_clip = g.Clip, current_clip;
- rect_columnhdr.Y = columns_area.Y;
- rect_columnhdr.Height = columns_area.Height;
-
- 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;
-
- current_clip = new Region( columns_area );
- g.Clip = current_clip;
-
- grid.CurrentTableStyle.GridColumnStyles[ column ].PaintHeader( g, rect_columnhdr, column );
-
- g.Clip = prev_clip;
- current_clip.Dispose( );
- }
-
-
- // This fills with background colour the unused part in the row headers
- if ( rect_columnhdr.X + rect_columnhdr.Height < grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width )
- {
-
- Rectangle not_usedarea = columnshdrs_area_complete;
- not_usedarea.X = rect_columnhdr.X + rect_columnhdr.Width;
- not_usedarea.Width = grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.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++;
- }
-
- 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;
- }
- }
-
- // 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
- Pen pen = ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight );
- g.DrawLine( pen, bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y );
- g.DrawLine( pen, bounds.X, bounds.Y + 1, bounds.X, bounds.Y + bounds.Height - 1 );
-
- pen = ResPool.GetPen( ThemeEngine.Current.ColorButtonShadow );
- g.DrawLine( pen, bounds.X + bounds.Width - 1, bounds.Y + 1 , bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1 );
- g.DrawLine( pen, 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.ColorHilight ), 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 );
- }
- }
-
- #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 );
- }
-
- //pen_dark.Dispose( );
- //pen_light.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 );
-
- CPDrawBorderStyle( dc, label.ClientRectangle, label.BorderStyle );
-
- 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 );
- CPDrawBorderStyle( dc, label.ClientRectangle, label.BorderStyle );
-
- 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
- public override void DrawListBoxDecorations( Graphics dc, ListBox ctrl )
- {
- Rectangle cl = ctrl.LBoxInfo.client_rect;
-
- // Draw decorations
- switch ( ctrl.BorderStyle )
- {
- case BorderStyle.Fixed3D: {
- Pen pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, cl.X, cl.Y, cl.X + cl.Width, cl.Y ); //top
- dc.DrawLine( pen, cl.X, cl.Y, cl.X, cl.Y + cl.Height ); //left
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1 );
- dc.DrawLine( pen, cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2 );
-
- pen = ResPool.GetPen( ColorButtonFace );
- dc.DrawLine( pen, cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2 ); //down
- dc.DrawLine( pen, cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height ); //right
-
- pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1 );
- dc.DrawLine( pen, cl.X + cl.Width - 1, cl.Y + 1 , cl.X + cl.Width - 1, cl.Y + cl.Height - 1 );
- break;
- }
- case BorderStyle.FixedSingle:
- dc.DrawRectangle( ResPool.GetPen( ColorWindowFrame ), cl.X, cl.Y, cl.Width - 1, cl.Height - 1 );
- break;
- case BorderStyle.None:
- default:
- break;
- }
- }
-
- 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 int DrawListBoxDecorationTop( BorderStyle border_style )
- { return DrawListBoxDecorationSize( border_style );}
- public override int DrawListBoxDecorationBottom( BorderStyle border_style )
- { return DrawListBoxDecorationSize( border_style );}
- public override int DrawListBoxDecorationRight( BorderStyle border_style )
- { return DrawListBoxDecorationSize( border_style );}
- public override int DrawListBoxDecorationLeft( BorderStyle border_style )
- { return DrawListBoxDecorationSize( border_style );}
-
- 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.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
- }
- 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, 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 );
-
- dc.FillRectangle( ResPool.GetSolidBrush( control.BackColor ), clip );
-
- // border is drawn directly in the Paint method
- if ( details && control.HeaderStyle != ColumnHeaderStyle.None )
- {
- dc.FillRectangle( ResPool.GetSolidBrush( SystemColors.Control ),
- 0, 0, control.TotalWidth, control.Font.Height + 5 );
- if ( control.Columns.Count > 0 )
- {
- if ( control.HeaderStyle == ColumnHeaderStyle.Clickable )
- {
- foreach ( ColumnHeader col in control.Columns )
- {
- this.CPDrawButton( dc, col.Rect,
- ( col.Pressed ?
- ButtonState.Pushed :
- ButtonState.Normal ) );
- dc.DrawString( col.Text, ThemeEngine.Current.DefaultFont,
- ResPool.GetSolidBrush
- ( this.ColorButtonText ),
- //col.Rect,
- col.Rect.X + 3,
- col.Rect.Y + col.Rect.Height / 2 + 1,
- col.Format );
- }
- }
- // Non-clickable columns
- else
- {
- foreach ( ColumnHeader col in control.Columns )
- {
- this.CPDrawButton( dc, col.Rect, ButtonState.Flat );
- dc.DrawString( col.Text, ThemeEngine.Current.DefaultFont,
- ResPool.GetSolidBrush
- ( this.ColorButtonText ),
- //col.Rect,
- col.Rect.X + 3,
- col.Rect.Y + col.Rect.Height / 2 + 1,
- col.Format );
- }
- }
- }
- }
-
- // In case of details view draw the items only if
- // columns are non-zero
- if ( !details || control.Columns.Count > 0 )
- foreach ( ListViewItem item in control.Items )
- {
- if ( clip.IntersectsWith( item.EntireRect ) )
- DrawListViewItem( dc, control, item );
- }
-
- // draw the gridlines
- if ( details && control.GridLines )
- {
- int top = ( control.HeaderStyle == ColumnHeaderStyle.None ) ?
- 2 : control.Font.Height + 2;
-
- // draw vertical gridlines
- Pen pen = ResPool.GetPen( this.ColorButtonFace );
- foreach ( ColumnHeader col in control.Columns )
- dc.DrawLine( pen,
- col.Rect.Right, top,
- col.Rect.Right, control.TotalHeight );
- // draw horizontal gridlines
- ListViewItem last_item = null;
- foreach ( ListViewItem item in control.Items )
- {
- dc.DrawLine( pen,
- item.EntireRect.Left, item.EntireRect.Top,
- control.TotalWidth, item.EntireRect.Top );
- last_item = item;
- }
-
- // draw a line after at the bottom of the last item
- if ( last_item != null )
- {
- dc.DrawLine( pen,
- last_item.EntireRect.Left,
- last_item.EntireRect.Bottom,
- control.TotalWidth,
- last_item.EntireRect.Bottom );
- }
- }
- }
-
- // draws the ListViewItem of the given index
- private void DrawListViewItem( Graphics dc, ListView control, ListViewItem item )
- {
- 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, item.CheckRect.Width / 6 );
- int scale = Math.Max( 1, item.CheckRect.Width / 12 );
-
- // set the checkbox background
- dc.FillRectangle( this.ResPool.GetSolidBrush( this.ColorWindow ),
- item.CheckRect );
- // define a rectangle inside the border area
- Rectangle rect = new Rectangle( item.CheckRect.X + 2,
- item.CheckRect.Y + 2,
- item.CheckRect.Width - 4,
- item.CheckRect.Height - 4 );
-
- using ( 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,
- item.CheckRect.Location, 1 );
- else if ( ! item.Checked && control.StateImageList.Images.Count > 0 )
- control.StateImageList.Draw( dc,
- item.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, item.IconRect.Location,
- item.ImageIndex );
- }
- else
- {
- if ( item.ImageIndex > -1 &&
- control.SmallImageList != null &&
- item.ImageIndex < control.SmallImageList.Images.Count )
- control.SmallImageList.Draw( dc, item.IconRect.Location,
- item.ImageIndex );
- }
-
- // draw the item text
- Rectangle text_rect = item.LabelRect;
- // 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
- Rectangle full_rect = item.EntireRect;
- full_rect.Location = item.LabelRect.Location;
- dc.FillRectangle( this.ResPool.GetSolidBrush
- ( this.ColorHilight ), 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.ColorHilight ), 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.ColorHilight ),
- 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.ColorHilightText ), 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 = item.LabelRect;
-
- // 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;
-
- 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.ColorHilightText ),
- 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;
- }
- }
- }
- }
-
- // 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, MenuAPI.MENUITEM item, int y, int x, bool menuBar )
- {
- item.rect.Y = y;
- item.rect.X = x;
-
- if ( item.item.Visible == false )
- return;
-
- if ( item.item.Separator == true )
- {
- item.rect.Height = SEPARATOR_HEIGHT / 2;
- item.rect.Width = -1;
- return;
- }
-
- if ( item.item.MeasureEventDefined )
- {
- MeasureItemEventArgs mi = new MeasureItemEventArgs( dc, item.pos );
- item.item.PerformMeasureItem( mi );
- item.rect.Height = mi.ItemHeight;
- item.rect.Width = mi.ItemWidth;
- return;
- }
- else
- {
-
- SizeF size;
- size = dc.MeasureString( item.item.Text, ThemeEngine.Current.MenuFont );
- item.rect.Width = (int) size.Width;
- item.rect.Height = (int) size.Height;
-
- if ( !menuBar )
- {
-
- if ( item.item.Shortcut != Shortcut.None && item.item.ShowShortcut )
- {
- item.item.XTab = ThemeEngine.Current.MenuCheckSize.Width + MENU_TAB_SPACE + (int) size.Width;
- size = dc.MeasureString( " " + item.item.GetShortCutText( ), ThemeEngine.Current.MenuFont );
- item.rect.Width += MENU_TAB_SPACE + (int) size.Width;
- }
-
- item.rect.Width += 4 + ( ThemeEngine.Current.MenuCheckSize.Width * 2 );
- }
- else
- {
- item.rect.Width += MENU_BAR_ITEMS_SPACE;
- x += item.rect.Width;
- }
-
- if ( item.rect.Height < ThemeEngine.Current.MenuHeight )
- item.rect.Height = ThemeEngine.Current.MenuHeight;
- }
- }
-
- // Updates the menu rect and returns the height
- public override int CalcMenuBarSize( Graphics dc, IntPtr hMenu, int width )
- {
- int x = 0;
- int i = 0;
- int y = 0;
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
- menu.Height = 0;
- MenuAPI.MENUITEM item;
-
- while ( i < menu.items.Count )
- {
-
- item = (MenuAPI.MENUITEM) menu.items[ i ];
- CalcItemSize( dc, item, y, x, true );
- i = i + 1;
-
- if ( x + item.rect.Width > width )
- {
- item.rect.X = 0;
- y += item.rect.Height;
- item.rect.Y = y;
- x = 0;
- }
-
- x += item.rect.Width;
- item.item.MenuBar = true;
-
- if ( y + item.rect.Height > menu.Height )
- menu.Height = item.rect.Height + y;
- }
-
- menu.Width = width;
- return menu.Height;
- }
-
-
- public override void CalcPopupMenuSize( Graphics dc, IntPtr hMenu )
- {
- int x = 3;
- int start = 0;
- int i, n, y, max;
-
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
- menu.Height = 0;
-
- while ( start < menu.items.Count )
- {
- y = 2;
- max = 0;
- for ( i = start; i < menu.items.Count; i++ )
- {
- MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[ i ];
-
- if ( ( i != start ) && ( item.item.Break || item.item.BarBreak ) )
- break;
-
- CalcItemSize( dc, item, y, x, false );
- y += item.rect.Height;
-
- if ( item.rect.Width > max )
- max = item.rect.Width;
- }
-
- // Reemplace the -1 by the menu width (separators)
- for ( n = start; n < i; n++, start++ )
- {
- MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[ n ];
- item.rect.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, IntPtr hMenu, Rectangle rect )
- {
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
-
- Rectangle item_rect;
-
- if ( menu.Height == 0 )
- ThemeEngine.Current.CalcMenuBarSize( dc, hMenu, rect.Width );
-
- rect.Height = menu.Height;
- dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( menu.Wnd.BackColor ), rect );
-// dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( NiceBackColor ), rect );
-
- for ( int i = 0; i < menu.items.Count; i++ )
- {
- MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[ i ];
- item_rect = it.rect;
- item_rect.X += rect.X;
- item_rect.Y += rect.Y;
- it.item.MenuHeight = menu.Height;
- it.item.PerformDrawItem( new DrawItemEventArgs( dc, ThemeEngine.Current.MenuFont,
- item_rect, i, it.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( LightColor ),
- e.Bounds.X, e.Bounds.Y, e.Bounds.X + e.Bounds.Width, e.Bounds.Y );
-
- e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight ),
- 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( LightColor ),
- rect.X, rect.Y , rect.X, rect.Y + rect.Height );
-
- e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorButtonHilight ),
- 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 );
- }
-
-// if ( item.MenuBar )
-// {
-// e.Graphics.DrawLine( ResPool.GetPen( BorderColor ), rect_back.Left, rect_back.Bottom, rect_back.Left, rect_back.Top );
-// e.Graphics.DrawLine( ResPool.GetPen( BorderColor ), rect_back.Left, rect_back.Top, rect_back.Right, rect_back.Top );
-// e.Graphics.DrawLine( ResPool.GetPen( BorderColor ), rect_back.Right, rect_back.Top, rect_back.Right, rect_back.Bottom );
-// }
-// else
- 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;
- 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, IntPtr hMenu, Rectangle cliparea, Rectangle rect )
- {
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID( hMenu );
-
- dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush
- ( ThemeEngine.Current.ColorMenu ), cliparea );
-
- /* Draw menu borders */
- dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorHilightText ), rect.X, rect.Y, rect.X + rect.Width, rect.Y );
-
- dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorHilightText ), rect.X, rect.Y, rect.X, rect.Y + rect.Height );
-
- dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonShadow ), rect.X + rect.Width - 1 , rect.Y , rect.X + rect.Width - 1, rect.Y + rect.Height );
-
- dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonDkShadow ), rect.X + rect.Width, rect.Y , rect.X + rect.Width, rect.Y + rect.Height );
-
- dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonShadow ), rect.X , rect.Y + rect.Height - 1 , rect.X + rect.Width - 1, rect.Y + rect.Height - 1 );
-
- dc.DrawLine( ResPool.GetPen( ThemeEngine.Current.ColorButtonDkShadow ), rect.X , rect.Y + rect.Height, rect.X + rect.Width - 1, rect.Y + rect.Height );
-
- for ( int i = 0; i < menu.items.Count; i++ )
- if ( cliparea.IntersectsWith( ( (MenuAPI.MENUITEM) menu.items[ i ] ).rect ) )
- {
- MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[ i ];
- it.item.MenuHeight = menu.Height;
- it.item.PerformDrawItem( new DrawItemEventArgs( dc, ThemeEngine.Current.MenuFont,
- it.rect, i, it.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 );
- }
- }
-
- // 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 );
- }
- }
-
- // 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 );
- }
- }
- }
-
- 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;
-
- 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.DrawImage( pb.Image, ( client.Width / 2 ) - ( pb.Image.Width / 2 ), ( client.Height / 2 ) - ( pb.Image.Height / 2 ) );
- break;
- default:
- // Normal, AutoSize
- dc.DrawImage( pb.Image, 0, 0, pb.Image.Width, pb.Image.Height );
- break;
- }
- }
- CPDrawBorderStyle( dc, client, pb.BorderStyle );
- }
-
- 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 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 );
- }
-
- 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;
- SolidBrush sb;
- 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
-
- sb = new SolidBrush( radio_button.BackColor );
- dc.FillRectangle( sb, radio_button.ClientRectangle );
- sb.Dispose( );
-
-
-
- if ( radio_button.appearance == Appearance.Button )
- {
- 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 );
- }
- }
-
- // 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.ColorButtonFace ) ), text_rectangle, text_format );
- }
- else
- {
- CPDrawStringDisabled( dc, radio_button.Text, radio_button.Font, this.ColorButtonText, text_rectangle, text_format );
- }
-
- if ( radio_button.Focused )
- {
- if ( radio_button.appearance != Appearance.Button )
- 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
- private 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.ColorButtonFace ) ), rectangle, 0, 359 );
- }
- }
- }
- else
- {
- // disabled
- // fill control background color regardless of actual backcolor
- graphics.FillPie( ResPool.GetSolidBrush( this.ColorButtonFace ), 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.ColorButtonFace ) ), 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.ColorButtonFace ) );
- }
- else if ( radio_button.FlatStyle == FlatStyle.Popup && radio_button.is_entered && radio_button.Capture )
- {
- buttonBrush = ResPool.GetSolidBrush( this.ColorButtonText );
- }
- 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;
-
- // FIXME: there seems to be a bug in ScrollBar, when firstbutton or secondbutton is pressed; the clip rectangle is to small
- // this results in artefacts on one side of the thumb
-
- 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: {
- 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 );
- }
- }
- break;
- }
- case ScrollBar.ThumbMoving.Forward: {
- Rectangle r = new Rectangle( 0, scrollbutton_height,
- bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
- Rectangle intersect = Rectangle.Intersect( clip, r );
-
- 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 );
-
- lgbr.Dispose( );
-
- break;
- }
-
- case ScrollBar.ThumbMoving.Backwards: {
- Rectangle r = new Rectangle( 0, scrollbutton_height,
- bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
- Rectangle intersect = Rectangle.Intersect( clip, r );
-
- 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 );
-
- lgbr.Dispose( );
-
- 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: {
- 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 );
- }
- }
- break;
- }
-
- case ScrollBar.ThumbMoving.Forward: {
- Rectangle r = new Rectangle( scrollbutton_width, 0,
- thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
- Rectangle intersect = Rectangle.Intersect( clip, r );
-
- 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 );
-
- lgbr.Dispose( );
-
- break;
- }
-
- case ScrollBar.ThumbMoving.Backwards: {
- Rectangle r = new Rectangle( scrollbutton_width, 0,
- thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
- Rectangle intersect = Rectangle.Intersect( clip, r );
-
- 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 );
-
- lgbr.Dispose( );
- break;
- }
- }
- }
-
- /* Thumb */
- if ( bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith( thumb_pos ) )
- DrawScrollBarThumb( dc, thumb_pos, bar );
- }
-
- 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 );
- }
- 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, ColorButtonFace, area );
-
- }
-
-
- private 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, ColorButtonFace );
- }
-
- 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 );
- }
-
- 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 )
- {
- 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 );
- }
- }
-
- 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 );
- }
- }
-
- private 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;
- }
-
- private 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( 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 );
-
-
- 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 );
-
- switch ( tab.Alignment )
- {
- case TabAlignment.Top:
-
- dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-
- 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:
-
- dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-
- 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:
-
- dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-
- 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
-
- dc.FillRectangle( GetControlBackBrush( tab.BackColor ), bounds );
-
- 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;
- }
-
- #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( SystemBrushes.Control, paint_area );
- CPDrawBorderStyle( dc, paint_area, control.BorderStyle );
-
- if ( control.Divider )
- {
- dc.DrawLine( ResPool.GetPen( ColorButtonHilight ), 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, ColorButtonFace );
- }
- else if ( button.Hilight )
- {
- Pen pen = ResPool.GetPen( ColorButtonText );
- dc.DrawRectangle( pen, buttonArea );
- if ( ! ddRect.IsEmpty )
- {
- dc.DrawLine( pen, 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, ColorButtonFace );
- if ( ! ddRect.IsEmpty )
- {
- CPDrawBorder3D( dc, ddRect, Border3DStyle.SunkenInner,
- Border3DSide.Left, ColorButtonFace );
- buttonArea.Width -= this.ToolBarDropDownWidth;
- }
- }
- else
- {
- CPDrawBorder3D( dc, buttonArea, Border3DStyle.RaisedInner,
- Border3DSide.All, ColorButtonFace );
- if ( ! ddRect.IsEmpty )
- {
- CPDrawBorder3D( dc, ddRect, Border3DStyle.RaisedInner,
- Border3DSide.Left, ColorButtonFace );
- buttonArea.Width -= this.ToolBarDropDownWidth;
- }
- }
- }
- }
- DrawToolBarButton( dc, button, control.Font, format, paint_area, buttonArea,
- imgRect, image, txtRect, ddRect, flat );
- }
- }
-
- 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 )
- {
- Pen cbs_pen = ResPool.GetPen( ColorButtonShadow );
- Pen cbh_pen = ResPool.GetPen( ColorButtonHilight );
- Pen cbf_pen = ResPool.GetPen( ColorButtonFace );
- dc.DrawLine( cbs_pen, buttonArea.X + 1, buttonArea.Y,
- buttonArea.X + 1, buttonArea.Height );
-
- dc.DrawLine( cbh_pen, buttonArea.X + 1 + (int) cbf_pen.Width,
- buttonArea.Y, buttonArea.X + 1 + (int) cbf_pen.Width, buttonArea.Height );
- /* draw a horizontal separator */
- if ( button.Wrapper )
- {
- int y = buttonArea.Height + this.ToolBarSeparatorWidth / 2;
- dc.DrawLine( cbs_pen, 0, y, controlArea.Width, y );
- dc.DrawLine( cbh_pen, 0, y + 1 + (int) cbf_pen.Width, controlArea.Width,
- y + 1 + (int) cbf_pen.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, ColorButtonHilight, 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, ColorButtonHilight,
- 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, ColorButtonFace );
- }
- }
- if ( button.Enabled )
- dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
- else
- CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight,
- 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, ColorButtonFace );
- }
- }
- if ( button.Enabled )
- dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
- else
- CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight,
- 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, ColorButtonFace );
- }
- }
- if ( button.Enabled )
- dc.DrawString( button.Text, font, SystemBrushes.ControlText, txtRect, format );
- else
- CPDrawStringDisabled( dc, button.Text, font, ColorButtonHilight,
- 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.ColorInfoWindow ), 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( ColorButtonShadow ), channel_startpoint.X, channel_startpoint.Y,
- 1, thumb_area.Height );
-
- dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonDkShadow ), channel_startpoint.X + 1, channel_startpoint.Y,
- 1, thumb_area.Height );
-
- dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonHilight ), 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;
-
- Pen pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X , thumb_pos.Y + 10 );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y );
- dc.DrawLine( pen, thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4 );
-
- pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 15, thumb_pos.Y + 9 );
- dc.DrawLine( pen, thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X + 16 + 4, thumb_pos.Y + 9 - 4 );
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X + 16, thumb_pos.Y + 10 );
- dc.DrawLine( pen, 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;
-
- Pen pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y );
- dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4 );
-
- pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16 , thumb_pos.Y + 9 );
- dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X, thumb_pos.Y + 5 );
- dc.DrawLine( pen, thumb_pos.X + 19, thumb_pos.Y + 9, thumb_pos.X + 19 , thumb_pos.Y + 1 );
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X + 4 + 16, thumb_pos.Y + 10 );
- dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X - 1, thumb_pos.Y + 5 );
- dc.DrawLine( pen, 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;
- Pen pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9 );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y );
-
- pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 19, thumb_pos.Y + 9 );
- dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y + 1, thumb_pos.X + 19, thumb_pos.Y + 8 );
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X + 20, thumb_pos.Y + 10 );
- dc.DrawLine( pen, 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 ) )
- {
- Pen pen = ResPool.GetPen( pen_ticks_color );
-
- 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( pen, 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( pen, 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( pen, 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( pen, 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( ColorButtonShadow ), channel_startpoint.X, channel_startpoint.Y,
- thumb_area.Width, 1 );
-
- dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonDkShadow ), channel_startpoint.X, channel_startpoint.Y + 1,
- thumb_area.Width, 1 );
-
- dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonHilight ), 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;
-
- Pen pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16 );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4 );
-
- pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 15 );
- dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X + 9 - 4, thumb_pos.Y + 16 + 4 );
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 16 );
- dc.DrawLine( pen, 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;
-
- Pen pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16 );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y );
-
- pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16 );
- dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y );
- dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1 , thumb_pos.Y + 19 );
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16 );
- dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y - 1 );
- dc.DrawLine( pen, 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;
- Pen pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y );
- dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19 );
-
- pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 19 );
- dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19 );
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 20 );
- dc.DrawLine( pen, 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 ) )
- {
- Pen pen = ResPool.GetPen( pen_ticks_color );
-
- 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( pen, 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( pen, 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( pen, 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( pen, 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, ColorButtonHilight, ColorButtonFace );
- }
- else
- {
- br_thumb = ResPool.GetSolidBrush( ColorButtonFace );
- }
-
-
- /* Control Background */
- if ( tb.BackColor == DefaultControlBackColor )
- {
- dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonFace ), clip_rectangle );
- }
- else
- {
- dc.FillRectangle( ResPool.GetSolidBrush( tb.BackColor ), clip_rectangle );
- }
-
-
- if ( tb.Focused )
- {
- dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, Color.Black ), area.X, area.Y, area.Width - 1, 1 );
- dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, Color.Black ), area.X, area.Y + area.Height - 1, area.Width - 1, 1 );
- dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, Color.Black ), area.X, area.Y, 1, area.Height - 1 );
- dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonFace, 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 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 )
- {
- DrawBorderInternal( dc, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 1, leftWidth, leftColor, leftStyle, Border3DSide.Left );
- DrawBorderInternal( dc, bounds.Left, bounds.Top, bounds.Right - 1, bounds.Top, topWidth, topColor, topStyle, Border3DSide.Top );
- DrawBorderInternal( dc, bounds.Right - 1, bounds.Top, bounds.Right - 1, bounds.Bottom - 1, rightWidth, rightColor, rightStyle, Border3DSide.Right );
- DrawBorderInternal( dc, bounds.Left, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1, bottomWidth, bottomColor, bottomStyle, Border3DSide.Bottom );
- }
-
- public override void CPDrawBorder3D( Graphics dc, Rectangle rectangle, Border3DStyle style, Border3DSide sides )
- {
- CPDrawBorder3D( dc, rectangle, style, sides, ColorButtonFace );
- }
-
- private void CPDrawBorder3D( Graphics dc, 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 )
- {
- dc.FillRectangle( ResPool.GetSolidBrush( control_color ), rect );
- }
-
- if ( ( sides & Border3DSide.Left ) != 0 )
- {
- dc.DrawLine( penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top );
- if ( doInner )
- {
- dc.DrawLine( penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top );
- }
- }
-
- if ( ( sides & Border3DSide.Top ) != 0 )
- {
- dc.DrawLine( penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top );
-
- if ( doInner )
- {
- if ( ( sides & Border3DSide.Left ) != 0 )
- {
- dc.DrawLine( penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1 );
- }
- else
- {
- dc.DrawLine( penTopLeftInner, rect.Left, rect.Top + 1, rect.Right - 3, rect.Top + 1 );
- }
- }
- }
-
- if ( ( sides & Border3DSide.Right ) != 0 )
- {
- dc.DrawLine( penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1 );
-
- if ( doInner )
- {
- if ( ( sides & Border3DSide.Top ) != 0 )
- {
- dc.DrawLine( penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2 );
- }
- else
- {
- dc.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;
- }
-
- dc.DrawLine( penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1 );
-
- if ( doInner )
- {
- if ( ( sides & Border3DSide.Right ) != 0 )
- {
- dc.DrawLine( penBottomRightInner, left, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2 );
- }
- else
- {
- dc.DrawLine( penBottomRightInner, left, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2 );
- }
- }
- }
- }
-
-
- public override void CPDrawButton( Graphics dc, 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( dc, rectangle, DrawFrameControlTypes.Button, dfcs );
- }
-
-
- public override void CPDrawCaptionButton( Graphics dc, Rectangle rectangle, CaptionButton button, ButtonState state )
- {
- Rectangle captionRect;
- int lineWidth;
-
- CPDrawButton( dc, 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: {
- if ( ( state & ButtonState.Inactive ) != 0 )
- {
- using ( Pen pen = new Pen( ColorButtonHilight, lineWidth ) )
- {
- DrawCaptionHelper( dc, ColorButtonHilight, pen, lineWidth, 1, captionRect, button );
- }
-
- using ( Pen pen = new Pen( ColorButtonShadow, lineWidth ) )
- {
- DrawCaptionHelper( dc, ColorButtonShadow, pen, lineWidth, 0, captionRect, button );
- }
- return;
- }
- else
- {
- using ( Pen pen = new Pen( ColorButtonText, lineWidth ) )
- {
- DrawCaptionHelper( dc, ColorButtonText, pen, lineWidth, 0, captionRect, button );
- }
- return;
- }
- }
-
- case CaptionButton.Help:
- case CaptionButton.Maximize:
- case CaptionButton.Minimize:
- case CaptionButton.Restore: {
- if ( ( state & ButtonState.Inactive ) != 0 )
- {
- DrawCaptionHelper( dc, ColorButtonHilight, SystemPens.ControlLightLight, lineWidth, 1, captionRect, button );
-
- DrawCaptionHelper( dc, ColorButtonShadow, SystemPens.ControlDark, lineWidth, 0, captionRect, button );
- return;
- }
- else
- {
- DrawCaptionHelper( dc, ColorButtonText, SystemPens.ControlText, lineWidth, 0, captionRect, button );
- return;
- }
- }
- }
- }
-
-
- public override void CPDrawCheckBox( Graphics dc, 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( dc, rectangle, DrawFrameControlTypes.Button, dfcs );
-
- }
-
- 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.X += 1;
- rectangle.Height += 1;
- rectangle.Width += 1;
-
- if ( ( state & ButtonState.Checked ) != 0 )
- {
- dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorButtonLight, ColorButtonHilight ), 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, ColorButtonFace );
- }
- }
-
- using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rectangle.X, rectangle.Y ), new Point( rectangle.X, rectangle.Bottom - 1 ), first_color, second_color ) )
- {
- dc.FillRectangle( lgbr, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 3 );
- }
-
- Point[] points = new Point[] {
- new Point( rectangle.X + 2, 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 + 2, rectangle.Bottom - 1 ),
- new Point( rectangle.X, rectangle.Bottom - 3 ),
- new Point( rectangle.X, rectangle.Y + 2 ),
- new Point( rectangle.X + 2, rectangle.Y )
- };
-
- 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;
-
- /* 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 );
- }
- }
- }
-
-
- public override void CPDrawContainerGrabHandle( Graphics dc, 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;
-
- dc.FillRectangle( ResPool.GetSolidBrush( ColorButtonText ), rect );
- dc.DrawRectangle( pen, rect );
-
- X = rect.X + rect.Width / 2;
- Y = rect.Y + rect.Height / 2;
-
- /* Draw the cross */
- dc.DrawLine( pen, X, rect.Y + 2, X, rect.Bottom - 2 );
- dc.DrawLine( pen, rect.X + 2, Y, rect.Right - 2, Y );
-
- /* Draw 'arrows' for vertical lines */
- dc.DrawLine( pen, X - 1, rect.Y + 3, X + 1, rect.Y + 3 );
- dc.DrawLine( pen, X - 1, rect.Bottom - 3, X + 1, rect.Bottom - 3 );
-
- /* Draw 'arrows' for horizontal lines */
- dc.DrawLine( pen, rect.X + 3, Y - 1, rect.X + 3, Y + 1 );
- dc.DrawLine( pen, rect.Right - 3, Y - 1, rect.Right - 3, Y + 1 );
-
- pen.Dispose( );
- }
-
- public virtual void DrawInnerFocusRectangle( Graphics dc, 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 ) );
-
- Color colorBackInverted = Color.FromArgb( Math.Abs( backColor.R - 255 ), Math.Abs( backColor.G - 255 ), Math.Abs( backColor.B - 255 ) );
- Pen pen = ResPool.GetPen( colorBackInverted );
- DashStyle oldStyle = pen.DashStyle;
- pen.DashStyle = DashStyle.Dot;
- dc.DrawRectangle( pen, trace_rectangle );
- pen.DashStyle = oldStyle;
- }
-
-
- public override void CPDrawFocusRectangle( Graphics dc, 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--;
-
- dc.DrawRectangle( pen, rect );
- pen.Dispose( );
- }
-
- public override void CPDrawGrabHandle( Graphics dc, 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( ColorButtonText );
- }
- else
- {
- sb = ResPool.GetSolidBrush( ColorButtonFace );
- }
- }
- else
- {
- pen = new Pen( Color.White, 1 );
- if ( enabled == true )
- {
- sb = ThemeEngine.Current.ResPool.GetSolidBrush( Color.Black );
- }
- else
- {
- sb = ResPool.GetSolidBrush( ColorButtonFace );
- }
- }
- dc.FillRectangle( sb, rectangle );
- dc.DrawRectangle( pen, rectangle );
- pen.Dispose( );
- }
-
-
- public override void CPDrawGrid( Graphics dc, 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, dc );
-
- 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 );
- }
- }
- dc.DrawImage( bitmap, area.X, area.Y, area.Width, area.Height );
- bitmap.Dispose( );
- }
-
- public override void CPDrawImageDisabled( Graphics dc, 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 );
- }
-
- dc.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 dc, 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;
-
- dc.DrawRectangle( penBorder, rectangle );
- dc.DrawRectangle( penInside, rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 5, rectangle.Height - 5 );
- penBorder.Dispose( );
- penInside.Dispose( );
- }
-
-
- public override void CPDrawMenuGlyph( Graphics dc, Rectangle rectangle, MenuGlyph glyph )
- {
- Rectangle rect;
- int lineWidth;
-
- // MS draws always the background white
- dc.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;
-
- dc.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 );
-
- dc.FillEllipse( ResPool.GetSolidBrush( ColorButtonText ), 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++ )
- {
- dc.DrawLine( SystemPens.MenuText, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i );
- dc.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 dc, 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( dc, 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 scroll_button_type, ButtonState state )
- {
- bool enabled = ( state == ButtonState.Inactive ) ? false: true;
-
- DrawScrollButtonPrimitiveNice( 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;
- }
-
- dc.DrawLines( pen, arrow );
-
- pen.Dispose( );
- }
-
- public override void CPDrawSelectionFrame( Graphics dc, 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 );
-
- Pen pen = ResPool.GetPen( ColorButtonFace );
- dc.DrawLine( pen, pt.X - 12, pt.Y, pt.X, pt.Y );
- dc.DrawLine( pen, pt.X, pt.Y, pt.X, pt.Y - 13 );
-
- // diagonals
- pen = ResPool.GetPen( ColorButtonShadow );
- for ( int i = 0; i < 11; i += 4 )
- {
- dc.DrawLine( pen, pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 2 );
- dc.DrawLine( pen, pt.X - i - 1, pt.Y, pt.X + 1, pt.Y - i - 2 );
- }
-
- pen = ResPool.GetPen( ColorButtonHilight );
- for ( int i = 3; i < 13; i += 4 )
- dc.DrawLine( pen, pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 1 );
- }
-
-
- public override void CPDrawStringDisabled( Graphics dc, string s, Font font, Color color, RectangleF layoutRectangle,
- StringFormat format )
- {
-
- layoutRectangle.Offset( 1.0f, 1.0f );
- dc.DrawString( s, font, ResPool.GetSolidBrush( ControlPaint.Light( color, 95 ) ), layoutRectangle, format );
- layoutRectangle.Offset( -1.0f, -1.0f );
- dc.DrawString( s, font, ResPool.GetSolidBrush( ControlPaint.Light( color, 50 ) ), layoutRectangle, format );
-
- }
-
- private static void DrawBorderInternal( Graphics dc, 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 );
- dc.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 );
- dc.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 );
- dc.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 );
- dc.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 );
- dc.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 );
- dc.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 );
- dc.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 );
- dc.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++ )
- {
- dc.DrawLine( pen, startX + i, startY + i, endX + i, endY - i );
- }
- break;
- }
-
- case Border3DSide.Right: {
- for ( int i=0; i < width; i++ )
- {
- dc.DrawLine( pen, startX - i, startY + i, endX - i, endY - i );
- }
- break;
- }
-
- case Border3DSide.Top: {
- for ( int i=0; i < width; i++ )
- {
- dc.DrawLine( pen, startX + i, startY + i, endX - i, endY + i );
- }
- break;
- }
-
- case Border3DSide.Bottom: {
- for ( int i=0; i < width; i++ )
- {
- dc.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 dc, 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, ColorButtonLight, ColorButtonHilight);
-// graphics.FillRectangle(hatchBrush,rectangle);
-// hatchBrush.Dispose();
-// }
-
- // Clear the background
- dc.FillRectangle( SystemBrushes.Control, rectangle );
-
- if ( ( State & DrawFrameControlStates.Pushed ) != 0 || ( State & DrawFrameControlStates.Checked ) != 0 )
- {
- dc.DrawRectangle( ResPool.GetPen( ControlPaint.Dark( ColorButtonFace ) ), trace_rectangle );
- }
- else if ( ( State & DrawFrameControlStates.Flat ) != 0 )
- {
- ControlPaint.DrawBorder( dc, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid );
- }
- else if ( ( State & DrawFrameControlStates.Inactive ) != 0 )
- {
- /* Same as normal, it would seem */
- CPDrawBorder3D( dc, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
- }
- else
- {
- CPDrawBorder3D( dc, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
- }
- }
- else if ( ( State & DrawFrameControlStates.ButtonRadio ) != 0 )
- {
- Pen penFatDark = new Pen( ColorButtonShadow, 1 );
- Pen penFatLight = new Pen( ColorButtonLight, 1 );
- int lineWidth;
-
- dc.FillPie( ResPool.GetSolidBrush( this.ColorWindow ), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359 );
-
- dc.DrawArc( penFatDark, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 135, 180 );
- dc.DrawArc( penFatLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 315, 180 );
-
- dc.DrawArc( SystemPens.ControlDark, rectangle, 135, 180 );
- dc.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;
- }
- dc.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 )
- {
- dc.FillRectangle( SystemBrushes.Control, rectangle );
- }
- else
- {
- dc.FillRectangle( SystemBrushes.Window, rectangle );
- }
-
- /* Draw the sunken frame */
- if ( ( State & DrawFrameControlStates.Flat ) != 0 )
- {
- ControlPaint.DrawBorder( dc, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid );
- }
- else
- {
- CPDrawBorder3D( dc, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace );
- }
-
- /* 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++ )
- {
- dc.DrawLine( pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i );
- dc.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;
- }
- }
- }
-
- 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 - 1, area.Y ), Color.White, NormalColor );
- else
- lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.X, area.Bottom - 1 ), Color.White, NormalColor );
-
- Pen pen = new Pen( 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 - 3 );
- dc.DrawPolygon( pen, points );
-
- // draw grip lines only if stere is enough space
- if ( area.Height > 12 )
- {
- using ( Pen lpen = new Pen( MouseOverColor, 2 ) )
- {
- int mid_y = area.Y + ( area.Height / 2 );
- int mid_x = area.X + ( area.Width / 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 );
- }
- }
- }
- else
- {
- dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 3, area.Height - 2 );
- dc.DrawPolygon( pen, points );
-
- // draw grip lines only if stere is enough space
- if ( area.Width > 12 )
- {
- using ( Pen lpen = new Pen( MouseOverColor, 2 ) )
- {
- int mid_x = area.X + ( area.Width / 2 );
- int mid_y = area.Y + ( area.Height / 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 );
- }
- }
- }
-
- lgbr.Dispose( );
- pen.Dispose( );
- }
-
- /* Generic scroll button */
- public void DrawScrollButtonPrimitiveNice( Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type )
- {
- Pen pen = new Pen( BorderColor );
-
- Color use_color;
-
- if ( ( state & ButtonState.Pushed ) == ButtonState.Pushed )
- use_color = PressedColor;
- else
- use_color = NormalColor;
-
- 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 )
- };
-
- 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 );
- dc.DrawPolygon( pen, points );
- break;
- case ScrollButton.Right:
- lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.Right - 2, area.Y ), Color.White, use_color );
- dc.FillRectangle( lgbr, area.X, area.Y + 1, area.Width - 2, area.Height - 2 );
- 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 );
- 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 - 3 );
- dc.DrawPolygon( pen, points );
- break;
- }
-
- lgbr.Dispose( );
-
- pen.Dispose( );
- }
-
- public override void CPDrawBorderStyle( Graphics dc, Rectangle area, BorderStyle border_style )
- {
- switch ( border_style )
- {
- case BorderStyle.Fixed3D:
- Pen pen = ResPool.GetPen( ColorButtonShadow );
- dc.DrawLine( pen, area.X, area.Y, area.X + area.Width, area.Y );
- dc.DrawLine( pen, area.X, area.Y, area.X, area.Y + area.Height );
-
- pen = ResPool.GetPen( ColorButtonHilight );
- dc.DrawLine( pen, area.X , area.Y + area.Height - 1, area.X + area.Width ,
- area.Y + area.Height - 1 );
- dc.DrawLine( pen, area.X + area.Width - 1 , area.Y, area.X + area.Width - 1,
- area.Y + area.Height );
-
- pen = ResPool.GetPen( ColorActiveBorder );
- dc.DrawLine( pen, area.X + 1, area.Bottom - 2, area.Right - 2, area.Bottom - 2 );
- dc.DrawLine( pen, area.Right - 2, area.Top + 1, area.Right - 2, area.Bottom - 2 );
-
- pen = ResPool.GetPen( ColorButtonDkShadow );
- dc.DrawLine( pen, area.X + 1, area.Top + 1, area.X + 1, area.Bottom - 3 );
- dc.DrawLine( pen, area.X + 1, area.Top + 1, area.Right - 3, area.Top + 1 );
- break;
- case BorderStyle.FixedSingle:
- dc.DrawRectangle( ResPool.GetPen( BorderColor ), area.X, area.Y, area.Width - 1, area.Height - 1 );
- break;
- case BorderStyle.None:
- default:
- break;
- }
-
- }
- #endregion // ControlPaint
-
-
- } //class
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 {\r
- get {\r
- return new Version(0, 1, 0, 0);\r
- }\r
- }\r
-
-
- /* Default colors for Win32 classic theme */
- uint [] theme_colors = { /* AARRGGBB */
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_SCROLLBAR, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BACKGROUND, 0xff008080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_ACTIVECAPTION, 0xff000080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTION, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENU, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOW, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOWFRAME, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENUTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOWTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_CAPTIONTEXT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_ACTIVEBORDER, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVEBORDER, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_APPWORKSPACE, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHT, 0xff000080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHTTEXT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNFACE, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNSHADOW, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_GRAYTEXT, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTIONTEXT, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNHIGHLIGHT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_3DDKSHADOW, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_3DLIGHT, 0xffe0e0e0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INFOTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INFOBK, 0xffffffff,
-
- };
-
- /* Hardcoded colour values not exposed in the API constants in all configurations */
- static readonly Color arrow_color = Color.Black;
- static readonly Color pen_ticks_color = Color.Black;
- static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
- static StringFormat string_format_menu_text;
- static StringFormat string_format_menu_shortcut;
- 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 ()
- {
- /* Init Default colour array*/
- syscolors = Array.CreateInstance (typeof (Color), (uint) XplatUIWin32.GetSysColorIndex.COLOR_MAXVALUE+1);
-
- for (int i = 0; i < theme_colors.Length; i +=2)
- syscolors.SetValue (Color.FromArgb ((int)theme_colors[i+1]), (int) theme_colors[i]);
-
- defaultWindowBackColor = SystemColors.Window;
- defaultWindowForeColor = ColorButtonText;
- 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;
- }
-
- 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 (ColorButtonFace);
- return new SolidBrush (c);
- }
-
- protected SolidBrush GetControlForeBrush (Color c) {
- if (c == DefaultControlForeColor)
- return ResPool.GetSolidBrush (ColorButtonText);
- return new SolidBrush (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) {
- int width;
- int height;
- Rectangle buttonRectangle;
- Rectangle borderRectangle;
-
- width = button.ClientSize.Width;
- height = button.ClientSize.Height;
-
- 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);
- }
-
- // First, draw the image
- if ((button.image != null) || (button.image_list != null)) {
- // Need to draw a picture
- Image i;
- int image_x;
- int image_y;
- int image_width;
- int image_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, ColorButtonFace);
- }
- }
-
- // Draw the focus rectangle
- if (button.has_focus) {
- if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
- DrawFlatStyleFocusRectangle (dc, button.ClientRectangle, button, button.ForeColor, button.BackColor);
- } else {
- CPDrawFocusRectangle(dc, button.ClientRectangle, button.ForeColor, button.BackColor);
- }
- }
-
- // Now the text
- if (button.text != null && button.text != String.Empty) {
- 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.ColorButtonFace)), text_rect, button.text_format);
- } else {
- CPDrawStringDisabled(dc, button.text, button.Font, ColorButtonText, 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.ColorButtonText), trace_rectangle);
- } else {
- // draw a 3d border
- CPDrawBorder3D (graphics, rectangle, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top, button.BackColor);
- graphics.DrawLine ( ResPool.GetPen (this.ColorButtonText), trace_rectangle.X, trace_rectangle.Bottom, trace_rectangle.Right, trace_rectangle.Bottom);
- graphics.DrawLine ( ResPool.GetPen (this.ColorButtonText), 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.ColorButtonText;
- }
-
- // 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.ColorButtonText), 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.ColorButtonText;
-
- // 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;
- SolidBrush sb;
- 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
-
- 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);
- }
- }
-
- // 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.ColorButtonFace)), text_rectangle, text_format);
- } else {
- CPDrawStringDisabled(dc, checkbox.Text, checkbox.Font, ColorButtonText, text_rectangle, text_format);
- }
-
- 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
- private 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, ColorButtonShadow, 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.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
- }
- 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 (ColorButtonShadow), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height); //right
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), 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.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
- }
- 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);
- }
- }
-
- #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 DataGridBackgroundColor { get { return ColorAppWorkSpace;} }
- public override Color DataGridCaptionBackColor { get { return ColorActiveTitle;} }
- public override Color DataGridCaptionForeColor { get { return SystemColors.ActiveCaptionText;} }
- public override Color DataGridGridLineColor { get { return SystemColors.Control;} }
- public override Color DataGridHeaderBackColor { get { return SystemColors.Control;} }
- public override Color DataGridHeaderForeColor { get { return SystemColors.ControlText;} }
- public override Color DataGridLinkColor { get { return SystemColors.HotTrack;} }
- public override Color DataGridLinkHoverColor { get { return SystemColors.HotTrack;} }
- public override Color DataGridParentRowsBackColor { get { return SystemColors.Control;} }
- public override Color DataGridParentRowsForeColor { get { return SystemColors.WindowText;} }
- public override Color DataGridSelectionBackColor { get { return ColorActiveTitle;} }
- public override Color DataGridSelectionForeColor { get { return ColorTitleText;} }
-
- 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.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width - grid.horiz_scrollbar.Height,
- grid.grid_drawing.client_area.Y + grid.grid_drawing.client_area.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);
- }
- }
-
- ThemeEngine.Current.CPDrawBorderStyle (pe.Graphics, grid.ClientRectangle, grid.border_style);
- }
-
- 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.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width) {
-
- Rectangle not_usedarea = columnshdrs_area_complete;
- not_usedarea.X = rect_columnhdr.X + rect_columnhdr.Width;
- not_usedarea.Width = grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.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++;
- }
-
- 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;
- }
- }
-
- // 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.ColorButtonHilight),
- bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y);
-
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
- bounds.X, bounds.Y + 1, bounds.X, bounds.Y + bounds.Height - 1);
-
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
- 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.ColorButtonShadow),
- 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.ColorHilight), 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);
- }
- }
-
- #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, new SolidBrush (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);
- }
-
- }
-
- 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);
-
- CPDrawBorderStyle (dc, label.ClientRectangle, label.BorderStyle);
-
- 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\r
-\r
- #region LinkLabel\r
- public override void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label)\r
- {\r
- Color color;\r
-\r
- dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);\r
- CPDrawBorderStyle (dc, label.ClientRectangle, label.BorderStyle);
-\r
- for (int i = 0; i < label.num_pieces; i++) {
-
- if (clip_rectangle.IntersectsWith (label.pieces[i].rect) == false) {
- continue;
- }
- \r
- color = label.GetLinkColor (label.pieces[i], i);\r
-\r
- if (label.pieces[i].link == null)\r
- dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (Color.Black),\r
- label.pieces[i].rect.X, label.pieces[i].rect.Y);\r
- else\r
- dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (color),\r
- 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);
- }\r
- }
- \r
- }\r
- #endregion // LinkLabel\r
- #region ListBox
-
- // Drawing
- public override void DrawListBoxDecorations (Graphics dc, ListBox ctrl)
- {
- Rectangle cl = ctrl.LBoxInfo.client_rect;
-
- // Draw decorations
- switch (ctrl.BorderStyle) {
- case BorderStyle.Fixed3D: {
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height); //right
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), cl.X + cl.Width - 1, cl.Y + 1 , cl.X + cl.Width - 1, cl.Y + cl.Height - 1);
- break;
- }
- case BorderStyle.FixedSingle:
- dc.DrawRectangle (ResPool.GetPen (ColorWindowFrame), cl.X, cl.Y, cl.Width - 1, cl.Height - 1);
- break;
- case BorderStyle.None:
- default:
- break;
- }
- }
-
- 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 int DrawListBoxDecorationTop (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
- public override int DrawListBoxDecorationBottom (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
- public override int DrawListBoxDecorationRight (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
- public override int DrawListBoxDecorationLeft (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
-
- 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.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
- }
- 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, 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);
-
- dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor), clip);
-
- // border is drawn directly in the Paint method
- if (details && control.HeaderStyle != ColumnHeaderStyle.None) {
- dc.FillRectangle (ResPool.GetSolidBrush (SystemColors.Control),
- 0, 0, control.TotalWidth, control.Font.Height + 5);
- if (control.Columns.Count > 0) {
- if (control.HeaderStyle == ColumnHeaderStyle.Clickable) {
- foreach (ColumnHeader col in control.Columns) {
- this.CPDrawButton (dc, col.Rect,
- (col.Pressed ?
- ButtonState.Pushed :
- ButtonState.Normal));
- dc.DrawString (col.Text, ThemeEngine.Current.DefaultFont,
- ResPool.GetSolidBrush
- (this.ColorButtonText),
- //col.Rect,
- col.Rect.X + 3,
- col.Rect.Y + col.Rect.Height/2 + 1,
- col.Format);
- }
- }
- // Non-clickable columns
- else {
- foreach (ColumnHeader col in control.Columns) {
- this.CPDrawButton (dc, col.Rect, ButtonState.Flat);
- dc.DrawString (col.Text, ThemeEngine.Current.DefaultFont,
- ResPool.GetSolidBrush
- (this.ColorButtonText),
- //col.Rect,
- col.Rect.X + 3,
- col.Rect.Y + col.Rect.Height/2 + 1,
- col.Format);
- }
- }
- }
- }
-
- // In case of details view draw the items only if
- // columns are non-zero
- if (!details || control.Columns.Count > 0)
- foreach (ListViewItem item in control.Items) {
- if (clip.IntersectsWith (item.EntireRect))
- DrawListViewItem (dc, control, item);
- }
-
- // 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.ColorButtonFace),
- 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.ColorButtonFace),
- item.EntireRect.Left, item.EntireRect.Top,
- control.TotalWidth, item.EntireRect.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.ColorButtonFace),
- last_item.EntireRect.Left,
- last_item.EntireRect.Bottom,
- control.TotalWidth,
- last_item.EntireRect.Bottom);
- }
- }
- }
-
- // draws the ListViewItem of the given index
- private void DrawListViewItem (Graphics dc, ListView control, ListViewItem item)
- {
- 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, item.CheckRect.Width / 6);
- int scale = Math.Max (1, item.CheckRect.Width / 12);
-
- // set the checkbox background
- dc.FillRectangle (this.ResPool.GetSolidBrush (this.ColorWindow),
- item.CheckRect);
- // define a rectangle inside the border area
- Rectangle rect = new Rectangle (item.CheckRect.X + 2,
- item.CheckRect.Y + 2,
- item.CheckRect.Width - 4,
- item.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,
- item.CheckRect.Location, 1);
- else if (! item.Checked && control.StateImageList.Images.Count > 0)
- control.StateImageList.Draw (dc,
- item.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, item.IconRect.Location,
- item.ImageIndex);
- }
- else {
- if (item.ImageIndex > -1 &&
- control.SmallImageList != null &&
- item.ImageIndex < control.SmallImageList.Images.Count)
- control.SmallImageList.Draw (dc, item.IconRect.Location,
- item.ImageIndex);
- }
-
- // draw the item text
- Rectangle text_rect = item.LabelRect;
- // 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
- Rectangle full_rect = item.EntireRect;
- full_rect.Location = item.LabelRect.Location;
- dc.FillRectangle (this.ResPool.GetSolidBrush
- (this.ColorHilight), 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.ColorHilight), 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.ColorHilight),
- 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.ColorHilightText), 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 = item.LabelRect;
-
- // 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;
-
- 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.ColorHilightText),
- 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;
- }
- }
- }
- }
-
- // 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, MenuAPI.MENUITEM item, int y, int x, bool menuBar)
- {
- item.rect.Y = y;
- item.rect.X = x;
-
- if (item.item.Visible == false)
- return;
-
- if (item.item.Separator == true) {
- item.rect.Height = SEPARATOR_HEIGHT / 2;
- item.rect.Width = -1;
- return;
- }
-
- if (item.item.MeasureEventDefined) {
- MeasureItemEventArgs mi = new MeasureItemEventArgs (dc, item.pos);
- item.item.PerformMeasureItem (mi);
- item.rect.Height = mi.ItemHeight;
- item.rect.Width = mi.ItemWidth;
- return;
- } else {
-
- SizeF size;
- size = dc.MeasureString (item.item.Text, ThemeEngine.Current.MenuFont);
- item.rect.Width = (int) size.Width;
- item.rect.Height = (int) size.Height;
-
- if (!menuBar) {
-
- if (item.item.Shortcut != Shortcut.None && item.item.ShowShortcut) {
- item.item.XTab = ThemeEngine.Current.MenuCheckSize.Width + MENU_TAB_SPACE + (int) size.Width;
- size = dc.MeasureString (" " + item.item.GetShortCutText (), ThemeEngine.Current.MenuFont);
- item.rect.Width += MENU_TAB_SPACE + (int) size.Width;
- }
-
- item.rect.Width += 4 + (ThemeEngine.Current.MenuCheckSize.Width * 2);
- }
- else {
- item.rect.Width += MENU_BAR_ITEMS_SPACE;
- x += item.rect.Width;
- }
-
- if (item.rect.Height < ThemeEngine.Current.MenuHeight)
- item.rect.Height = ThemeEngine.Current.MenuHeight;
- }
- }
-
- // Updates the menu rect and returns the height
- public override int CalcMenuBarSize (Graphics dc, IntPtr hMenu, int width)
- {
- int x = 0;
- int i = 0;
- int y = 0;
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
- menu.Height = 0;
- MenuAPI.MENUITEM item;
-
- while (i < menu.items.Count) {
-
- item = (MenuAPI.MENUITEM) menu.items[i];
- CalcItemSize (dc, item, y, x, true);
- i = i + 1;
-
- if (x + item.rect.Width > width) {
- item.rect.X = 0;
- y += item.rect.Height;
- item.rect.Y = y;
- x = 0;
- }
-
- x += item.rect.Width;
- item.item.MenuBar = true;
-
- if (y + item.rect.Height > menu.Height)
- menu.Height = item.rect.Height + y;
- }
-
- menu.Width = width;
- return menu.Height;
- }
-
-
- public override void CalcPopupMenuSize (Graphics dc, IntPtr hMenu)
- {
- int x = 3;
- int start = 0;
- int i, n, y, max;
-
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
- menu.Height = 0;
-
- while (start < menu.items.Count) {
- y = 2;
- max = 0;
- for (i = start; i < menu.items.Count; i++) {
- MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[i];
-
- if ((i != start) && (item.item.Break || item.item.BarBreak))
- break;
-
- CalcItemSize (dc, item, y, x, false);
- y += item.rect.Height;
-
- if (item.rect.Width > max)
- max = item.rect.Width;
- }
-
- // Reemplace the -1 by the menu width (separators)
- for (n = start; n < i; n++, start++) {
- MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[n];
- item.rect.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, IntPtr hMenu, Rectangle rect)
- {
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
- Rectangle item_rect;
-
- if (menu.Height == 0)
- ThemeEngine.Current.CalcMenuBarSize (dc, hMenu, rect.Width);
-
- rect.Height = menu.Height;
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (menu.Wnd.BackColor), rect);
-
- for (int i = 0; i < menu.items.Count; i++) {
- MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[i];
- item_rect = it.rect;
- item_rect.X += rect.X;
- item_rect.Y += rect.Y;
- it.item.MenuHeight = menu.Height;
- it.item.PerformDrawItem (new DrawItemEventArgs (dc, ThemeEngine.Current.MenuFont,
- item_rect, i, it.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.ColorButtonShadow),
- e.Bounds.X, e.Bounds.Y, e.Bounds.X + e.Bounds.Width, e.Bounds.Y);
-
- e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
- 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.ColorButtonShadow),
- rect.X, rect.Y , rect.X, rect.Y + rect.Height);
-
- e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
- 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.ColorHilightText;
- color_back = ThemeEngine.Current.ColorHilight;
- }
- 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) {
-
- 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, IntPtr hMenu, Rectangle cliparea, Rectangle rect)
- {
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
-
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
- (ThemeEngine.Current.ColorMenu), cliparea);
-
- /* Draw menu borders */
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHilightText),
- rect.X, rect.Y, rect.X + rect.Width, rect.Y);
-
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHilightText),
- rect.X, rect.Y, rect.X, rect.Y + rect.Height);
-
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
- rect.X + rect.Width - 1 , rect.Y , rect.X + rect.Width - 1, rect.Y + rect.Height);
-
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonDkShadow),
- rect.X + rect.Width, rect.Y , rect.X + rect.Width, rect.Y + rect.Height);
-
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
- 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.ColorButtonDkShadow),
- rect.X , rect.Y + rect.Height, rect.X + rect.Width - 1, rect.Y + rect.Height);
-
- for (int i = 0; i < menu.items.Count; i++)
- if (cliparea.IntersectsWith (((MenuAPI.MENUITEM) menu.items[i]).rect)) {
- MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[i];
- it.item.MenuHeight = menu.Height;
- it.item.PerformDrawItem (new DrawItemEventArgs (dc, ThemeEngine.Current.MenuFont,
- it.rect, i, it.item.Status));
- }
- }
-
- #endregion // Menus
-
- #region MonthCalendar
-
- // draw the month calendar
- public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc) \r
- {
- 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++) \r
- {
- if (i > 0) \r
- {
- y_offset += month_size.Height + calendar_spacing.Height;
- }
- // now adjust for x position
- for (int j=0; j < mc.CalendarDimensions.Width; j++) \r
- {
- if (j > 0) \r
- {
- x_offset += month_size.Width + calendar_spacing.Width;
- } \r
- else \r
- {
- 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)) \r
- {
- dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), bottom_rect);
- if (mc.ShowToday) {
- int today_offset = 5;
- if (mc.ShowTodayCircle) \r
- {
- 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);
- }
- }
-
- // 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) \r
- {
- // 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) \r
- {
- // 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) \r
- {
- // 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++) \r
- {
- int position = i - (int) first_day_of_week;
- if (position < 0) \r
- {
- 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++) \r
- {
- // 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++) \r
- {
- 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);
- }
- }
-
- // 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) \r
- {
- 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) \r
- {
- 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) \r
- {
- // 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);
- }
- }
- }
-
- 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;
-
- 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.DrawImage (pb.Image, (client.Width / 2) - (pb.Image.Width / 2), (client.Height / 2) - (pb.Image.Height / 2));
- break;
- default:
- // Normal, AutoSize
- dc.DrawImage(pb.Image, 0, 0, pb.Image.Width, pb.Image.Height);
- break;
- }
- }
- CPDrawBorderStyle (dc, client, pb.BorderStyle);
- }
-
- 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, ColorButtonFace);
-
- /* 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;
- SolidBrush sb;
- 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
-
- 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);
- }
- }
-
- // 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.ColorButtonFace)), text_rectangle, text_format);
- } else {
- CPDrawStringDisabled(dc, radio_button.Text, radio_button.Font, this.ColorButtonText, text_rectangle, text_format);
- }
-
- 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
- private 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.ColorButtonFace)), rectangle, 0, 359);
- }
- }
- } else {
- // disabled
- // fill control background color regardless of actual backcolor
- graphics.FillPie (ResPool.GetSolidBrush (this.ColorButtonFace), 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.ColorButtonFace)), 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.ColorButtonFace));
- } else if (radio_button.FlatStyle == FlatStyle.Popup && radio_button.is_entered && radio_button.Capture) {
- buttonBrush = ResPool.GetSolidBrush (this.ColorButtonText);
- } 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: {
- 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, ColorButtonHilight, ColorButtonFace);
- dc.FillRectangle (h, intersect);
- }
- break;
- }
- case ScrollBar.ThumbMoving.Forward: {
- 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, ColorButtonHilight, ColorButtonFace), 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);
- break;
- }
-
- case ScrollBar.ThumbMoving.Backwards: {
- 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, ColorButtonHilight, ColorButtonFace), intersect);
- 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: {
- 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, ColorButtonHilight, ColorButtonFace), intersect);
- break;
- }
-
- case ScrollBar.ThumbMoving.Forward: {
- 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, ColorButtonHilight, ColorButtonFace), 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);
- break;
- }
-
- case ScrollBar.ThumbMoving.Backwards: {
- 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, ColorButtonHilight, ColorButtonFace), intersect);
- break;
- }
- }
- }
-
- /* Thumb */
- if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith (thumb_pos))
- DrawScrollButtonPrimitive (dc, thumb_pos, ButtonState.Normal);
- }
-
- 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);
- } 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, ColorButtonFace, area);
-
- }
-
-
- private 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, ColorButtonFace);
- }
-
- 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);
- }
-
- 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, ColorButtonFace);
- CPDrawBorder3D (dc, panel_rect, Border3DStyle.Raised, Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
- }
-
- 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);
- }
- }
-
- private 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;
- }
-
- private 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 (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);
-
-
- 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 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);
-
- 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:
-
- 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);
-
- 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:
-
- 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);
-
- 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
-
- 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);
-
- 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;
- }
- }
-
- 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 (SystemBrushes.Control, paint_area);
- CPDrawBorderStyle (dc, paint_area, control.BorderStyle);
-
- if (control.Divider)
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), 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, ColorButtonFace);
- } else if (button.Hilight) {
- dc.DrawRectangle (ResPool.GetPen (ColorButtonText), buttonArea);
- if (! ddRect.IsEmpty) {
- dc.DrawLine (ResPool.GetPen (ColorButtonText), 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, ColorButtonFace);
- if (! ddRect.IsEmpty) {
- CPDrawBorder3D (dc, ddRect, Border3DStyle.SunkenInner,
- Border3DSide.Left, ColorButtonFace);
- buttonArea.Width -= this.ToolBarDropDownWidth;
- }
- }
- else {
- CPDrawBorder3D (dc, buttonArea, Border3DStyle.RaisedInner,
- Border3DSide.All, ColorButtonFace);
- if (! ddRect.IsEmpty) {
- CPDrawBorder3D (dc, ddRect, Border3DStyle.RaisedInner,
- Border3DSide.Left, ColorButtonFace);
- buttonArea.Width -= this.ToolBarDropDownWidth;
- }
- }
- }
- }
- DrawToolBarButton (dc, button, control.Font, format, paint_area, buttonArea,
- imgRect, image, txtRect, ddRect, flat);
- }
- }
-
- 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 (ColorButtonShadow), buttonArea.X + 1, buttonArea.Y,
- buttonArea.X + 1, buttonArea.Height);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), buttonArea.X + 1 + (int) ResPool.GetPen (ColorButtonFace).Width,
- buttonArea.Y, buttonArea.X + 1 + (int) ResPool.GetPen (ColorButtonFace).Width, buttonArea.Height);
- /* draw a horizontal separator */
- if (button.Wrapper) {
- int y = buttonArea.Height + this.ToolBarSeparatorWidth / 2;
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), 0, y, controlArea.Width, y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), 0, y + 1 + (int) ResPool.GetPen (ColorButtonFace).Width, controlArea.Width,
- y + 1 + (int) ResPool.GetPen (ColorButtonFace).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, ColorButtonHilight, 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, ColorButtonHilight,
- 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, ColorButtonFace);
- }
- }
- if (button.Enabled)
- dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
- else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight,
- 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, ColorButtonFace);
- }
- }
- if (button.Enabled)
- dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
- else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight,
- 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, ColorButtonFace);
- }
- }
- if (button.Enabled)
- dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
- else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight,
- 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.ColorInfoWindow), 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 (ColorButtonShadow), channel_startpoint.X, channel_startpoint.Y,
- 1, thumb_area.Height);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), channel_startpoint.X + 1, channel_startpoint.Y,
- 1, thumb_area.Height);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), 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 (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X , thumb_pos.Y + 10);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X +1, thumb_pos.Y + 9, thumb_pos.X +15, thumb_pos.Y +9);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X +16 + 4, thumb_pos.Y +9 - 4);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X +16, thumb_pos.Y +10);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), 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 (ColorButtonHilight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16 , thumb_pos.Y+ 9);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X, thumb_pos.Y + 5);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 19, thumb_pos.Y + 9, thumb_pos.X +19 , thumb_pos.Y+ 1);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 4, thumb_pos.Y+ 10, thumb_pos.X + 4 + 16, thumb_pos.Y+ 10);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X -1, thumb_pos.Y+ 5);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), 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 (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X+ 19, thumb_pos.Y + 9);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 10, thumb_pos.Y+ 1, thumb_pos.X + 19, thumb_pos.Y + 8);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X+ 20, thumb_pos.Y +10);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), 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 (ColorButtonShadow), channel_startpoint.X, channel_startpoint.Y,
- thumb_area.Width, 1);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), channel_startpoint.X, channel_startpoint.Y + 1,
- thumb_area.Width, 1);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), 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 (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X +9, thumb_pos.Y +15);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X +9 - 4, thumb_pos.Y +16 + 4);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y +16);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), 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 (ColorButtonHilight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1 , thumb_pos.Y +19);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y -1);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), 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 (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 19);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19);
-
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y + 20);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), 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, ColorButtonHilight, ColorButtonFace);
- } else {
- br_thumb = ResPool.GetSolidBrush (ColorButtonFace);
- }
-
-
- /* Control Background */
- if (tb.BackColor == DefaultControlBackColor) {
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), clip_rectangle);
- } else {
- dc.FillRectangle (ResPool.GetSolidBrush (tb.BackColor), clip_rectangle);
- }
-
-
- if (tb.Focused) {
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, Color.Black), area.X, area.Y, area.Width - 1, 1);
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, Color.Black), area.X, area.Y + area.Height - 1, area.Width - 1, 1);
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, Color.Black), area.X, area.Y, 1, area.Height - 1);
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, 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 {\r
- get {\r
- return new Size (121, 97);\r
- }\r
- }\r
-
- #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, ColorButtonFace);
- }
-
- 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(ColorButtonHilight, lineWidth);
- DrawCaptionHelper(graphics, ColorButtonHilight, pen, lineWidth, 1, captionRect, button);
- pen.Dispose();
-
- pen=new Pen(ColorButtonShadow, lineWidth);
- DrawCaptionHelper(graphics, ColorButtonShadow, pen, lineWidth, 0, captionRect, button);
- pen.Dispose();
- return;
- } else {
- pen=new Pen(ColorButtonText, lineWidth);
- DrawCaptionHelper(graphics, ColorButtonText, 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, ColorButtonHilight, SystemPens.ControlLightLight, lineWidth, 1, captionRect, button);
-
- DrawCaptionHelper(graphics, ColorButtonShadow, SystemPens.ControlDark, lineWidth, 0, captionRect, button);
- return;
- } else {
- DrawCaptionHelper(graphics, ColorButtonText, 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, ColorButtonLight, ColorButtonHilight),rectangle);
- }
-
- if ((state & ButtonState.Flat)!=0) {
- ControlPaint.DrawBorder(graphics, rectangle, ColorButtonShadow, 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, ColorButtonFace);
- 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 (ColorButtonFace)), trace_rectangle);
- } else {
- CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
- }
- }
-
- 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 (ColorButtonText), 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);
-
- }
-
- 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 == ColorButtonFace) ? ControlPaint.Dark(ColorButtonFace) : ColorButtonText;
- }
-
- // 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));
-
- 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;
- }
-
-
- 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 (ColorButtonText);
- } else {
- sb=ResPool.GetSolidBrush (ColorButtonFace);
- }
- } else {
- pen=new Pen(Color.White, 1);
- if (enabled==true) {
- sb=ThemeEngine.Current.ResPool.GetSolidBrush (Color.Black);
- } else {
- sb=ResPool.GetSolidBrush (ColorButtonFace);
- }
- }
- 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 (ColorButtonText), 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);
-
- if (area.Width < 12 || area.Height < 12) /* Cannot see a thing at smaller sizes */
- return;
-
- /* Paint arrows */
- switch (type) {
- case ScrollButton.Up: {
- int x = area.X + (area.Width / 2) - 4;
- int y = area.Y + 9;
-
- for (int i = 0; i < 3; i++)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x + i, y - i, x + i + 6 - 2*i, y - i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x + i, y - i, x + i + 6 - 2*i, y - i);
-
-
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x + 3, area.Y + 6, 1, 1);
-
- break;
- }
- case ScrollButton.Down: {
- int x = area.X + (area.Width / 2) - 5;
- int y = area.Y + 5;
-
- for (int i = 4; i != 0; i--)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x + i, y + i, x + i + 8 - 2*i, y + i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x + i, y + i, x + i + 8 - 2*i, y + i);
-
-
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x + 4, y + 4, 1, 1);
- break;
- }
-
- case ScrollButton.Left: {
- int y = area.Y + (area.Height / 2) - 4;
- int x = area.X + 9;
-
- for (int i = 0; i < 3; i++)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x - i, y + i, x - i, y + i + 6 - 2*i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x - i, y + i, x - i, y + i + 6 - 2*i);
-
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x - 3, y + 3, 1, 1);
- break;
- }
-
- case ScrollButton.Right: {
- int y = area.Y + (area.Height / 2) - 5;
- int x = area.X + 5;
-
- for (int i = 4; i != 0; i--)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x + i, y + i, x + i, y + i + 8 - 2*i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x + i, y + i, x + i, y + i + 8 - 2*i);
-
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x + 4, y + 4, 1, 1);
- break;
- }
-
- default:
- break;
-
- }
- }
-
-
- 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 (ColorButtonFace), pt.X - 12, pt.Y, pt.X, pt.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), pt.X, pt.Y, pt.X, pt.Y - 13);
-
- // diagonals
- for (int i = 0; i < 11; i += 4) {
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 2);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), 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 (ColorButtonHilight), 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) {
-
- layoutRectangle.Offset(1.0f, 1.0f);
- graphics.DrawString(s, font, ResPool.GetSolidBrush (ControlPaint.Light(color, 95)), layoutRectangle, format);
- layoutRectangle.Offset(-1.0f, -1.0f);
- graphics.DrawString(s, font, ResPool.GetSolidBrush (ControlPaint.Light(color, 50)), 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, ColorButtonLight, ColorButtonHilight);
-// graphics.FillRectangle(hatchBrush,rectangle);
-// hatchBrush.Dispose();
-// }
-
- // Clear the background
- graphics.FillRectangle (SystemBrushes.Control, rectangle);
-
- if ((State & DrawFrameControlStates.Pushed)!=0 || (State & DrawFrameControlStates.Checked)!=0) {
- graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorButtonFace)), trace_rectangle);
- } else if ((State & DrawFrameControlStates.Flat)!=0) {
- ControlPaint.DrawBorder(graphics, rectangle, ColorButtonShadow, 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, ColorButtonFace);
- } else {
- CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
- }
- } else if ((State & DrawFrameControlStates.ButtonRadio)!=0) {
- Pen penFatDark = new Pen(ColorButtonShadow, 1);
- Pen penFatLight = new Pen(ColorButtonLight, 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, ColorButtonShadow, ButtonBorderStyle.Solid);
- } else {
- CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
- }
-
- /* 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 (ColorButtonFace), area.X + 1,
- area.Y + 1, area.Width - 2 , area.Height - 2);
-
- dc.DrawRectangle (ResPool.GetPen (ColorButtonShadow), area.X,
- area.Y, area.Width, area.Height);
-
- return;
- }
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), area.X, area.Y, area.Width, 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), area.X, area.Y, 1, area.Height);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), area.X + 1, area.Y + 1, area.Width - 1, 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), area.X + 1, area.Y + 2, 1,
- area.Height - 4);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonShadow), area.X + 1, area.Y + area.Height - 2,
- area.Width - 2, 1);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), area.X, area.Y + area.Height -1,
- area.Width , 1);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonShadow), area.X + area.Width - 2,
- area.Y + 1, 1, area.Height -3);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), area.X + area.Width -1,
- area.Y, 1, area.Height - 1);
-
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), 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 (ColorButtonShadow), area.X, area.Y, area.X +area.Width, area.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), area.X, area.Y, area.X, area.Y + area.Height);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), area.X , area.Y + area.Height - 1, area.X + area.Width ,
- area.Y + area.Height - 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), 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 (ColorButtonDkShadow), area.X + 1, area.Top + 1, area.X + 1, area.Bottom - 3);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), 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
-}
+++ /dev/null
-//
-// 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 ();
- }
- }
-}
+++ /dev/null
-//
-// 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,
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 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);
- }
- }
-}
-
+++ /dev/null
-//
-// 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 BorderStyle borderStyle;
- 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;
- borderStyle = 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);
- }
- #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 borderStyle; }
- set {
- if (value == borderStyle)
- return;
-
- borderStyle = value;
- Redraw (false);
- }
- }
-
- [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) {
- if (imageList != null)
- imageList.Dispose ();
- }
-
- 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)
- {
- if (this.Width <= 0 || this.Height <= 0 || this.Visible == false)
- return;
-
- if (redraw) {
- ThemeEngine.Current.DrawToolBar (pevent.Graphics, pevent.ClipRectangle, this);
- redraw = false;
- }
-
- 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
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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);
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 Control active_control; // Control for which the tooltip is currently displayed
- internal Control last_control; // last control the mouse was in; null if the last control did not have a tooltip
- 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.ColorInfoWindow;
-
- VisibleChanged += new EventHandler(ToolTipWindow_VisibleChanged);
-
- SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
- SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
- }
-
- #endregion // ToolTipWindow Class Constructor
-\r
- #region ToolTipWindow Class Protected Instance Methods\r
- protected override void OnCreateControl() {\r
- base.OnCreateControl ();\r
- XplatUI.SetTopmost(this.window.Handle, IntPtr.Zero, true);
- }\r
-
- protected override CreateParams CreateParams {\r
- get {\r
- CreateParams cp;\r
-\r
- cp = base.CreateParams;\r
-\r
- cp.Style = (int)WindowStyles.WS_POPUP;\r
- cp.Style |= (int)WindowStyles.WS_CLIPSIBLINGS;\r
-\r
- cp.ExStyle = (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
-\r
- return cp;\r
- }\r
- }\r
-\r
- protected override void OnPaint(PaintEventArgs pevent) {\r
- // We don't do double-buffering on purpose:\r
- // 1) we'd have to meddle with is_visible, it destroys the buffers if !visible\r
- // 2) We don't draw much, no need to double buffer\r
- ThemeEngine.Current.DrawToolTip(pevent.Graphics, ClientRectangle, this);
-
- base.OnPaint(pevent);
- }\r
-\r
- protected override void Dispose(bool disposing) {\r
- if (disposing) {\r
- this.string_format.Dispose();\r
- }\r
- base.Dispose (disposing);\r
- }\r
-\r
- protected override void WndProc(ref Message m) {\r
- if (m.Msg == (int)Msg.WM_SETFOCUS) {\r
- if (m.WParam != IntPtr.Zero) {\r
- XplatUI.SetFocus(m.WParam);\r
- }\r
- }\r
- base.WndProc (ref m);\r
- }\r
-\r
-\r
- #endregion // ToolTipWindow Class Protected Instance Methods\r
-\r
- #region ToolTipWindow Class Private Methods\r
- private void ToolTipWindow_VisibleChanged(object sender, EventArgs e) {\r
- Control control = (Control)sender;\r
-\r
- if (control.is_visible) {\r
- XplatUI.SetTopmost(control.window.Handle, IntPtr.Zero, true);
- } else {\r
- XplatUI.SetTopmost(control.window.Handle, IntPtr.Zero, false);
- }\r
- }\r
- #endregion // ToolTipWindow Class Protected Instance Methods\r
- }
- #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);
-
- tooltip_window = new ToolTipWindow(this);
- tooltip_window.MouseLeave += new EventHandler(control_MouseLeave);
-
- timer = new Timer();
- timer.Enabled = false;
- timer.Tick +=new EventHandler(timer_Tick);\r
- }
-
- public ToolTip(System.ComponentModel.IContainer cont) : this() {\r
- // Dunno why I'd need the container\r
- }
-
- ~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) {
- return (string)tooltip_strings[control];
- }
-
- public void RemoveAll() {
- tooltip_strings.Clear();
- }
-
- public void SetToolTip(Control control, string caption) {
- tooltip_strings[control] = caption;
-
- control.MouseEnter += new EventHandler(control_MouseEnter);
- control.MouseMove += new MouseEventHandler(control_MouseMove);
- control.MouseLeave += new EventHandler(control_MouseLeave);
- }
-
- public override string ToString() {\r
- return base.ToString() + " InitialDelay: " + initial_delay + ", ShowAlways: " + show_always;\r
- }\r
- #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();
- }
- }
- #endregion // Protected Instance Methods\r
-\r
- #region Private Methods\r
- private void control_MouseEnter(object sender, EventArgs e) {\r
- string text;\r
-\r
- // Whatever we're displaying right now, we don't want it anymore\r
- tooltip_window.Visible = false;\r
- timer.Stop();\r
-\r
- // if we're in the same control as before (how'd that happen?) or if we're not active, leave\r
- if (!is_active || (active_control == (Control)sender)) {\r
- return;\r
- }\r
-\r
- if (!show_always) {\r
- if (((Control)sender).GetContainerControl().ActiveControl == null) {\r
- return;\r
- }\r
- }\r
-\r
- text = (string)tooltip_strings[sender];\r
- if (text != null) {\r
- Size size;
-\r
- size = ThemeEngine.Current.ToolTipSize(tooltip_window, text);\r
- tooltip_window.Width = size.Width;\r
- tooltip_window.Height = size.Height;\r
- tooltip_window.Text = text;\r
-\r
- // FIXME - this needs to be improved; the tooltip will show up under the mouse, which is annoying; use cursor size once implemented\r
-\r
- if ((Control.MousePosition.X+1+tooltip_window.Width) < display_size.Width) {\r
- tooltip_window.Left = Control.MousePosition.X+1;\r
- } else {\r
- tooltip_window.Left = display_size.Width-tooltip_window.Width;\r
- }\r
-\r
- if ((Control.MousePosition.Y+tooltip_window.Height)<display_size.Height) {\r
- tooltip_window.Top = Control.MousePosition.Y;\r
- } else {\r
- tooltip_window.Top = Control.MousePosition.Y-tooltip_window.Height;\r
- }\r
-\r
- // Since we get the mouse enter before the mouse leave, active_control will still be non-null if we were in a \r
- // tooltip'd control; should prolly check on X11 too, and make sure that driver behaves the same way\r
- if (active_control == null) {\r
- timer.Interval = initial_delay;\r
- } else {\r
- timer.Interval = re_show_delay;\r
- }\r
-\r
- active_control = (Control)sender;\r
-\r
- // We're all set, lets wake the timer (which will then make us visible)\r
- timer.Enabled = true;\r
- }\r
- }\r
-\r
- private void timer_Tick(object sender, EventArgs e) {\r
- // Show our pretty selves\r
- timer.Stop();\r
-\r
- // FIXME - Should not need this check../\r
- if (tooltip_window.IsDisposed) {\r
- return;\r
- }\r
-\r
- if (!tooltip_window.Visible) {\r
- // The initial_delay timer kicked in\r
- tooltip_window.Visible = true;\r
- timer.Interval = autopop_delay;\r
- timer.Start();\r
- } else {\r
- // The autopop_delay timer happened\r
- tooltip_window.Visible = false;\r
- }\r
- }\r
-\r
-\r
- private bool MouseInControl(Control control) {\r
- Point m;\r
- Point c;\r
- Size cw;\r
-\r
- if (control == null) {\r
- return false;\r
- }\r
-\r
- m = Control.MousePosition;\r
- c = new Point(control.Bounds.X, control.Bounds.Y);\r
- if (control.parent != null) {
- c = control.parent.PointToScreen(c);
- }
- cw = control.ClientSize;\r
-\r
- if (c.X<=m.X && m.X<(c.X+cw.Width) &&\r
- c.Y<=m.Y && m.Y<(c.Y+cw.Height)) {\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- private void control_MouseLeave(object sender, EventArgs e) {\r
- // In case the timer is still running, stop it\r
- timer.Stop();\r
-\r
- if (!MouseInControl(tooltip_window) && !MouseInControl(active_control)) {\r
- active_control = null;\r
- tooltip_window.Visible = false;\r
- }\r
- }\r
-\r
- private void control_MouseMove(object sender, MouseEventArgs e) {\r
- // Restart the interval, the mouse moved\r
- timer.Stop();\r
- timer.Start();\r
-\r
- }\r
- #endregion // Private Methods\r
- }
-}
+++ /dev/null
-//
-// 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-2005 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.AllPaintingInWmPaint, true);
- SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
- }
-
- #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);
-
- 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 \r
- {
- 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) { \r
- holdclick_timer.Interval = 300;\r
- 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) \r
- {
- 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)\r
- { \r
- Point pnt;\r
- pnt = PointToClient (MousePosition); \r
-\r
- if (thumb_area.Contains (pnt)) {\r
- if (orientation == Orientation.Horizontal) {\r
- if (pnt.X > thumb_pos.X + thumb_pos.Width)
- LargeIncrement ();
-
- if (pnt.X < thumb_pos.X)
- LargeDecrement (); \r
- }\r
- else {\r
- if (pnt.Y > thumb_pos.Y + thumb_pos.Height)
- LargeIncrement ();
-
- if (pnt.Y < thumb_pos.Y)
- LargeDecrement ();
- }
-
- Invalidate (thumb_area);
-\r
- } \r
- }
-
- protected override void SetBoundsCore (int x, int y,int width, int height, BoundsSpecified specified)
- {
- base.SetBoundsCore (x, y,width, height, specified);
- }
-
-
- #endregion // Private Methods
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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 int index;
-
- 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;
- }
-
- #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
- [MonoTODO]
- void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
- throw new NotImplementedException();
- }
- #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;
- }
- }
-
- public Rectangle Bounds {
- get { return bounds; }
- }
-
- public bool Checked {
- get { return check; }
- set {
- if (check == value)
- return;
- check = value;
-
- if (TreeView != null)
- tree_view.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;
- }
- }
-
- public string FullPath {
- get {
- if (tree_view == 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 { image_index = value; }
- }
-
- 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;
- 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;
- }
- }
-
- [ListBindable(false)]
- public TreeNodeCollection Nodes {
- get {
- if (nodes == null)
- nodes = new TreeNodeCollection (this);
- return nodes;
- }
- }
-
- public TreeNode Parent {
- get {
- if (tree_view != null && tree_view.root_node == parent)
- return null;
- return parent;
- }
- }
-
- public TreeNode PrevNode {
- get {
- if (parent == null)
- return null;
- 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)
- tree_view = walk.TreeView;
- walk = walk.parent;
- }
- return tree_view;
- }
- }
-
- public IntPtr Handle {
- get {
- // MS throws a NullReferenceException if the TreeView isn't set...
- if (handle == IntPtr.Zero)
- 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.Refresh();
- }
-
- public void EnsureVisible ()
- {
- if (TreeView == null)
- return;
-
- TreeView.BeginUpdate ();
-
- if (this.Parent != null)
- ExpandParentRecursive (this.Parent);
-
- if (bounds.Y < 0) {
- TreeView.SetTop (this);
- } else if (bounds.Y > TreeView.ClientRectangle.Height) {
- TreeView.SetBottom (this);
- }
-
- TreeView.EndUpdate ();
- }
-
- 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;
- 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
-
- bool BuildFullPath (StringBuilder path)
- {
- if (parent == null)
- return false;
-
- if (parent.BuildFullPath (path))
- path.Append (tree_view.PathSeparator);
-
- path.Append (text);
- return true;
- }
-
- public int Index {
- get { return index; }
- }
-
- private void Expand (bool byInternal)
- {
- if (is_expanded)
- return;
- bool cancel = false;
- if (TreeView != null) {
- TreeViewCancelEventArgs e = new TreeViewCancelEventArgs (this, false, TreeViewAction.Expand);
- TreeView.OnBeforeCollapse (e);
- cancel = e.Cancel;
- }
-
- if (!cancel) {
- is_expanded = true;
- if (TreeView != null)
- TreeView.OnAfterCollapse (new TreeViewEventArgs (this));
- if (IsVisible && TreeView != null)
- TreeView.UpdateBelow (this);
- }
- }
-
- private void Collapse (bool byInternal)
- {
- if (!is_expanded)
- return;
-
- if (tree_view != null && tree_view.root_node == this)
- 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 void UpdateBounds (int x, int y, int width, int height)
- {
- bounds.X = x;
- bounds.Y = y;
- bounds.Width = width;
- bounds.Height = height;
- }
-
- internal void SetAddedData (TreeView tree_view, TreeNode parent, int index)
- {
- this.tree_view = tree_view;
- this.parent = parent;
- this.index = index;
- }
-
- internal void SetIndex (int index)
- {
- this.index = index;
- }
-
- private bool IsInClippingRect
- {
- get {
- if (TreeView == null)
- return false;
- if (bounds.Y < 0 && bounds.Y > tree_view.ClientRectangle.Height)
- return false;
- return true;
- }
- }
- #endregion // Internal & Private Methods and Properties
-
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- SetData (node);
- 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");
- SetData (value);
- 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");
-
- if (owner != null && owner.TreeView != null && owner.TreeView.Sorted)
- return AddSorted (node);
- SetData (node);
- if (count >= nodes.Length)
- Grow ();
- nodes [count++] = node;
-
- if (owner.TreeView != null)
- owner.TreeView.Refresh ();
- return count;
- }
-
- 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 ()
- {
- Array.Clear (nodes, 0, count);
- count = 0;
- }
-
- 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)
- {
- SetData (node);
- IList list = (IList) nodes;
- list.Insert (index, node);
- }
-
- public virtual void Remove (TreeNode node)
- {
- int index = IndexOf (node);
- if (index > 0)
- RemoveAt (index);
- }
-
- public virtual void RemoveAt (int index)
- {
- Array.Copy (nodes, index, nodes, index - 1, count - index);
- count--;
- if (nodes.Length > OrigSize && nodes.Length > (count * 2))
- Shrink ();
- if (owner.TreeView != null)
- owner.TreeView.TotalNodeCount--;
- }
-
- 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];
- nodes [i + 1].SetIndex (i + 1);
- }
- count++;
- nodes [pos] = node;
-
- SetData (node, pos);
- 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].SetIndex (i);
- nodes [i].Nodes.Sort ();
- }
- }
-
- private void SetData (TreeNode node)
- {
- SetData (node, count);
- }
-
- private void SetData (TreeNode node, int pos)
- {
- node.SetAddedData ((owner != null ? owner.TreeView : null), owner, pos);
- }
-
- 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);
- }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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 TreeNodeConverter : TypeConverter {
- #region Public Constructors
- public TreeNodeConverter() {
- }
- #endregion // Public Constructors
-
- #region Public Instance Methods
- [MonoTODO]
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {\r
- return base.CanConvertTo (context, destinationType);\r
- }\r
-
- [MonoTODO]
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {\r
- return base.ConvertTo (context, culture, value, destinationType);\r
- }\r
-
- #endregion // Public Instance Methods
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- private TreeNode top_node;
- internal TreeNode root_node;
- private TreeNodeCollection nodes;
- private int total_node_count;
-
- 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 bool vbar_added;
- private int skipped_nodes;
- private HScrollBar hbar;
- private bool hbar_added;
- private int hbar_offset;
-
- private int update_stack;
-
- 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 int open_node_count = -1;
-
- 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);
-
- SetStyle (ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
- SetStyle (ControlStyles.UserPaint | ControlStyles.Selectable, true);
-
- dash = new Pen (SystemColors.ControlLight, 1);
- dash.DashStyle = DashStyle.Dash;
- }
-
- #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 = selected_node.Bounds;
- if (focused_node != null)
- invalid = Rectangle.Union (focused_node.Bounds, invalid);
- invalid = Rectangle.Union (invalid, value.Bounds);
-
- selected_node = value;
- focused_node = value;
-
- if (full_row_select) {
- invalid.X = 0;
- invalid.Width = ViewportRectangle.Width;
- }
- invalid.Y += 2;
-
- Invalidate (invalid);
-
- OnAfterSelect (new TreeViewEventArgs (value, TreeViewAction.Unknown));
- }
- }
-
- [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 ();
- 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 () {
- if (!IsHandleCreated)
- return;
- update_stack++;
- }
-
- public void CollapseAll () {
- root_node.CollapseAll ();
- }
-
- public void EndUpdate () {
- if (!IsHandleCreated)
- return;
-
- if (update_stack > 1) {
- update_stack--;
- } else {
- update_stack = 0;
- Refresh ();
- }
- }
-
- public void ExpandAll () {
- root_node.ExpandAll ();
- }
-
- public TreeNode GetNodeAt (Point pt) {
- return GetNodeAt (pt.X, pt.Y);
- }
-
- public TreeNode GetNodeAt (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) {
- if (image_list != null)
- image_list.Dispose ();
- }
- base.Dispose (disposing);
- }
-
- protected OwnerDrawPropertyBag GetItemRenderStyles (TreeNode node, int state) {
- return node.prop_bag;
- }
-
- protected override bool IsInputKey (Keys key_data) {
- if (label_edit && (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 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);
- }
-
- 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 int TotalNodeCount {
- get { return total_node_count; }
- set { total_node_count = value; }
- }
-
- 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
- private 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;
- }
- }
-
- [MonoTODO ("Need to know if we are editing, not if editing is enabled")]
- private TreeNode GetNodeAt (int y) {
-
- 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 IsPlusMinusArea (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;
- 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)
- {
- int visible = ClientRectangle.Height / ItemHeight;
-
- OpenTreeNodeEnumerator walk = new OpenTreeNodeEnumerator (node);
- TreeNode top = null;
-
- visible--;
- while (visible-- > 0 && walk.MovePrevious ())
- top = walk.CurrentNode;
-
- if (top != null)
- SetTop (top);
- }
-
- internal void UpdateBelow (TreeNode node)
- {
- // We need to update the current node so the plus/minus block gets update too
- Rectangle invalid = new Rectangle (0, node.Bounds.Top + 2, Width, Height - node.Bounds.Top);
- Invalidate (invalid);
- }
-
- internal void UpdateNode (TreeNode node)
- {
- Rectangle invalid = new Rectangle (0, node.Bounds.Top + 2, Width, node.Bounds.Height);
- Invalidate (invalid);
- }
-
- 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];
- // 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);
-
- int depth = 0;
- int item_height = ItemHeight;
- int height = ClientRectangle.Height;
-
- open_node_count = 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.ColorButtonFace), 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)
- {
- dc.DrawRectangle (new Pen (Color.Black, 2), x + 0.5F + 3, middle - 4.5F, 11, 11);
-
- if (node.Checked) {
- 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.Add (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);
- }
-
- [MonoTODO("When Graphics.MeasureString starts to work correctly use it")]
- private void UpdateNodeBounds (TreeNode node, int x, int y, int item_height, Graphics dc)
- {
-// SizeF size = dc.MeasureString (Text, Font, ClientSize.Width, new StringFormat ());
-// int width = (int) size.Width + 3;
- int width = (int)(node.Text.Length * node.NodeFont.Size * 0.85);
- node.UpdateBounds (x, y, width, item_height);
- }
-
- private void DrawSelectionAndFocus(TreeNode node, Graphics dc, Rectangle r)
- {
- if (!HideSelection && SelectedNode == node)
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorButtonFace), r);
- else
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (node.BackColor), r);
- if (Focused && focused_node == node)
- ControlPaint.DrawFocusRectangle (dc, r, ForeColor, BackColor);
- }
-
- private void DrawStaticNode (TreeNode node, Graphics dc)
- {
- Rectangle r = node.Bounds;
- StringFormat format = new StringFormat ();
- format.LineAlignment = StringAlignment.Center;
-
- r.Y += 2; // we have to adjust this to get nice middle alignment
- if (!full_row_select)
- DrawSelectionAndFocus(node, dc, r);
- r.X += 4;
- r.Width -= 8;
- Color text_color = (Focused && SelectedNode == node ? ThemeEngine.Current.ColorHilightText : node.ForeColor);
- dc.DrawString (node.Text, node.NodeFont, ThemeEngine.Current.ResPool.GetSolidBrush (text_color), r, 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 (visible && checkboxes) {
- DrawNodeCheckBox (node, dc, ox, middle);
- ox += 19;
- }
-
- if (show_lines)
- DrawNodeLines (node, dc, visible, dash, x, y, middle, item_height, _n_count);
-
- if (visible && ImageList != null) {
- 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;
- }
- }
-
- 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)
- {
- if (vbar == null) {
- vbar = new VScrollBar ();
- count_changed = true;
- }
-
- 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;
- }
-
- if (!vbar_added) {
- Controls.Add (vbar);
- vbar.ValueChanged += new EventHandler (VScrollBarValueChanged);
- vbar_added = true;
- }
-
- vbar.Visible = true;
- }
-
- private void AddHorizontalScrollBar ()
- {
- if (hbar == null)
- hbar = new HScrollBar ();
-
- hbar.Bounds = new Rectangle (ClientRectangle.Left, ClientRectangle.Bottom - hbar.Height,
- (add_vscroll ? Width - ThemeEngine.Current.VScrollBarDefaultSize.Width : Width), hbar.Height);
-
- if (!hbar_added) {
- Controls.Add (hbar);
- hbar.ValueChanged += new EventHandler (HScrollBarValueChanged);
- hbar_added = true;
- }
-
- hbar.Visible = true;
- }
-
- private void SizeChangedHandler (object sender, EventArgs e)
- {
- SuspendLayout ();
-
- if (max_node_width > ClientRectangle.Width) {
- add_hscroll = true;
- AddHorizontalScrollBar ();
- }
-
- if (vbar != null) {
- 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) {
- 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 (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;
-
- XplatUI.ScrollWindow (Handle, ViewportRectangle, old_offset - hbar_offset, 0, false);
- }
-
- private int GetOpenNodeCount ()
- {
-
- if (Nodes.Count < 1)
- return 0;
-
- OpenTreeNodeEnumerator e = new OpenTreeNodeEnumerator (root_node.Nodes [0]);
-
- int count = 0;
- while (e.MoveNext ()) {
- count++;
- }
-
- return count;
- }
-
- 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 (IsTextArea (node, e.X) || full_row_select) {
- TreeNode old_selected = selected_node;
- selected_node = 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;
- Rectangle invalid = (old_selected == null ? Rectangle.Empty : old_selected.Bounds);
- invalid = Rectangle.Union (invalid, selected_node.Bounds);
- invalid.Y += 2;
- Invalidate (invalid);
- }
- }
- }
-
- private void MouseUpHandler (object sender, MouseEventArgs e) {
- 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 (focused_node.Bounds, selected_node.Bounds);
- else
- invalid = selected_node.Bounds;
- focused_node = selected_node;
- OnAfterSelect (new TreeViewEventArgs (selected_node, TreeViewAction.ByMouse));
- invalid.Y += 2;
- Invalidate (invalid);
- } else {
- selected_node = focused_node;
- }
-
-
- }
-
- private void MouseMoveHandler (object sender, MouseEventArgs e) {
- if(!select_mmove)
- return;
- TreeNode node = GetNodeAt(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 = GetNodeAt(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 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; }
- }
-
- 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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; }
- }
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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.GotFocus += new EventHandler(UpDownSpinner_GotFocus);
-
- 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();
- }
- }
-
- private void UpDownSpinner_GotFocus(object sender, EventArgs e) {
- this.Select(owner.txtView);
- }
- #endregion // Private & Internal Methods
-
- #region Protected Instance Methods
- protected override void OnMouseDown(MouseEventArgs e) {
- 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 BorderStyle border_style;
- 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;
-
- Controls.Add(txtView);
- Controls.Add(spnSpinner);
-
- 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.AllPaintingInWmPaint, true);
- SetStyle(ControlStyles.DoubleBuffer, true);
- SetStyle(ControlStyles.Opaque, true);
- SetStyle(ControlStyles.ResizeRedraw, true);
- SetStyle(ControlStyles.UserPaint, true);
-
- UpdateEditText();
- }
- #endregion
-
- #region Private Methods
- void reseat_controls() {
- int border = 0;
-
- switch (border_style) {
- case BorderStyle.FixedSingle: border = 1; break;
- case BorderStyle.Fixed3D: border = 2; break;
- }
-
- int text_displacement = 0;
-
- int spinner_width = 16;
- //int spinner_width = ClientSize.Height - 2 * border;
-
- if (_UpDownAlign == LeftRightAlignment.Left) {
- spnSpinner.Bounds = new Rectangle(border, border, spinner_width, ClientSize.Height - 2 * border);
- text_displacement = spnSpinner.Width;
-
- spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
- } else {
- spnSpinner.Bounds = new Rectangle(ClientSize.Width - spinner_width - border, border, spinner_width, ClientSize.Height - 2 * border);
-
- spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
- }
-
- txtView.Bounds = new Rectangle(text_displacement + border, border, ClientSize.Width - spinner_width - 2 * border, Height - 2 * border);
- }
-
- 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) {
- int border = 0;
-
- switch (border_style) {
- case BorderStyle.FixedSingle: {
- ControlPaint.DrawBorder(e.Graphics, ClientRectangle, Color.Black, ButtonBorderStyle.Solid);
- border = 1;
- break;
- }
-
- case BorderStyle.Fixed3D: {
- ControlPaint.DrawBorder3D(e.Graphics,
- ClientRectangle, Border3DStyle.Sunken, Border3DSide.All);
- border = 2;
- break;
- }
- }
-
- Rectangle rect = ClientRectangle;
-
- rect.Inflate(-border, -border);
-
- using (SolidBrush background = new SolidBrush(BackColor)) {
- e.Graphics.FillRectangle(background, rect);
- }
- }
- #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 border_style;
- }
-
- set {
- switch (border_style) {
- case BorderStyle.None:
- case BorderStyle.FixedSingle:
- case BorderStyle.Fixed3D:
- // acceptable types
- break;
-
- default:
- throw new InvalidEnumArgumentException("value", (int)value, typeof(BorderStyle));
- }
-
- border_style = value;
-
- reseat_controls();
-
- Invalidate();
- }
- }
-
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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);
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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 { \r
- internal uint pFiles;\r
- internal uint pt_x;\r
- internal uint pt_y;\r
- internal bool fNC;\r
- internal bool fWide;\r
- internal string pText;\r
- }\r
-
- internal enum DVASPECT {\r
- DVASPECT_CONTENT = 1,\r
- DVASPECT_THUMBNAIL = 2,\r
- DVASPECT_ICON = 4,\r
- DVASPECT_DOCPRINT = 8\r
- }
-
- internal enum TYMED {\r
- TYMED_HGLOBAL = 1,\r
- TYMED_FILE = 2,\r
- TYMED_ISTREAM = 4,\r
- TYMED_ISTORAGE = 8,\r
- TYMED_GDI = 16,\r
- TYMED_MFPICT = 32,\r
- TYMED_ENHMF = 64,\r
- TYMED_NULL = 0\r
- }\r
-\r
- private static readonly Guid IID_IUnknown = new Guid("00000000-0000-0000-C000-000000000046");\r
- private static readonly Guid IID_IDataObject = new Guid("0000010e-0000-0000-C000-000000000046");\r
- 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;
- }
-\r
- 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;\r
- }
-
- internal static uint QueryGetData(IntPtr @this, ref FORMATETC pformatetc) {
- if (FindFormat(pformatetc) != -1) {
- return S_OK;
- }
- return DV_E_FORMATETC;\r
- }
-
- internal static uint GetCanonicalFormatEtc(IntPtr @this, ref FORMATETC pformatetcIn, IntPtr pformatetcOut) {
- Marshal.WriteIntPtr(pformatetcOut, Marshal.SizeOf(typeof(IntPtr)), IntPtr.Zero);
- return E_NOTIMPL;\r
- }
-
- internal static uint SetData(IntPtr this_, ref FORMATETC pformatetc, ref STGMEDIUM pmedium, bool release) {
- return E_NOTIMPL;\r
- }
-
- internal static uint EnumFormatEtc(IntPtr this_, uint direction, IntPtr ppenumFormatEtc) {
- if (direction == DATADIR_GET) {\r
- IntPtr ppenum_ptr;\r
-\r
- ppenum_ptr = IntPtr.Zero;\r
- DragFormatArray = new FORMATETC[DragFormats.Count];\r
-\r
- for (int i = 0; i < DragFormats.Count; i++) {\r
- DragFormatArray[i] = (FORMATETC)DragFormats[i];\r
- }\r
- Win32SHCreateStdEnumFmtEtc((uint)DragFormatArray.Length, DragFormatArray, ref ppenum_ptr);\r
- Marshal.WriteIntPtr(ppenumFormatEtc, ppenum_ptr);\r
- return S_OK;\r
- }\r
- return E_NOTIMPL;\r
- }
-
- 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;\r
- }
-
- 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;\r
- }
-
- internal uint SetData(FORMATETC pformatetc, STGMEDIUM pmedium, bool release) {
- return E_NOTIMPL;\r
- }
-
- internal uint EnumFormatEtc(uint direction, IntPtr ppenumFormatEtc) {
- return E_NOTIMPL;\r
- }
-
- 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)));
-\r
- // LAMESPEC? - according to MSDN, when the any mousebutton is *pressed* it defaults to Drop.\r
- // According to COM customary behaviour it's the other way round; which is what we do here\r
- if (fEscapePressed) {\r
- DragContinueEventArgs.drag_action = DragAction.Cancel;
- } else if ((grfkeyState & (1+2+16)) == 0) { // Left, middle and right mouse button not pressed\r
- DragContinueEventArgs.drag_action = DragAction.Drop;
- } else {\r
- 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;
- }
-\r
- internal static uint GiveFeedback(IntPtr @this, uint pdwEffect) {
- IntPtr window;
-
- window = Marshal.ReadIntPtr(@this, Marshal.SizeOf(typeof(IntPtr)));
-\r
- DragFeedbackEventArgs.effect = (DragDropEffects)pdwEffect;
- DragFeedbackEventArgs.use_default_cursors = true;
-
- Control.FromHandle(window).DnDFeedback(DragFeedbackEventArgs);
-
- if (DragFeedbackEventArgs.use_default_cursors) {\r
- return DRAGDROP_S_USEDEFAULTCURSORS;\r
- }\r
- return S_OK;\r
- }
- }
-
- 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;\r
- format.ptd = IntPtr.Zero;\r
- format.dwAspect = DVASPECT.DVASPECT_CONTENT;\r
- format.lindex = -1;\r
- format.tymed = TYMED.TYMED_HGLOBAL;\r
-
- 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;\r
- 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);\r
-\r
- // Cleanup again\r
- ComIDataObject.ReleaseUnmanaged(data_object);\r
- ComIDropSource.ReleaseUnmanaged(drop_source);\r
- DragFormats.Clear();\r
- DragFormatArray = null;\r
- DragMediums.Clear();\r
-\r
- return (DragDropEffects)result.ToInt32();
- }
-
- internal static bool UnregisterDropTarget(IntPtr Window) {\r
- Win32RevokeDragDrop(Window);\r
- return true;\r
- }\r
-
- internal static bool RegisterDropTarget(IntPtr Window) {\r
- Hwnd hwnd;\r
- IntPtr drop_target;\r
- uint result;\r
-\r
- hwnd = Hwnd.ObjectFromWindow(Window);\r
- if (hwnd == null) {\r
- return false;\r
- }\r
-\r
- drop_target = ComIDropTarget.GetUnmanaged(Window);\r
- hwnd.marshal_free_list.Add(drop_target);\r
- result = Win32RegisterDragDrop(Window, drop_target);\r
-\r
- if (result != S_OK) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-
- // Thanks, Martin
- static MethodInfo CreateFuncPtrInterface(AssemblyBuilder assembly, string MethodName, Type ret_type, int param_count) {\r
- ModuleBuilder mb;\r
- TypeBuilder tb;\r
- Type[] il_param_types;\r
- Type[] param_types;\r
-\r
- mb = assembly.DefineDynamicModule("XplatUIWin32.FuncInterface" + MethodName);\r
- tb = mb.DefineType ("XplatUIWin32.FuncInterface" + MethodName, TypeAttributes.Public);\r
-\r
- param_types = new Type[param_count];\r
- il_param_types = new Type[param_count + 1];\r
-\r
- il_param_types[param_count] = typeof(IntPtr);\r
- for (int i = 0; i < param_count; i++) {\r
- param_types[i] = typeof(IntPtr);\r
- il_param_types[i] = typeof(IntPtr);\r
- }\r
-\r
- MethodBuilder method = tb.DefineMethod (\r
- MethodName, MethodAttributes.Static | MethodAttributes.Public,\r
- ret_type, il_param_types);\r
-\r
- ILGenerator ig = method.GetILGenerator ();\r
- if (param_count > 5) ig.Emit (OpCodes.Ldarg_S, 6);\r
- if (param_count > 4) ig.Emit (OpCodes.Ldarg_S, 5);\r
- if (param_count > 3) ig.Emit (OpCodes.Ldarg_S, 4);\r
- if (param_count > 2) ig.Emit (OpCodes.Ldarg_3);\r
- if (param_count > 1) ig.Emit (OpCodes.Ldarg_2);\r
- if (param_count > 0) ig.Emit (OpCodes.Ldarg_1);\r
- ig.Emit (OpCodes.Ldarg_0);\r
- ig.EmitCalli (OpCodes.Calli, CallingConvention.StdCall, ret_type, param_types);\r
- ig.Emit (OpCodes.Ret);\r
-\r
- Type t = tb.CreateType ();\r
- MethodInfo m = t.GetMethod (MethodName);\r
-\r
- return m;\r
- }\r
-
- [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);
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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.Text;
-using System.Collections;
-using System.Runtime.InteropServices;
-
-
-namespace System.Windows.Forms {
-
- internal class X11Dnd {
-
- private delegate void MimeConverter (IntPtr dsp,
- DataObject data, ref XEvent xevent);
-
- private class MimeHandler {
- public string Name;
- public IntPtr Type;
- public IntPtr NonProtocol;
- public MimeConverter Convert;
-
- public MimeHandler (string name, MimeConverter converter)
- {
- Name = name;
- Convert = converter;
- }
- }
-
- 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 MimeConverter (TextConverter)),
- new MimeHandler ("text/html", new MimeConverter (HtmlConverter)),
- new MimeHandler ("text/uri-list", new MimeConverter (UriListConverter)),
- };
-
- // This version seems to be the most common
- private static readonly uint [] XdndVersion = new uint [] { 4 };
-
- private IntPtr display;
-
-
- private bool initialized;
-
- 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 int converts_pending;
- private bool position_recieved;
- private bool status_sent;
- private IntPtr target;
- private IntPtr source;
- private IntPtr toplevel;
- private DataObject data;
- private Control control;
- private int pos_x, pos_y;
- private DragDropEffects allowed;
- private DragEventArgs drag_event;
-
- public X11Dnd (IntPtr display)
- {
- this.display = display;
- }
-
- public void SetAllowDrop (Hwnd hwnd, bool allow)
- {
- if (!initialized)
- Init ();
-
-// 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;
- }
-
- // return true if the event is handled here
- public bool HandleClientMessage (ref XEvent xevent)
- {
- if (!initialized)
- Init ();
-
- // most common so we check it first
- if (xevent.ClientMessageEvent.message_type == XdndPosition)
- return HandlePositionEvent (ref xevent);
- if (xevent.ClientMessageEvent.message_type == XdndEnter)
- return HandleEnterEvent (ref xevent);
- if (xevent.ClientMessageEvent.message_type == XdndDrop)
- return HandleDropEvent (ref xevent);
- if (xevent.ClientMessageEvent.message_type == XdndLeave)
- return HandleLeaveEvent (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.Convert (display, data, ref xevent);
-
- converts_pending--;
- if (converts_pending <= 0 && position_recieved)
- SendEnterStatus ();
- return true;
- }
-
- private void Reset ()
- {
- ResetSourceData ();
- ResetTargetData ();
- }
-
- private void ResetSourceData ()
- {
- converts_pending = 0;
- data = null;
- }
-
- private void ResetTargetData ()
- {
- position_recieved = false;
- status_sent = false;
- }
-
- private bool HandleEnterEvent (ref XEvent xevent)
- {
- Reset ();
-
- source = xevent.ClientMessageEvent.ptr1;
- toplevel = xevent.AnyEvent.window;
- target = IntPtr.Zero;
-
- ConvertData (ref xevent);
-
- return true;
- }
-
- private bool HandlePositionEvent (ref XEvent xevent)
- {
- int x = (int) xevent.ClientMessageEvent.ptr3 >> 16;
- int 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, x, 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.AllowDrop) {
-// Finish ();
-// return true;
-// }
-
- control = c;
- position_recieved = true;
-
- if (converts_pending > 0)
- return true;
- if (!status_sent) {
- SendEnterStatus ();
- } else {
- SendStatus ();
- 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 HandleDropEvent (ref XEvent xevent)
- {
- Console.WriteLine ("DROPPING EVENT");
- if (control != null && drag_event != null)
- control.DndDrop (drag_event);
- SendFinished ();
- return true;
- }
-
- private bool HandleLeaveEvent (ref XEvent xevent)
- {
- if (control != null && drag_event != null)
- control.DndLeave (drag_event);
- Reset ();
- return true;
- }
-
- private DragDropEffects EffectFromAction (IntPtr action)
- {
- DragDropEffects allowed = DragDropEffects.None;
- if (action == XdndActionCopy)
- allowed = DragDropEffects.Copy;
- if (action == XdndActionMove)
- allowed = DragDropEffects.Move;
- if (action == XdndActionLink)
- allowed = DragDropEffects.Link;
- return allowed;
- }
-
- private IntPtr ActionFromEffect (DragDropEffects effect)
- {
- IntPtr action = IntPtr.Zero;
- if (effect == DragDropEffects.Copy)
- action = XdndActionCopy;
- if (effect == DragDropEffects.Move)
- action = XdndActionMove;
- if (effect == DragDropEffects.Link)
- action = XdndActionLink;
- return action;
- }
-
- private bool ConvertData (ref XEvent xevent)
- {
- bool match = false;
-
- 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 MimeHandler FindHandler (IntPtr atom)
- {
- if (atom == IntPtr.Zero)
- return null;
- foreach (MimeHandler handler in MimeHandlers) {
- if (handler.Type == atom)
- return handler;
- }
- return null;
- }
-
- private void SendStatus ()
- {
- DragDropEffects action = drag_event.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 (drag_event.Effect != DragDropEffects.None)
- xevent.ClientMessageEvent.ptr2 = (IntPtr) 1;
-
- xevent.ClientMessageEvent.ptr5 = ActionFromEffect (action);
- XSendEvent (display, source, false, 0, ref xevent);
- }
-
- private void SendEnterStatus ()
- {
- drag_event = new DragEventArgs (data, 0, pos_x, pos_y,
- allowed, DragDropEffects.None);
- control.DndEnter (drag_event);
-
- 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 (drag_event.Effect != DragDropEffects.None)
- xevent.ClientMessageEvent.ptr2 = (IntPtr) 1;
-
- xevent.ClientMessageEvent.ptr5 = ActionFromEffect (drag_event.Effect);
- XSendEvent (display, source, false, 0, ref xevent);
-
- status_sent = true;
- }
-
- 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);
- }
-
- initialized = true;
- }
-
- 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)));
- }
- }
-
- return res;
- }
-
- private static void UriListConverter (IntPtr display, DataObject data,
- ref XEvent xevent)
- {
- string text = GetText (display, 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]);
- }
-
- private static void TextConverter (IntPtr display, DataObject data, ref XEvent xevent)
- {
- string text = GetText (display, ref xevent, false);
- if (text == null)
- return;
- data.SetData (DataFormats.Text, text);
- data.SetData (DataFormats.UnicodeText, text);
- }
-
- private static void HtmlConverter (IntPtr display, DataObject data, ref XEvent xevent)
- {
- string html = GetText (display, ref xevent, true);
- if (html == null)
- return;
- data.SetData (DataFormats.Html, html);
- }
-
- private static void ImageConverter (IntPtr display, DataObject data, ref XEvent xevent)
- {
- }
-
- private static void RtfConverter (IntPtr display, DataObject data, ref XEvent xevent)
- {
- }
-
- private static string GetText (IntPtr display, 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 ();
- }
-
- [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 XFree(IntPtr data);
- }
-
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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);
- XplatUIX11.PostMessage (msg.hwnd, message, (IntPtr) buffer [0], msg.lParam);
- break;
- case -1:
- message = (msg.message == Msg.WM_KEYDOWN ? Msg.WM_DEADCHAR : Msg.WM_SYSDEADCHAR);
- XplatUIX11.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;
- 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);
-
- }
-
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software",, to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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;
- }
-
- [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,\r
- NorthWestGravity= 1,\r
- NorthGravity = 2,\r
- NorthEastGravity= 3,\r
- WestGravity = 4,\r
- CenterGravity = 5,\r
- EastGravity = 6,\r
- SouthWestGravity= 7,\r
- SouthGravity = 8,\r
- SouthEastGravity= 9,\r
- StaticGravity = 10\r
- }
-
- 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,\r
- XA_CUT_BUFFER1 = 10,\r
- XA_CUT_BUFFER2 = 11,\r
- XA_CUT_BUFFER3 = 12,\r
- XA_CUT_BUFFER4 = 13,\r
- XA_CUT_BUFFER5 = 14,\r
- XA_CUT_BUFFER6 = 15,\r
- XA_CUT_BUFFER7 = 16,\r
- XA_DRAWABLE = 17,\r
- XA_FONT = 18,\r
- XA_INTEGER = 19,\r
- XA_PIXMAP = 20,\r
- XA_POINT = 21,\r
- XA_RECTANGLE = 22,\r
- XA_RESOURCE_MANAGER = 23,\r
- XA_RGB_COLOR_MAP = 24,\r
- XA_RGB_BEST_MAP = 25,
- XA_RGB_BLUE_MAP = 26,\r
- XA_RGB_DEFAULT_MAP = 27,\r
- XA_RGB_GRAY_MAP = 28,\r
- XA_RGB_GREEN_MAP = 29,\r
- XA_RGB_RED_MAP = 30,\r
- XA_STRING = 31,\r
- XA_VISUALID = 32,\r
- XA_WINDOW = 33,\r
- XA_WM_COMMAND = 34,\r
- XA_WM_HINTS = 35,\r
- XA_WM_CLIENT_MACHINE = 36,\r
- XA_WM_ICON_NAME = 37,\r
- XA_WM_ICON_SIZE = 38,\r
- XA_WM_NAME = 39,\r
- XA_WM_NORMAL_HINTS = 40,\r
- XA_WM_SIZE_HINTS = 41,\r
- XA_WM_ZOOM_HINTS = 42,\r
- XA_MIN_SPACE = 43,\r
- XA_NORM_SPACE = 44,\r
- XA_MAX_SPACE = 45,\r
- XA_END_SPACE = 46,\r
- XA_SUPERSCRIPT_X = 47,\r
- XA_SUPERSCRIPT_Y = 48,\r
- XA_SUBSCRIPT_X = 49,\r
- XA_SUBSCRIPT_Y = 50,\r
- XA_UNDERLINE_POSITION = 51,\r
- XA_UNDERLINE_THICKNESS = 52,\r
- XA_STRIKEOUT_ASCENT = 53,\r
- XA_STRIKEOUT_DESCENT = 54,\r
- XA_ITALIC_ANGLE = 55,\r
- XA_X_HEIGHT = 56,\r
- XA_QUAD_WIDTH = 57,\r
- XA_WEIGHT = 58,\r
- XA_POINT_SIZE = 59,\r
- XA_RESOLUTION = 60,\r
- XA_COPYRIGHT = 61,\r
- XA_NOTICE = 62,\r
- XA_FONT_NAME = 63,\r
- XA_FAMILY_NAME = 64,\r
- XA_FULL_NAME = 65,\r
- XA_CAP_HEIGHT = 66,\r
- XA_WM_CLASS = 67,\r
- XA_WM_TRANSIENT_FOR = 68,\r
-\r
- XA_LAST_PREDEFINED = 68\r
- }
-
- [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,\r
- GCPlaneMask = 1<<1,\r
- GCForeground = 1<<2,\r
- GCBackground = 1<<3,\r
- GCLineWidth = 1<<4,\r
- GCLineStyle = 1<<5,\r
- GCCapStyle = 1<<6,\r
- GCJoinStyle = 1<<7,\r
- GCFillStyle = 1<<8,\r
- GCFillRule = 1<<9, \r
- GCTile = 1<<10,\r
- GCStipple = 1<<11,\r
- GCTileStipXOrigin = 1<<12,\r
- GCTileStipYOrigin = 1<<13,\r
- GCFont = 1<<14,\r
- GCSubwindowMode = 1<<15,\r
- GCGraphicsExposures = 1<<16,\r
- GCClipXOrigin = 1<<17,\r
- GCClipYOrigin = 1<<18,\r
- GCClipMask = 1<<19,\r
- GCDashOffset = 1<<20,\r
- GCDashList = 1<<21,\r
- GCArcMode = 1<<22\r
- }
-
- 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 */\r
- GXand = 0x1, /* src AND dst */\r
- GXandReverse = 0x2, /* src AND NOT dst */\r
- GXcopy = 0x3, /* src */\r
- GXandInverted = 0x4, /* NOT src AND dst */\r
- GXnoop = 0x5, /* dst */\r
- GXxor = 0x6, /* src XOR dst */\r
- GXor = 0x7, /* src OR dst */\r
- GXnor = 0x8, /* NOT src AND NOT dst */\r
- GXequiv = 0x9, /* NOT src XOR dst */\r
- GXinvert = 0xa, /* NOT dst */\r
- GXorReverse = 0xb, /* src OR NOT dst */\r
- GXcopyInverted = 0xc, /* NOT src */\r
- GXorInverted = 0xd, /* NOT src OR dst */\r
- GXnand = 0xe, /* NOT src OR NOT dst */\r
- GXset = 0xf /* 1 */\r
- }
-
- internal enum NetWindowManagerState {\r
- Remove = 0,\r
- Add = 1,\r
- Toggle = 2\r
- }\r
-\r
- internal enum RevertTo {\r
- None = 0,\r
- PointerRoot = 1,\r
- Parent = 2\r
- }\r
-\r
- internal enum MapState {\r
- IsUnmapped = 0,\r
- IsUnviewable = 1,\r
- IsViewable = 2\r
- }\r
-\r
- internal enum CursorFontShape {\r
- XC_X_cursor = 0,\r
- XC_arrow = 2,\r
- XC_based_arrow_down = 4,\r
- XC_based_arrow_up = 6,\r
- XC_boat = 8,\r
- XC_bogosity = 10,\r
- XC_bottom_left_corner = 12,\r
- XC_bottom_right_corner = 14,\r
- XC_bottom_side = 16,\r
- XC_bottom_tee = 18,\r
- XC_box_spiral = 20,\r
- XC_center_ptr = 22,\r
-\r
- XC_circle = 24,\r
- XC_clock = 26,\r
- XC_coffee_mug = 28,\r
- XC_cross = 30,\r
- XC_cross_reverse = 32,\r
- XC_crosshair = 34,\r
- XC_diamond_cross = 36,\r
- XC_dot = 38,\r
- XC_dotbox = 40,\r
- XC_double_arrow = 42,\r
- XC_draft_large = 44,\r
- XC_draft_small = 46,\r
-\r
- XC_draped_box = 48,\r
- XC_exchange = 50,\r
- XC_fleur = 52,\r
- XC_gobbler = 54,\r
- XC_gumby = 56,\r
- XC_hand1 = 58,\r
- XC_hand2 = 60,\r
- XC_heart = 62,\r
- XC_icon = 64,\r
- XC_iron_cross = 66,\r
- XC_left_ptr = 68,\r
- XC_left_side = 70,\r
-\r
- XC_left_tee = 72,\r
- XC_left_button = 74,\r
- XC_ll_angle = 76,\r
- XC_lr_angle = 78,\r
- XC_man = 80,\r
- XC_middlebutton = 82,\r
- XC_mouse = 84,\r
- XC_pencil = 86,\r
- XC_pirate = 88,\r
- XC_plus = 90,\r
- XC_question_arrow = 92,\r
- XC_right_ptr = 94,\r
-\r
- XC_right_side = 96,\r
- XC_right_tee = 98,\r
- XC_rightbutton = 100,\r
- XC_rtl_logo = 102,\r
- XC_sailboat = 104,\r
- XC_sb_down_arrow = 106,\r
- XC_sb_h_double_arrow = 108,\r
- XC_sb_left_arrow = 110,\r
- XC_sb_right_arrow = 112,\r
- XC_sb_up_arrow = 114,\r
- XC_sb_v_double_arrow = 116,\r
- XC_sb_shuttle = 118,\r
-\r
- XC_sizing = 120,\r
- XC_spider = 122,\r
- XC_spraycan = 124,\r
- XC_star = 126,\r
- XC_target = 128,\r
- XC_tcross = 130,\r
- XC_top_left_arrow = 132,\r
- XC_top_left_corner = 134,\r
- XC_top_right_corner = 136,\r
- XC_top_side = 138,\r
- XC_top_tee = 140,\r
- XC_trek = 142,\r
-\r
- XC_ul_angle = 144,\r
- XC_umbrella = 146,\r
- XC_ur_angle = 148,\r
- XC_watch = 150,\r
- XC_xterm = 152,\r
- XC_num_glyphs = 154\r
- }\r
-\r
- internal enum SystrayRequest {\r
- SYSTEM_TRAY_REQUEST_DOCK = 0,\r
- SYSTEM_TRAY_BEGIN_MESSAGE = 1,\r
- SYSTEM_TRAY_CANCEL_MESSAGE = 2\r
- }\r
-\r
- [Flags]\r
- internal enum XSizeHintsFlags {\r
- USPosition = (1 << 0),\r
- USSize = (1 << 1),\r
- PPosition = (1 << 2),\r
- PSize = (1 << 3),\r
- PMinSize = (1 << 4),\r
- PMaxSize = (1 << 5),\r
- PResizeInc = (1 << 6),\r
- PAspect = (1 << 7),\r
- PAllHints = (PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect),\r
- PBaseSize = (1 << 8),\r
- PWinGravity = (1 << 9),\r
- }\r
-\r
- [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;
- }\r
-\r
- [Flags]\r
- internal enum XWMHintsFlags {\r
- InputHint = (1 << 0),\r
- StateHint = (1 << 1),\r
- IconPixmapHint = (1 << 2),\r
- IconWindowHint = (1 << 3),\r
- IconPositionHint = (1 << 4),\r
- IconMaskHint = (1 << 5),\r
- WindowGroupHint = (1 << 6),\r
- AllHints = (InputHint | StateHint | IconPixmapHint | IconWindowHint | IconPositionHint | IconMaskHint | WindowGroupHint)\r
- }\r
-\r
- internal enum XInitialState {\r
- DontCareState = 0,\r
- NormalState = 1,\r
- ZoomState = 2,\r
- IconicState = 3,\r
- InactiveState = 4\r
- }\r
-\r
- [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;
- }
-\r
- [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,
-
- 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,\r
- X_ChangeWindowAttributes = 2,\r
- X_GetWindowAttributes = 3,\r
- X_DestroyWindow = 4,\r
- X_DestroySubwindows = 5,\r
- X_ChangeSaveSet = 6,\r
- X_ReparentWindow = 7,\r
- X_MapWindow = 8,\r
- X_MapSubwindows = 9,\r
- X_UnmapWindow = 10,\r
- X_UnmapSubwindows = 11,\r
- X_ConfigureWindow = 12,\r
- X_CirculateWindow = 13,\r
- X_GetGeometry = 14,\r
- X_QueryTree = 15,\r
- X_InternAtom = 16,\r
- X_GetAtomName = 17,\r
- X_ChangeProperty = 18,\r
- X_DeleteProperty = 19,\r
- X_GetProperty = 20,\r
- X_ListProperties = 21,\r
- X_SetSelectionOwner = 22,\r
- X_GetSelectionOwner = 23,\r
- X_ConvertSelection = 24,\r
- X_SendEvent = 25,\r
- X_GrabPointer = 26,\r
- X_UngrabPointer = 27,\r
- X_GrabButton = 28,\r
- X_UngrabButton = 29,\r
- X_ChangeActivePointerGrab = 30,\r
- X_GrabKeyboard = 31,\r
- X_UngrabKeyboard = 32,\r
- X_GrabKey = 33,\r
- X_UngrabKey = 34,\r
- X_AllowEvents = 35,\r
- X_GrabServer = 36,\r
- X_UngrabServer = 37,\r
- X_QueryPointer = 38,\r
- X_GetMotionEvents = 39,\r
- X_TranslateCoords = 40,\r
- X_WarpPointer = 41,\r
- X_SetInputFocus = 42,\r
- X_GetInputFocus = 43,\r
- X_QueryKeymap = 44,\r
- X_OpenFont = 45,\r
- X_CloseFont = 46,\r
- X_QueryFont = 47,\r
- X_QueryTextExtents = 48,\r
- X_ListFonts = 49,\r
- X_ListFontsWithInfo = 50,\r
- X_SetFontPath = 51,\r
- X_GetFontPath = 52,\r
- X_CreatePixmap = 53,\r
- X_FreePixmap = 54,\r
- X_CreateGC = 55,\r
- X_ChangeGC = 56,\r
- X_CopyGC = 57,\r
- X_SetDashes = 58,\r
- X_SetClipRectangles = 59,\r
- X_FreeGC = 60,\r
- X_ClearArea = 61,\r
- X_CopyArea = 62,\r
- X_CopyPlane = 63,\r
- X_PolyPoint = 64,\r
- X_PolyLine = 65,\r
- X_PolySegment = 66,\r
- X_PolyRectangle = 67,\r
- X_PolyArc = 68,\r
- X_FillPoly = 69,\r
- X_PolyFillRectangle = 70,\r
- X_PolyFillArc = 71,\r
- X_PutImage = 72,\r
- X_GetImage = 73,\r
- X_PolyText8 = 74,\r
- X_PolyText16 = 75,\r
- X_ImageText8 = 76,\r
- X_ImageText16 = 77,\r
- X_CreateColormap = 78,\r
- X_FreeColormap = 79,\r
- X_CopyColormapAndFree = 80,\r
- X_InstallColormap = 81,\r
- X_UninstallColormap = 82,\r
- X_ListInstalledColormaps = 83,\r
- X_AllocColor = 84,\r
- X_AllocNamedColor = 85,\r
- X_AllocColorCells = 86,\r
- X_AllocColorPlanes = 87,\r
- X_FreeColors = 88,\r
- X_StoreColors = 89,\r
- X_StoreNamedColor = 90,\r
- X_QueryColors = 91,\r
- X_LookupColor = 92,\r
- X_CreateCursor = 93,\r
- X_CreateGlyphCursor = 94,\r
- X_FreeCursor = 95,\r
- X_RecolorCursor = 96,\r
- X_QueryBestSize = 97,\r
- X_QueryExtension = 98,\r
- X_ListExtensions = 99,\r
- X_ChangeKeyboardMapping = 100,\r
- X_GetKeyboardMapping = 101,\r
- X_ChangeKeyboardControl = 102,\r
- X_GetKeyboardControl = 103,\r
- X_Bell = 104,\r
- X_ChangePointerControl = 105,\r
- X_GetPointerControl = 106,\r
- X_SetScreenSaver = 107,\r
- X_GetScreenSaver = 108,\r
- X_ChangeHosts = 109,\r
- X_ListHosts = 110,\r
- X_SetAccessControl = 111,\r
- X_SetCloseDownMode = 112,\r
- X_KillClient = 113,\r
- X_RotateProperties = 114,\r
- X_ForceScreenSaver = 115,\r
- X_SetPointerMapping = 116,\r
- X_GetPointerMapping = 117,\r
- X_SetModifierMapping = 118,\r
- X_GetModifierMapping = 119,\r
- X_NoOperation = 127\r
- }
-}
+++ /dev/null
-//
-// 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 = 50;
- 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;
- }
- }
- }
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-
-// define to log API calls to stdout
-#undef DriverDebug
-
-using System;
-using System.Drawing;
-using System.ComponentModel;
-using System.Collections;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-/// X11 Version
-namespace System.Windows.Forms {
- internal class XplatUI {
- #region Local Variables
- static XplatUIDriver driver;
- static String default_class_name;
- #endregion // Local Variables
-
- #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: 44786; built: 2005/5/25 22:34:45]");
-
- // 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();
-
- }
-
- ~XplatUI() {
- Console.WriteLine("XplatUI Destructor called");
- }
- #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:X}): Called", handle.ToInt32());
- #endif
- driver.Activate(handle);
- }
-
- internal static bool CalculateWindowRect(IntPtr handle, ref Rectangle ClientRect, int Style, int ExStyle, IntPtr MenuHandle, out Rectangle WindowRect) {
- #if DriverDebug
- Console.WriteLine("CalculateWindowRect({0:X}): Called", handle.ToInt32());
- #endif
- return driver.CalculateWindowRect(handle, ref ClientRect, Style, ExStyle, MenuHandle, 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
- 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
- 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:X}, {1}, {2}): Called", handle.ToInt32(), 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, (ClipboardFormat)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
- Console.WriteLine("DestroyWindow({0:X}): Called", handle.ToInt32());
- #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 EnableThemes() {
- driver.EnableThemes();
- }
-
- internal static void EnableWindow(IntPtr handle, bool Enable) {
- #if DriverDebug
- Console.WriteLine("EnableWindow({0:X}, {1}): Called", handle.ToInt32(), Enable);
- #endif
- driver.EnableWindow(handle, Enable);
- }
-
- internal static void Exit() {
- driver.Exit();
- }
-
- internal static void EraseWindowBackground(IntPtr handle, IntPtr wParam) {
- driver.EraseWindowBackground(handle, wParam);
- }
-
- internal static IntPtr GetActive() {
- #if DriverDebug
- Console.WriteLine("GetActive(): Called");
- #endif
- return driver.GetActive();
- }
-
- 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:X}): 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:X}): Called", handle.ToInt32());
- #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:X}): Called", handle.ToInt32());
- #endif
- return driver.GetMenuDC(handle, ncpaint_region);
- }
-
- internal static Point GetMenuOrigin(IntPtr handle) {
- #if DriverDebug
- Console.WriteLine("GetMenuOrigin({0:X}): Called", handle.ToInt32());
- #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 hWnd) {
- #if DriverDebug
- Console.WriteLine("GetParent({0:X}): Called", hWnd.ToInt32());
- #endif
- return driver.GetParent(hWnd);
- }
-
- internal static bool GetText(IntPtr hWnd, out string text) {
- #if DriverDebug
- Console.WriteLine("GetText(): Called");
- #endif
- return driver.GetText(hWnd, 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:X}): Called", handle.ToInt32());
- #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:X}): Called", handle.ToInt32());
- #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:X}): Called", handle.ToInt32());
- #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:X}, {1}, {2}): Called", handle.ToInt32(), rc, clear);
- #endif
- driver.Invalidate(handle, rc, clear);
- }
-
- internal static bool IsVisible(IntPtr hWnd) {
- #if DriverDebug
- Console.WriteLine("IsVisible({0:X}): Called", hWnd.ToInt32());
- #endif
- return driver.IsVisible(hWnd);
- }
-
- 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:X}, {1}, {2}): Called", handle.ToInt32(), 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
- Console.WriteLine("PaintEventEnd({0:X}, {1}): Called", handle.ToInt32(), client);
- #endif
- driver.PaintEventEnd(handle, client);
- }
-
- internal static PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
- #if DriverDebug
- Console.WriteLine("PaintEventStart({0:X}, {1}): Called", handle.ToInt32(), client);
- #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 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:X}, {1}, {2}): Called", handle.ToInt32(), 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:X}, {1}, {2}): Called", handle.ToInt32(), 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:X}, {1}, {2}, {3}, {4}): Called", handle.ToInt32(), 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:X}, {2}, {3}, {4}): Called", handle.ToInt32(), 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 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, BorderStyle border_style) {
- #if DriverDebug
- Console.WriteLine("SetBorderStyle({0:X}, {1}): Called", handle.ToInt32(), border_style);
- #endif
- driver.SetBorderStyle(handle, border_style);
- }
-
- internal static void SetCaretPos(IntPtr handle, int x, int y) {
- #if DriverDebug
- Console.WriteLine("SetCaretPos({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
- #endif
- driver.SetCaretPos(handle, x, y);
- }
-
- internal static void SetCursor(IntPtr handle, IntPtr cursor) {
- #if DriverDebug
- Console.WriteLine("SetCursor({0:X}, {1:X}): Called", handle.ToInt32(), cursor.ToInt32());
- #endif
- driver.SetCursor(handle, cursor);
- }
-
- internal static void SetCursorPos(IntPtr handle, int x, int y) {
- #if DriverDebug
- Console.WriteLine("SetCursorPos({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
- #endif
- driver.SetCursorPos(handle, x, y);
- }
-
- internal static void SetFocus(IntPtr handle) {
- #if DriverDebug
- Console.WriteLine("SetFocus({0:X}): Called", handle.ToInt32());
- #endif
- driver.SetFocus(handle);
- }
-
- internal static void SetIcon(IntPtr handle, Icon icon) {
- #if DriverDebug
- Console.WriteLine("SetIcon({0:X}, {1}): Called", handle.ToInt32(), icon);
- #endif
- driver.SetIcon(handle, icon);
- }
-
- internal static void SetMenu(IntPtr handle, IntPtr menu_handle) {
- #if DriverDebug
- Console.WriteLine("SetMenu({0:X}, {1:X}): Called", handle.ToInt32(), menu_handle.ToInt32());
- #endif
- driver.SetMenu(handle, menu_handle);
- }
-
- internal static void SetModal(IntPtr handle, bool Modal) {
- #if DriverDebug
- Console.WriteLine("SetModal({0:X}, {1}): Called", handle.ToInt32(), Modal);
- #endif
- driver.SetModal(handle, Modal);
- }
-
- internal static IntPtr SetParent(IntPtr hWnd, IntPtr hParent) {
- #if DriverDebug
- Console.WriteLine("SetParent({0:X}, {1:X}): Called", hWnd.ToInt32(), hParent.ToInt32());
- #endif
- return driver.SetParent(hWnd, 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:X}, {1:X}, {2}): Called", handle.ToInt32(), hWndOwner.ToInt32(), Enabled);
- #endif
- return driver.SetTopmost(handle, hWndOwner, Enabled);
- }
-
- internal static bool SetVisible(IntPtr hWnd, bool visible) {
- #if DriverDebug
- Console.WriteLine("SetVisible({0:X}, {1}): Called", hWnd.ToInt32(), visible);
- #endif
- return driver.SetVisible(hWnd, visible);
- }
-
- internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
- #if DriverDebug
- Console.WriteLine("SetWindowPos({0:X}, {1}, {2}, {3}, {4}): Called", handle.ToInt32(), x, y, width, height);
- #endif
- driver.SetWindowPos(handle, x, y, width, height);
- }
-
- internal static void SetWindowState(IntPtr handle, FormWindowState state) {
- #if DriverDebug
- Console.WriteLine("SetWindowState({0:X} {1}): Called", handle.ToInt32(), state);
- #endif
- driver.SetWindowState(handle, state);
- }
-
- internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
- #if DriverDebug
- Console.WriteLine("SetWindowStyle({0:X}): Called", handle.ToInt32());
- #endif
- driver.SetWindowStyle(handle, cp);
- }
-
- internal static void SetWindowBackground(IntPtr handle, Color color) {
- #if DriverDebug
- Console.WriteLine("SetWindowBackground({0:X}, {1}): Called", handle.ToInt32(), color);
- #endif
- driver.SetWindowBackground(handle, color);
- }
-
- internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
- #if DriverDebug
- Console.WriteLine("SetZOrder({0:X}, {1:X}, {2}, {3}): Called", handle.ToInt32(), AfterhWnd.ToInt32(), 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", handle, data, allowedEffects);
- #endif
- return driver.StartDrag (handle, data, allowedEffects);
- }
-
- internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
- #if DriverDebug
- Console.WriteLine("SystrayAdd({0:X}, {1}): Called", handle.ToInt32(), 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:X}, {1}): Called", handle.ToInt32(), tip);
- #endif
- driver.SystrayChange(handle, tip, icon, ref tt);
- }
-
- internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
- #if DriverDebug
- Console.WriteLine("SystrayRemove({0:X}): Called", handle.ToInt32());
- #endif
- driver.SystrayRemove(handle, ref tt);
- }
-
- internal static bool Text(IntPtr hWnd, string text) {
- #if DriverDebug
- Console.WriteLine("Text({0:X}, {1}): Called", hWnd.ToInt32(), text);
- #endif
- return driver.Text(hWnd, 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:X}): Called", handle.ToInt32());
- #endif
- driver.UngrabWindow(handle);
- }
-
- internal static void UpdateWindow(IntPtr handle) {
- #if DriverDebug
- Console.WriteLine("UpdateWindow({0:X}): Called", handle.ToInt32());
- #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
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-// 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);
-\r
-
- #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 Exit();
-
- 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 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, BorderStyle border_style);
- internal abstract void SetMenu(IntPtr handle, IntPtr menu_handle);
-
- 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 IntPtr SetParent(IntPtr handle, IntPtr parent);
- internal abstract IntPtr GetParent(IntPtr handle);
-
- internal abstract void UpdateWindow(IntPtr handle);
- internal abstract void SetWindowBackground(IntPtr handle, Color color);
- 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 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, IntPtr MenuHandle, 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 EraseWindowBackground(IntPtr handle, IntPtr wParam);
-
- 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);
-
- // 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.Target as AsyncMethodResult;
- 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.Target as AsyncMethodResult;
- object ret = data.Method.DynamicInvoke (data.Args);
-
- if (result != null) {
- 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
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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:
-// 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) {
- if ((cp.Style & (int)WindowStyles.WS_CHILD) != 0) {
- if ((cp.Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
- hwnd.BorderStyle = BorderStyle.Fixed3D;
- } else if ((cp.Style & (int)WindowStyles.WS_BORDER) != 0) {
- hwnd.BorderStyle = BorderStyle.FixedSingle;
- }
- }
-
- if ((cp.ExStyle & (int)WindowStyles.WS_EX_CLIENTEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Sunken;
- } else if ((cp.ExStyle & (int)WindowStyles.WS_EX_STATICEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Flat;
- } else if ((cp.ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Raised;
- } else if ((cp.ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Raised;
- }
-
- if ((cp.Style & (int)WindowStyles.WS_CAPTION) != 0) {
- if ((cp.ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
- hwnd.title_style = TitleStyle.Tool;
- } else {
- hwnd.title_style = TitleStyle.Normal;
- }
- }
- }
-
- 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 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, IntPtr MenuHandle, out Rectangle WindowRect) {
- BorderStyle 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 = BorderStyle.None;
- if ((Style & (int)WindowStyles.WS_CHILD) != 0) {
- if ((Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
- border_style = BorderStyle.Fixed3D;
- } else if ((Style & (int)WindowStyles.WS_BORDER) != 0) {
- border_style = BorderStyle.FixedSingle;
- }
- }
-
- WindowRect = Hwnd.GetWindowRectangle(border_style, MenuHandle, title_style, 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) {\r
- return null;\r
- }\r
-
- internal override void ClipboardClose(IntPtr handle) {\r
- throw new NotImplementedException();\r
- }\r
-\r
- internal override int ClipboardGetID(IntPtr handle, string format) {\r
- return 0;\r
- }\r
-\r
- internal override IntPtr ClipboardOpen() {\r
- throw new NotImplementedException();\r
- }\r
-\r
- internal override object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter) {\r
- throw new NotImplementedException();\r
- }\r
-\r
- internal override void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {\r
- throw new NotImplementedException();\r
- }\r
-
- 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_ERASEBKGND: {
- HIViewSetNeedsDisplay (hwnd.whole_window, true);
- return (IntPtr)1;
- }
- case Msg.WM_DESTROY: {
- if (WindowMapping [hwnd.Handle] != null)
-
- XplatUI.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) {\r
- 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 EraseWindowBackground(IntPtr handle, IntPtr wParam) {
- Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
- HIViewSetNeedsDisplay (hwnd.whole_window, true);
- }
-
-
- internal override 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 (clear)
- hwnd.erase_pending = true;
- 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 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();
- }
-
- if (hwnd.erase_pending) {
- NativeWindow.WndProc (hwnd.client_window, Msg.WM_ERASEBKGND, IntPtr.Zero, IntPtr.Zero);
- hwnd.erase_pending = false;
- }
-
- 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;
- }
-
- public static void 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);
- }
-
- [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 ();
- }
-
- 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) {\r
- throw new NotImplementedException();\r
- }\r
-
-
- 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 SetWindowBackground(IntPtr handle, Color color) {
- Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
-
- if (WindowMapping [hwnd.Handle] != null) {
- RGBColor backColor = new RGBColor ();
- backColor.red = (short)(color.R * 257);
- backColor.green = (short)(color.G * 257);
- backColor.blue = (short)(color.B * 257);
-
- CheckError (SetWindowContentColor ((IntPtr) WindowMapping [hwnd.Handle], ref backColor));
- } else {
- WindowBackgrounds [hwnd] = color;
- }
- }
-
- internal override void SetBorderStyle(IntPtr handle, BorderStyle border_style) {\r
- Hwnd hwnd;\r
-\r
- hwnd = Hwnd.ObjectFromHandle(handle);\r
- hwnd.border_style = border_style;\r
-\r
- // FIXME - do we need to trigger some resize?\r
- }\r
-\r
- internal override void SetMenu(IntPtr handle, IntPtr menu_handle) {\r
- Hwnd hwnd;\r
-\r
- hwnd = Hwnd.ObjectFromHandle(handle);\r
- hwnd.menu_handle = menu_handle;\r
-\r
- // FIXME - do we need to trigger some resize?\r
- }
-
- 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_handle, hwnd.title_style, 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 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 ());
- }
-
- [MonoTODO]
- internal override bool SystrayAdd(IntPtr hwnd, string tip, Icon icon, out ToolTip tt) {\r
- throw new NotImplementedException();\r
- }\r
-
- [MonoTODO]
- internal override bool SystrayChange(IntPtr hwnd, string tip, Icon icon, ref ToolTip tt) {\r
- throw new NotImplementedException();\r
- }\r
-
- [MonoTODO]
- internal override void SystrayRemove(IntPtr hwnd, ref ToolTip tt) {\r
- throw new NotImplementedException();\r
- }
-
- 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;
- }
-
- #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);
- }
-
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.Runtime.InteropServices;
-
-namespace System.Windows.Forms {
- internal enum WindowStyles : int {\r
- WS_OVERLAPPED = 0x00000000,\r
- WS_POPUP = unchecked((int)0x80000000),\r
- WS_CHILD = 0x40000000,\r
- WS_MINIMIZE = 0x20000000,\r
- WS_VISIBLE = 0x10000000,\r
- WS_DISABLED = 0x08000000,\r
- WS_CLIPSIBLINGS = 0x04000000,\r
- WS_CLIPCHILDREN = 0x02000000,\r
- WS_MAXIMIZE = 0x01000000,\r
- WS_CAPTION = 0x00C00000,\r
- WS_BORDER = 0x00800000,\r
- WS_DLGFRAME = 0x00400000,\r
- WS_VSCROLL = 0x00200000,\r
- WS_HSCROLL = 0x00100000,\r
- WS_SYSMENU = 0x00080000,\r
- WS_THICKFRAME = 0x00040000,\r
- WS_GROUP = 0x00020000,\r
- WS_TABSTOP = 0x00010000,\r
- WS_MINIMIZEBOX = 0x00020000,\r
- WS_MAXIMIZEBOX = 0x00010000,\r
- WS_TILED = 0x00000000,\r
- WS_ICONIC = 0x20000000,\r
- WS_SIZEBOX = 0x00040000,\r
- WS_POPUPWINDOW = unchecked((int)0x80880000),\r
- WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,\r
- WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,\r
- WS_CHILDWINDOW = WS_CHILD,\r
-\r
- // Extended Styles\r
- WS_EX_DLGMODALFRAME = 0x00000001,
- WS_EX_DRAGDETECT = 0x00000002,
- WS_EX_NOPARENTNOTIFY = 0x00000004,\r
- WS_EX_TOPMOST = 0x00000008,\r
- WS_EX_ACCEPTFILES = 0x00000010,\r
- WS_EX_TRANSPARENT = 0x00000020,\r
-\r
- WS_EX_MDICHILD = 0x00000040,\r
- WS_EX_TOOLWINDOW = 0x00000080,\r
- WS_EX_WINDOWEDGE = 0x00000100,\r
- WS_EX_CLIENTEDGE = 0x00000200,\r
- WS_EX_CONTEXTHELP = 0x00000400,\r
-\r
- WS_EX_RIGHT = 0x00001000,\r
- WS_EX_LEFT = 0x00000000,\r
- WS_EX_RTLREADING = 0x00002000,\r
- WS_EX_LTRREADING = 0x00000000,\r
- WS_EX_LEFTSCROLLBAR = 0x00004000,\r
- WS_EX_LAYERED = 0x00080000,\r
- WS_EX_RIGHTSCROLLBAR = 0x00000000,\r
-\r
- WS_EX_CONTROLPARENT = 0x00010000,\r
- WS_EX_STATICEDGE = 0x00020000,\r
- WS_EX_APPWINDOW = 0x00040000,\r
- WS_EX_NOINHERITLAYOUT = 0x00100000,\r
- WS_EX_LAYOUTRTL = 0x00400000,\r
- WS_EX_COMPOSITED = 0x02000000,\r
- WS_EX_NOACTIVATE = 0x08000000,\r
-\r
- WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE,\r
- WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST\r
- }\r
-
- internal enum Msg {\r
- WM_NULL = 0x0000,\r
- WM_CREATE = 0x0001,\r
- WM_DESTROY = 0x0002,\r
- WM_MOVE = 0x0003,\r
- WM_SIZE = 0x0005,\r
- WM_ACTIVATE = 0x0006,\r
- WM_SETFOCUS = 0x0007,\r
- WM_KILLFOCUS = 0x0008,\r
- // public const uint WM_SETVISIBLE = 0x0009;\r
- WM_ENABLE = 0x000A,\r
- WM_SETREDRAW = 0x000B,\r
- WM_SETTEXT = 0x000C,\r
- WM_GETTEXT = 0x000D,\r
- WM_GETTEXTLENGTH = 0x000E,\r
- WM_PAINT = 0x000F,\r
- WM_CLOSE = 0x0010,\r
- WM_QUERYENDSESSION = 0x0011,\r
- WM_QUIT = 0x0012,\r
- WM_QUERYOPEN = 0x0013,\r
- WM_ERASEBKGND = 0x0014,\r
- WM_SYSCOLORCHANGE = 0x0015,\r
- WM_ENDSESSION = 0x0016,\r
- // public const uint WM_SYSTEMERROR = 0x0017;\r
- WM_SHOWWINDOW = 0x0018,\r
- WM_CTLCOLOR = 0x0019,\r
- WM_WININICHANGE = 0x001A,\r
- WM_SETTINGCHANGE = 0x001A,\r
- WM_DEVMODECHANGE = 0x001B,\r
- WM_ACTIVATEAPP = 0x001C,\r
- WM_FONTCHANGE = 0x001D,\r
- WM_TIMECHANGE = 0x001E,\r
- WM_CANCELMODE = 0x001F,\r
- WM_SETCURSOR = 0x0020,\r
- WM_MOUSEACTIVATE = 0x0021,\r
- WM_CHILDACTIVATE = 0x0022,\r
- WM_QUEUESYNC = 0x0023,\r
- WM_GETMINMAXINFO = 0x0024,\r
- WM_PAINTICON = 0x0026,\r
- WM_ICONERASEBKGND = 0x0027,\r
- WM_NEXTDLGCTL = 0x0028,\r
- // public const uint WM_ALTTABACTIVE = 0x0029;\r
- WM_SPOOLERSTATUS = 0x002A,\r
- WM_DRAWITEM = 0x002B,\r
- WM_MEASUREITEM = 0x002C,\r
- WM_DELETEITEM = 0x002D,\r
- WM_VKEYTOITEM = 0x002E,\r
- WM_CHARTOITEM = 0x002F,\r
- WM_SETFONT = 0x0030,\r
- WM_GETFONT = 0x0031,\r
- WM_SETHOTKEY = 0x0032,\r
- WM_GETHOTKEY = 0x0033,\r
- // public const uint WM_FILESYSCHANGE = 0x0034;\r
- // public const uint WM_ISACTIVEICON = 0x0035;\r
- // public const uint WM_QUERYPARKICON = 0x0036;\r
- WM_QUERYDRAGICON = 0x0037,\r
- WM_COMPAREITEM = 0x0039,\r
- // public const uint WM_TESTING = 0x003a;\r
- // public const uint WM_OTHERWINDOWCREATED = 0x003c;\r
- WM_GETOBJECT = 0x003D,\r
- // public const uint WM_ACTIVATESHELLWINDOW = 0x003e;\r
- WM_COMPACTING = 0x0041,\r
- WM_COMMNOTIFY = 0x0044 ,\r
- WM_WINDOWPOSCHANGING = 0x0046,\r
- WM_WINDOWPOSCHANGED = 0x0047,\r
- WM_POWER = 0x0048,\r
- WM_COPYDATA = 0x004A,\r
- WM_CANCELJOURNAL = 0x004B,\r
- WM_NOTIFY = 0x004E,\r
- WM_INPUTLANGCHANGEREQUEST = 0x0050,\r
- WM_INPUTLANGCHANGE = 0x0051,\r
- WM_TCARD = 0x0052,\r
- WM_HELP = 0x0053,\r
- WM_USERCHANGED = 0x0054,\r
- WM_NOTIFYFORMAT = 0x0055,\r
- WM_CONTEXTMENU = 0x007B,\r
- WM_STYLECHANGING = 0x007C,\r
- WM_STYLECHANGED = 0x007D,\r
- WM_DISPLAYCHANGE = 0x007E,\r
- WM_GETICON = 0x007F,\r
-\r
- // Non-Client messages\r
- WM_SETICON = 0x0080,\r
- WM_NCCREATE = 0x0081,\r
- WM_NCDESTROY = 0x0082,\r
- WM_NCCALCSIZE = 0x0083,\r
- WM_NCHITTEST = 0x0084,\r
- WM_NCPAINT = 0x0085,\r
- WM_NCACTIVATE = 0x0086,\r
- WM_GETDLGCODE = 0x0087,\r
- WM_SYNCPAINT = 0x0088,\r
- // public const uint WM_SYNCTASK = 0x0089;\r
- WM_NCMOUSEMOVE = 0x00A0,\r
- WM_NCLBUTTONDOWN = 0x00A1,\r
- WM_NCLBUTTONUP = 0x00A2,\r
- WM_NCLBUTTONDBLCLK = 0x00A3,\r
- WM_NCRBUTTONDOWN = 0x00A4,\r
- WM_NCRBUTTONUP = 0x00A5,\r
- WM_NCRBUTTONDBLCLK = 0x00A6,\r
- WM_NCMBUTTONDOWN = 0x00A7,\r
- WM_NCMBUTTONUP = 0x00A8,\r
- WM_NCMBUTTONDBLCLK = 0x00A9,\r
- // public const uint WM_NCXBUTTONDOWN = 0x00ab;\r
- // public const uint WM_NCXBUTTONUP = 0x00ac;\r
- // public const uint WM_NCXBUTTONDBLCLK = 0x00ad;\r
- WM_KEYDOWN = 0x0100,\r
- WM_KEYFIRST = 0x0100,\r
- WM_KEYUP = 0x0101,\r
- WM_CHAR = 0x0102,\r
- WM_DEADCHAR = 0x0103,\r
- WM_SYSKEYDOWN = 0x0104,\r
- WM_SYSKEYUP = 0x0105,\r
- WM_SYSCHAR = 0x0106,\r
- WM_SYSDEADCHAR = 0x0107,\r
- WM_KEYLAST = 0x0108,\r
- WM_IME_STARTCOMPOSITION = 0x010D,\r
- WM_IME_ENDCOMPOSITION = 0x010E,\r
- WM_IME_COMPOSITION = 0x010F,\r
- WM_IME_KEYLAST = 0x010F,\r
- WM_INITDIALOG = 0x0110,\r
- WM_COMMAND = 0x0111,\r
- WM_SYSCOMMAND = 0x0112,\r
- WM_TIMER = 0x0113,\r
- WM_HSCROLL = 0x0114,\r
- WM_VSCROLL = 0x0115,\r
- WM_INITMENU = 0x0116,\r
- WM_INITMENUPOPUP = 0x0117,\r
- // public const uint WM_SYSTIMER = 0x0118;\r
- WM_MENUSELECT = 0x011F,\r
- WM_MENUCHAR = 0x0120,\r
- WM_ENTERIDLE = 0x0121,\r
- WM_MENURBUTTONUP = 0x0122,\r
- WM_MENUDRAG = 0x0123,\r
- WM_MENUGETOBJECT = 0x0124,\r
- WM_UNINITMENUPOPUP = 0x0125,\r
- WM_MENUCOMMAND = 0x0126,\r
- // public const uint WM_CHANGEUISTATE = 0x0127;\r
- // public const uint WM_UPDATEUISTATE = 0x0128;\r
- // public const uint WM_QUERYUISTATE = 0x0129;\r
-\r
- // public const uint WM_LBTRACKPOINT = 0x0131;\r
- WM_CTLCOLORMSGBOX = 0x0132,\r
- WM_CTLCOLOREDIT = 0x0133,\r
- WM_CTLCOLORLISTBOX = 0x0134,\r
- WM_CTLCOLORBTN = 0x0135,\r
- WM_CTLCOLORDLG = 0x0136,\r
- WM_CTLCOLORSCROLLBAR = 0x0137,\r
- WM_CTLCOLORSTATIC = 0x0138,\r
- WM_MOUSEMOVE = 0x0200,\r
- WM_MOUSEFIRST = 0x0200,\r
- WM_LBUTTONDOWN = 0x0201,\r
- WM_LBUTTONUP = 0x0202,\r
- WM_LBUTTONDBLCLK = 0x0203,\r
- WM_RBUTTONDOWN = 0x0204,\r
- WM_RBUTTONUP = 0x0205,\r
- WM_RBUTTONDBLCLK = 0x0206,\r
- WM_MBUTTONDOWN = 0x0207,\r
- WM_MBUTTONUP = 0x0208,\r
- WM_MBUTTONDBLCLK = 0x0209,\r
- WM_MOUSEWHEEL = 0x020A,\r
- WM_MOUSELAST = 0x020D,\r
- // public const uint WM_XBUTTONDOWN = 0x020B;\r
- // public const uint WM_XBUTTONUP = 0x020C;\r
- // public const uint WM_XBUTTONDBLCLK = 0x020D;\r
- WM_PARENTNOTIFY = 0x0210,\r
- WM_ENTERMENULOOP = 0x0211,\r
- WM_EXITMENULOOP = 0x0212,\r
- WM_NEXTMENU = 0x0213,\r
- WM_SIZING = 0x0214,\r
- WM_CAPTURECHANGED = 0x0215,\r
- WM_MOVING = 0x0216,\r
- // public const uint WM_POWERBROADCAST = 0x0218;\r
- WM_DEVICECHANGE = 0x0219,\r
- WM_MDICREATE = 0x0220,\r
- WM_MDIDESTROY = 0x0221,\r
- WM_MDIACTIVATE = 0x0222,\r
- WM_MDIRESTORE = 0x0223,\r
- WM_MDINEXT = 0x0224,\r
- WM_MDIMAXIMIZE = 0x0225,\r
- WM_MDITILE = 0x0226,\r
- WM_MDICASCADE = 0x0227,\r
- WM_MDIICONARRANGE = 0x0228,\r
- WM_MDIGETACTIVE = 0x0229,\r
- /* D&D messages */\r
- // public const uint WM_DROPOBJECT = 0x022A;\r
- // public const uint WM_QUERYDROPOBJECT = 0x022B;\r
- // public const uint WM_BEGINDRAG = 0x022C;\r
- // public const uint WM_DRAGLOOP = 0x022D;\r
- // public const uint WM_DRAGSELECT = 0x022E;\r
- // public const uint WM_DRAGMOVE = 0x022F;\r
- WM_MDISETMENU = 0x0230,\r
- WM_ENTERSIZEMOVE = 0x0231,\r
- WM_EXITSIZEMOVE = 0x0232,\r
- WM_DROPFILES = 0x0233,\r
- WM_MDIREFRESHMENU = 0x0234,\r
- WM_IME_SETCONTEXT = 0x0281,\r
- WM_IME_NOTIFY = 0x0282,\r
- WM_IME_CONTROL = 0x0283,\r
- WM_IME_COMPOSITIONFULL = 0x0284,\r
- WM_IME_SELECT = 0x0285,\r
- WM_IME_CHAR = 0x0286,\r
- WM_IME_REQUEST = 0x0288,\r
- WM_IME_KEYDOWN = 0x0290,\r
- WM_IME_KEYUP = 0x0291,\r
- WM_MOUSEHOVER = 0x02A1,\r
- WM_MOUSELEAVE = 0x02A3,\r
- WM_CUT = 0x0300,\r
- WM_COPY = 0x0301,\r
- WM_PASTE = 0x0302,\r
- WM_CLEAR = 0x0303,\r
- WM_UNDO = 0x0304,\r
- WM_RENDERFORMAT = 0x0305,\r
- WM_RENDERALLFORMATS = 0x0306,\r
- WM_DESTROYCLIPBOARD = 0x0307,\r
- WM_DRAWCLIPBOARD = 0x0308,\r
- WM_PAINTCLIPBOARD = 0x0309,\r
- WM_VSCROLLCLIPBOARD = 0x030A,\r
- WM_SIZECLIPBOARD = 0x030B,\r
- WM_ASKCBFORMATNAME = 0x030C,\r
- WM_CHANGECBCHAIN = 0x030D,\r
- WM_HSCROLLCLIPBOARD = 0x030E,\r
- WM_QUERYNEWPALETTE = 0x030F,\r
- WM_PALETTEISCHANGING = 0x0310,\r
- WM_PALETTECHANGED = 0x0311,\r
- WM_HOTKEY = 0x0312,\r
- WM_PRINT = 0x0317,\r
- WM_PRINTCLIENT = 0x0318,\r
- WM_HANDHELDFIRST = 0x0358,\r
- WM_HANDHELDLAST = 0x035F,\r
- WM_AFXFIRST = 0x0360,\r
- WM_AFXLAST = 0x037F,\r
- WM_PENWINFIRST = 0x0380,\r
- WM_PENWINLAST = 0x038F,\r
- WM_APP = 0x8000,\r
- WM_USER = 0x0400,\r
-\r
- // Our "private" ones\r
- WM_MOUSE_ENTER = 0x0401,\r
- WM_MOUSE_LEAVE = 0x0402,\r
- WM_ASYNC_MESSAGE = 0x0403,\r
- WM_REFLECT = WM_USER + 0x1c00\r
- }\r
-
-#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\r
-\r
- internal enum MsgButtons {\r
- MK_LBUTTON = 0x0001,\r
- MK_RBUTTON = 0x0002,\r
- MK_SHIFT = 0x0004,\r
- MK_CONTROL = 0x0008,\r
- MK_MBUTTON = 0x0010,\r
- MK_XBUTTON1 = 0x0020,\r
- MK_XBUTTON2 = 0x0040,\r
- }
-
- [StructLayout(LayoutKind.Sequential)]\r
- internal struct POINT {\r
- internal int x;\r
- internal int y;\r
- }\r
- \r
- [StructLayout(LayoutKind.Sequential)] \r
- internal struct MSG {\r
- internal IntPtr hwnd;\r
- internal Msg message;\r
- internal IntPtr wParam; \r
- internal IntPtr lParam;\r
- internal uint time; \r
- internal POINT pt;\r
- }\r
-
- 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)]\r
- internal struct HELPINFO {\r
- internal uint cbSize;\r
- internal int iContextType;\r
- internal int iCtrlId;\r
- internal IntPtr hItemHandle;\r
- internal uint dwContextId;\r
- internal POINT MousePos;\r
- }\r
-\r
- internal enum PeekMessageFlags {\r
- PM_NOREMOVE = 0x00000000,\r
- PM_REMOVE = 0x00000001,\r
- PM_NOYIELD = 0x00000002\r
- }
-
- 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,\r
- HTSYSMENU = 3,\r
- HTGROWBOX = 4,\r
- HTSIZE = HTGROWBOX,\r
- HTMENU = 5,\r
- HTHSCROLL = 6,\r
- HTVSCROLL = 7,\r
- HTMINBUTTON = 8,\r
- HTMAXBUTTON = 9,\r
- HTLEFT = 10,\r
- HTRIGHT = 11,\r
- HTTOP = 12,\r
- HTTOPLEFT = 13,\r
- HTTOPRIGHT = 14,\r
- HTBOTTOM = 15,\r
- HTBOTTOMLEFT = 16,\r
- HTBOTTOMRIGHT = 17,\r
- HTBORDER = 18,\r
- HTREDUCE = HTMINBUTTON,\r
- HTZOOM = HTMAXBUTTON,\r
- HTSIZEFIRST = HTLEFT,\r
- HTSIZELAST = HTBOTTOMRIGHT,
- HTOBJECT = 19,\r
- HTCLOSE = 20,\r
- HTHELP = 21
- }
-
- internal enum TitleStyle {
- None = 0,
- Normal = 1,
- Tool = 2
- }
-
- [StructLayout(LayoutKind.Sequential)]\r
- internal struct BITMAPINFOHEADER {\r
- internal uint biSize;\r
- internal int biWidth;\r
- internal int biHeight;\r
- internal ushort biPlanes;\r
- internal ushort biBitCount;\r
- internal uint biCompression;\r
- internal uint biSizeImage;\r
- internal int biXPelsPerMeter;\r
- internal int biYPelsPerMeter;\r
- internal uint biClrUsed;\r
- internal uint biClrImportant;\r
- }\r
-\r
- internal enum ClipboardFormats : ushort {\r
- CF_TEXT = 1,\r
- CF_BITMAP = 2,\r
- CF_METAFILEPICT = 3,\r
- CF_SYLK = 4,\r
- CF_DIF = 5,\r
- CF_TIFF = 6,\r
- CF_OEMTEXT = 7,\r
- CF_DIB = 8,\r
- CF_PALETTE = 9,\r
- CF_PENDATA = 10,\r
- CF_RIFF = 11,\r
- CF_WAVE = 12,\r
- CF_UNICODETEXT = 13,\r
- CF_ENHMETAFILE = 14,\r
- CF_HDROP = 15,\r
- CF_LOCALE = 16,\r
- CF_DIBV5 = 17\r
- }\r
-}
-
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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.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_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 */
- }
-
- private struct COLORREF {
- internal byte B;
- internal byte G;
- internal byte R;
- 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 byte tmFirstChar;
- internal byte tmLastChar;
- internal byte tmDefaultChar;
- internal byte 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)
- }
-
- #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, 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) {
- MemoryStream ms;
- byte[] header;
- byte[] buffer;
- Bitmap bmp;
- BITMAPINFOHEADER bmi;
- int ncolors;
- int palettesize;
- int imagesize;
- int size;
- int offset;
-
- header = new byte[54]; // Size of a BMP file header, without palette
- // Grab the header
- header[0] = (byte)'B';
- header[1] = (byte)'M';
- // 2, 3, 4 and 5 = unsigned int size
- // 6, 7, 8 and 9 = reserved
- // 10, 11, 12 and 13 = offset to image data
-
- // Create a fake BMP header
- 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);
- }
-
- size = 54 + palettesize + imagesize;
- offset = 54 + palettesize;
- buffer = new byte[size];
-
- // Copy the fake BMP file header
- header[2] = (byte)size;
- header[3] = (byte)(size >> 8);
- header[4] = (byte)(size >> 16);
- header[5] = (byte)(size >> 24);
-
- header[10] = (byte)offset;
- header[11] = (byte)(offset >> 8);
- header[12] = (byte)(offset >> 16);
- header[13] = (byte)(offset >> 24);
-
- Array.Copy(header, 0, buffer, 0, 14);
-
- for (int i = 14; i < size; i++) {
- buffer[i] = Marshal.ReadByte(dib_data, i - 14);
- }
-
- ms = new MemoryStream(buffer, 0, size, false);
- bmp = new Bitmap(ms);
- ms.Close();
- 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 Exit() {
- Win32PostQuitMessage(0);
- }
-
- 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;
- IntPtr lParam;
-
- 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;
- }
-
- lParam = IntPtr.Zero;
- if (cp.Param != null && cp.Param is CLIENTCREATESTRUCT) {
- lParam = Marshal.AllocHGlobal(Marshal.SizeOf(cp.Param));
- Marshal.StructureToPtr(cp.Param, lParam, false);
- }
-
- 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, lParam);
-
- if (lParam != IntPtr.Zero) {
- Marshal.FreeHGlobal(lParam);
- }
-
- 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, (IntPtr)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_SHOWNORMAL);
- return;
- }
-
- case FormWindowState.Minimized: {
- Win32ShowWindow(hwnd, WindowPlacementFlags.SW_SHOWMINIMIZED);
- return;
- }
-
- case FormWindowState.Maximized: {
- Win32ShowWindow(hwnd, WindowPlacementFlags.SW_SHOWMAXIMIZED);
- return;
- }
- }
- }
-
- internal override void SetWindowStyle(IntPtr handle, CreateParams cp) {
- Win32SetWindowLong(handle, WindowLong.GWL_STYLE, (IntPtr)cp.Style);
- Win32SetWindowLong(handle, WindowLong.GWL_EXSTYLE, (IntPtr)cp.ExStyle);
- }
-
- internal override void UpdateWindow(IntPtr handle) {
- Win32UpdateWindow(handle);
- }
-
- internal override void SetWindowBackground(IntPtr handle, Color color) {
- Win32SetWindowLong(handle, WindowLong.GWL_USERDATA, (IntPtr)color.ToArgb());
- }
-
- [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;
-
- // FIXME: Figure out why the rectangle is always 0 size
- clip_rect = new Rectangle(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top);
-// clip_rect = new Rectangle(rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top);
-
- if (ps.fErase != 0) {
-Console.WriteLine("Hit Clear background");
- EraseWindowBackground(handle, hdc);
- }
- } 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) {
- if (msg.message==Msg.WM_PAINT) {
- 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 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 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, IntPtr MenuHandle, 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, MenuHandle != IntPtr.Zero, 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) {
- if (override_cursor == IntPtr.Zero) {
- Win32SetCursor(cursor);
- return;
- }
- Win32SetCursor(override_cursor);
- }
-
- internal override void ShowCursor(bool show) {
- Win32ShowCursor(show);
- }
-
- internal override void OverrideCursor(IntPtr cursor) {
- override_cursor = 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 SetModal(IntPtr handle, bool Modal) {
- // we do nothing on Win32; Application.cs simulates modal dialogs by disabling all toplevel windows
- }
-
- 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) {
- ScreenToClient(handle, ref x, ref y);
- }
-
- internal override void MenuToScreen(IntPtr handle, ref int x, ref int y) {
- ClientToScreen(handle, ref x, ref y);
- }
-
- 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);
- }
-
-\r
- internal override void SetBorderStyle(IntPtr handle, BorderStyle border_style) {\r
- Win32SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, \r
- SetWindowPosFlags.SWP_FRAMECHANGED | SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);\r
- }\r
-
- internal override void SetMenu(IntPtr handle, IntPtr menu_handle) {
- // 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 EraseWindowBackground(IntPtr hWnd, IntPtr hDc) {
- IntPtr hbr;
- LOGBRUSH lb;
- uint argb;
- RECT rect;
-
- //msg.wParam
- argb = Win32GetWindowLong(hWnd, WindowLong.GWL_USERDATA);
- lb = new LOGBRUSH();
-
- lb.lbColor.B = (byte)((argb & 0xff0000)>>16);
- lb.lbColor.G = (byte)((argb & 0xff00)>>8);
- lb.lbColor.R = (byte)(argb & 0xff);
-
- lb.lbStyle = LogBrushStyle.BS_SOLID;
- hbr = Win32CreateBrushIndirect(ref lb);
- Win32GetClientRect(hWnd, out rect);
- Win32FillRect(hDc, ref rect, hbr);
- Win32DeleteObject(hbr);
- }
-
- 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;
-
- 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;
- }
- }
-
- switch((ClipboardFormats)type) {
- case ClipboardFormats.CF_UNICODETEXT: {
- hmem = Marshal.StringToHGlobalUni((string)obj);
- Win32EmptyClipboard();
- Win32SetClipboardData((uint)type, hmem);
- return;
- }
-
- 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);
- Win32EmptyClipboard();
- Win32SetClipboardData((uint)type, 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);
- Win32EmptyClipboard();
- 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) {\r
- return Win32DnD.StartDrag(hwnd, data, allowedEffects);\r
- }\r
-
- 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="PostQuitMessage", CallingConvention=CallingConvention.StdCall)]
- private extern static IntPtr Win32PostQuitMessage(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 IntPtr Win32SetWindowLong(IntPtr hwnd, WindowLong index, IntPtr value);
-
- [DllImport ("user32.dll", EntryPoint="GetWindowLong", CallingConvention=CallingConvention.StdCall)]
- private extern static uint Win32GetWindowLong(IntPtr hwnd, WindowLong index);
-
- [DllImport ("gdi32.dll", EntryPoint="DeleteObject", CallingConvention=CallingConvention.StdCall)]
- private extern static bool Win32DeleteObject(IntPtr o);
-
- [DllImport ("user32.dll", EntryPoint="PostMessage", CallingConvention=CallingConvention.StdCall)]
- private extern static bool Win32PostMessage(IntPtr hwnd, Msg msg, IntPtr wParam, IntPtr lParam);
-
- [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 bool 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="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 bool Win32SendMessage(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 bool Win32GlobalUnlock(IntPtr hMem);
- #endregion
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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
-//
-//
-
-// 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;
-#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 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
-
- // 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 bool GetMessageResult; // Value returned by GetMessage()
- 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
- private 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();\r
-
- ErrorExceptions = false;
-
- // X11 Initialization
- SetDisplay(XOpenDisplay(IntPtr.Zero));
- }
-
- ~XplatUIX11() {
- lock (this) {
- if (DisplayHandle!=IntPtr.Zero) {
- XCloseDisplay(DisplayHandle);
- DisplayHandle=IntPtr.Zero;
- }
- }
- }
- #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 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);
-
- GetMessageResult = true;
-
- 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);
-
- // Clipboard support
- //NetAtoms[(int)NA.CLIPBOARD] = XInternAtom(DisplayHandle, "CLIPBOARD", false);
- NetAtoms[(int)NA.CLIPBOARD] = (int)Atom.XA_PRIMARY;
- 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 SetHwndStyles(Hwnd hwnd, CreateParams cp) {
- if ((cp.Style & (int)WindowStyles.WS_CHILD) != 0) {
- if ((cp.Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
- hwnd.BorderStyle = BorderStyle.Fixed3D;
- } else if ((cp.Style & (int)WindowStyles.WS_BORDER) != 0) {
- hwnd.BorderStyle = BorderStyle.FixedSingle;
- }
- }
-
- if ((cp.ExStyle & (int)WindowStyles.WS_EX_CLIENTEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Sunken;
- } else if ((cp.ExStyle & (int)WindowStyles.WS_EX_STATICEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Flat;
- } else if ((cp.ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Raised;
- } else if ((cp.ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
- hwnd.edge_style = Border3DStyle.Raised;
- }
-
- if ((cp.Style & (int)WindowStyles.WS_CAPTION) != 0) {
- if ((cp.ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
- hwnd.title_style = TitleStyle.Tool;
- } else {
- hwnd.title_style = TitleStyle.Normal;
- }
- }
- }
-
- 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_ABOVE];
- 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 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.parent != null) {
- hwnd.x = xevent.ConfigureEvent.x;
- hwnd.y = xevent.ConfigureEvent.y;
- } else {
- IntPtr child;
-
- // We need to 'discount' the window the WM has put us in
- XTranslateCoordinates(DisplayHandle, XGetParent(hwnd.whole_window), RootWindow, xevent.ConfigureEvent.x, xevent.ConfigureEvent.y, out hwnd.x, out hwnd.y, out child);
- }
-
- 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.FireTick ();
- timer.Update (now);
- }
- }
- }
- }
-
- 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);
- }
-
- switch (xevent.type) {
- case XEventName.Expose:
- AddExpose (xevent);
- break;
-
- case XEventName.SelectionClear: {
- // Should we do something?
- break;
- }
-
- case XEventName.SelectionRequest: {
- 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;
-
- buffer = Marshal.StringToHGlobalAnsi((string)Clipboard.Item);
- buflen = 0;
- while (Marshal.ReadByte(buffer, buflen) != 0) {
- buflen++;
- }
-
- // FIXME - we're sending UTF8 always, probably not so nice...
- if (xevent.SelectionRequestEvent.target == (int)Atom.XA_STRING) {
- XChangeProperty(DisplayHandle, xevent.SelectionRequestEvent.requestor, xevent.SelectionRequestEvent.property, xevent.SelectionRequestEvent.target, 8, PropertyMode.Replace, buffer, buflen);
- sel_event.SelectionEvent.property = xevent.SelectionRequestEvent.property;
- } else if (xevent.SelectionRequestEvent.target == NetAtoms[(int)NA.OEMTEXT]) {
- XChangeProperty(DisplayHandle, xevent.SelectionRequestEvent.requestor, xevent.SelectionRequestEvent.property, xevent.SelectionRequestEvent.target, 8, PropertyMode.Replace, buffer, buflen);
- sel_event.SelectionEvent.property = xevent.SelectionRequestEvent.property;
- } else if (xevent.SelectionRequestEvent.target == NetAtoms[(int)NA.UNICODETEXT]) {
- XChangeProperty(DisplayHandle, xevent.SelectionRequestEvent.requestor, xevent.SelectionRequestEvent.property, xevent.SelectionRequestEvent.target, 8, PropertyMode.Replace, buffer, buflen);
- sel_event.SelectionEvent.property = xevent.SelectionRequestEvent.property;
- }
-
- if (buffer != IntPtr.Zero) {
- 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 (Dnd.HandleSelectionNotifyEvent (ref xevent)) {
- break;
- }
- 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;
- }
- }
- 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:
- 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;
- }
- #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 {
- throw new NotImplementedException();
- }
- }
-
- 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) {
- lock (XlibLock) {
- SendNetWMMessage(Hwnd.ObjectFromHandle(handle).whole_window, (IntPtr)NetAtoms[(int)NA._NET_ACTIVE_WINDOW], IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
- //XRaiseWindow(DisplayHandle, handle);
- }
- 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, IntPtr MenuHandle, out Rectangle WindowRect) {
- BorderStyle 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 = BorderStyle.None;
- if ((Style & (int)WindowStyles.WS_CHILD) != 0) {
- if ((Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
- border_style = BorderStyle.Fixed3D;
- } else if ((Style & (int)WindowStyles.WS_BORDER) != 0) {
- border_style = BorderStyle.FixedSingle;
- }
- }
-
- WindowRect = Hwnd.GetWindowRectangle(border_style, MenuHandle, title_style, 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) {\r
- DataFormats.Format f;\r
- int[] result;\r
-\r
- f = DataFormats.Format.List;\r
-\r
- if (XGetSelectionOwner(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD]) == IntPtr.Zero) {\r
- return null;\r
- }\r
-\r
- Clipboard.Formats = new ArrayList();\r
-\r
- while (f != null) {\r
- XConvertSelection(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], f.Id, f.Id, FosterParent, IntPtr.Zero);\r
-\r
- Clipboard.Enumerating = true;\r
- while (Clipboard.Enumerating) {\r
- UpdateMessageQueue();
- }\r
- f = f.Next;\r
- }\r
-\r
- result = new int[Clipboard.Formats.Count];\r
-\r
- for (int i = 0; i < Clipboard.Formats.Count; i++) {\r
- result[i] = (int)Clipboard.Formats[i];\r
- }\r
-\r
- Clipboard.Formats = null;\r
- return result;\r
- }\r
-
- internal override void ClipboardClose(IntPtr handle) {\r
- if (handle != ClipMagic) {\r
- throw new ArgumentException("handle is not a valid clipboard handle");\r
- }\r
- return;\r
- }\r
-\r
- internal override int ClipboardGetID(IntPtr handle, string format) {\r
- if (handle != ClipMagic) {\r
- throw new ArgumentException("handle is not a valid clipboard handle");\r
- }\r
-\r
- if (format == "Text" ) return (int)Atom.XA_STRING;\r
- else if (format == "Bitmap" ) return (int)Atom.XA_BITMAP;\r
- //else if (format == "MetaFilePict" ) return 3;\r
- //else if (format == "SymbolicLink" ) return 4;\r
- //else if (format == "DataInterchangeFormat" ) return 5;\r
- //else if (format == "Tiff" ) return 6;\r
- else if (format == "OEMText" ) return XInternAtom(DisplayHandle, "COMPOUND_TEXT", false);\r
- else if (format == "DeviceIndependentBitmap" ) return (int)Atom.XA_PIXMAP;\r
- else if (format == "Palette" ) return (int)Atom.XA_COLORMAP; // Useless\r
- //else if (format == "PenData" ) return 10;\r
- //else if (format == "RiffAudio" ) return 11;\r
- //else if (format == "WaveAudio" ) return 12;\r
- else if (format == "UnicodeText" ) return XInternAtom(DisplayHandle, "UTF8_STRING", false);\r
- //else if (format == "EnhancedMetafile" ) return 14;\r
- //else if (format == "FileDrop" ) return 15;\r
- //else if (format == "Locale" ) return 16;\r
-\r
- return XInternAtom(DisplayHandle, format, false);\r
- }\r
-\r
- internal override IntPtr ClipboardOpen() {\r
- return ClipMagic;\r
- }\r
-\r
- internal override object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {\r
- XConvertSelection(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], type, type, FosterParent, IntPtr.Zero);\r
-\r
- Clipboard.Retrieving = true;\r
- while (Clipboard.Retrieving) {\r
- UpdateMessageQueue();
- }
-
- return Clipboard.Item;
- }\r
-\r
- internal override void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {\r
- Clipboard.Item = obj;\r
- Clipboard.Type = type;\r
- Clipboard.Converter = converter;\r
-
- if (obj != null) {\r
- XSetSelectionOwner(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], FosterParent, IntPtr.Zero);\r
- } else {\r
- // Clearing the selection\r
- XSetSelectionOwner(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], IntPtr.Zero, IntPtr.Zero);\r
- }\r
- }\r
-
- 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;
-
-
- hwnd = new Hwnd();
-
- SetHwndStyles(hwnd, cp);
-
- 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;
- }
- }
-
- // Save what's under the toolwindow
- if ((cp.ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
- Attributes.save_under = true;
- }
-
-
- // 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;
- }
- }
-
- Attributes.bit_gravity = Gravity.NorthWestGravity;
- Attributes.win_gravity = Gravity.NorthWestGravity;
-
- hwnd.x = X;
- hwnd.y = Y;
- hwnd.width = Width;
- hwnd.height = Height;
- hwnd.parent = Hwnd.ObjectFromHandle(cp.Parent);
-
- 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, SetWindowValuemask.BitGravity | SetWindowValuemask.WinGravity | SetWindowValuemask.SaveUnder | SetWindowValuemask.OverrideRedirect, ref Attributes);
- if (WholeWindow != IntPtr.Zero) {
- ClientWindow = XCreateWindow(DisplayHandle, WholeWindow, ClientRect.X, ClientRect.Y, ClientRect.Width, ClientRect.Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, IntPtr.Zero, SetWindowValuemask.Nothing, 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_hand2;
- break;
- }
-
- case StdCursor.Help: {
- shape = CursorFontShape.XC_question_arrow;
- break;
- }
-
- case StdCursor.HSplit: {
- shape = CursorFontShape.XC_sb_h_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_v_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) {
- switch((Msg)msg.Msg) {
- case Msg.WM_ERASEBKGND: {
- Hwnd hwnd;
-
- hwnd = Hwnd.ObjectFromHandle(msg.HWnd);
- XClearArea(DisplayHandle, hwnd.client_window, hwnd.invalid.X, hwnd.invalid.Y, hwnd.invalid.Width, hwnd.invalid.Height, false);
-
- return (IntPtr)1;
- }
- }
- 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);
- }
-
- 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);
- }
- }
-
- hwnd.Dispose();
- }
-
- internal override IntPtr DispatchMessage(ref MSG msg) {
- return NativeWindow.WndProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
- }
-
- internal override void DoEvents() {
- MSG msg = new MSG ();
-
- if (OverrideCursorHandle != IntPtr.Zero) {
- Cursor.Current = null;
- }
-
- while (PeekMessage(ref msg, IntPtr.Zero, 0, 0, (uint)PeekMessageFlags.PM_REMOVE)) {
- if (msg.message == Msg.WM_PAINT) {
- TranslateMessage (ref msg);
- DispatchMessage (ref msg);
- }
- }
- }
-
- internal override void EnableWindow(IntPtr handle, bool Enable) {
- // We do nothing; On X11 SetModal is used to create modal dialogs, on Win32 this function is used (see comment there)
- }
-
- internal override void EraseWindowBackground(IntPtr handle, IntPtr wParam) {\r
- Hwnd hwnd;\r
-\r
- hwnd = Hwnd.ObjectFromHandle(handle);\r
-\r
- lock (XlibLock) {
- XClearArea (DisplayHandle, hwnd.client_window, hwnd.invalid.Left, hwnd.invalid.Top, hwnd.invalid.Width, hwnd.invalid.Height, false);
- }
- }\r
-
- internal override void Exit() {
- GetMessageResult = false;
- }
-
- 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 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 {
- msg.hwnd= IntPtr.Zero;
- msg.message = Msg.WM_ENTERIDLE;
- return true;
- }
- }
-
- // FIXME - handle filtering
-
- hwnd = Hwnd.GetObjectFromWindow(xevent.AnyEvent.window);
-
- // Handle messages for windows that are already destroyed
- if (hwnd == null) {
- #if DriverDebug
- Console.WriteLine("GetMessage(): Got message {0} for non-existent 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;
- ClientToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);\r
- }
- msg.wParam=GetMousewParam(0);
- break;
- }
-
- case 2: {
- MouseState |= MouseButtons.Middle;
- if (client) {
- msg.message = Msg.WM_MBUTTONDOWN;
- } else {
- msg.message = Msg.WM_NCMBUTTONDOWN;
- ClientToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);\r
- }
- msg.wParam=GetMousewParam(0);
- break;
- }
-
- case 3: {
- MouseState |= MouseButtons.Right;
- if (client) {
- msg.message = Msg.WM_RBUTTONDOWN;
- } else {
- msg.message = Msg.WM_NCRBUTTONDOWN;
- ClientToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);\r
- }
- 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 (!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: {
- switch(xevent.ButtonEvent.button) {
- case 1: {
- MouseState &= ~MouseButtons.Left;
- msg.message = client ? Msg.WM_LBUTTONUP : Msg.WM_NCLBUTTONUP;
- msg.wParam=GetMousewParam(0);
- break;
- }
-
- case 2: {
- MouseState &= ~MouseButtons.Middle;
- msg.message = client ? Msg.WM_MBUTTONUP : Msg.WM_NCMBUTTONUP;
- msg.wParam=GetMousewParam(0);
- break;
- }
-
- case 3: {
- MouseState &= ~MouseButtons.Right;
- msg.message = client ? Msg.WM_RBUTTONUP : Msg.WM_NCRBUTTONUP;
- msg.wParam=GetMousewParam(0);
- break;
- }
-
- case 4: {
- return true;
- }
-
- case 5: {
- return true;
- }
- }
-
- 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
- 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);
-
- 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_NCHITTEST;
- msg.lParam = (IntPtr) (xevent.MotionEvent.y << 16 | xevent.MotionEvent.x & 0xFFFF);
-
- MousePosition.X = xevent.MotionEvent.x;
- MousePosition.Y = xevent.MotionEvent.y;
- }
-
- break;
- }
-
- case XEventName.EnterNotify: {
- if (xevent.CrossingEvent.mode != NotifyMode.NotifyNormal) {
- return true;
- }
- msg.message = Msg.WM_MOUSE_ENTER;
- HoverState.Timer.Enabled = true;
- HoverState.Window = xevent.CrossingEvent.window;
- break;
- }
-
- case XEventName.LeaveNotify: {
- if (xevent.CrossingEvent.mode != NotifyMode.NotifyNormal) {
- return true;
- }
- 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.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: {
- msg.message=Msg.WM_SETFOCUS;
- msg.wParam=IntPtr.Zero;
- break;
- }
-
- case XEventName.FocusOut: {
- msg.message=Msg.WM_KILLFOCUS;
- msg.wParam=IntPtr.Zero;
- break;
- }
-
- case XEventName.Expose: {
- if (!client) {
- #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
- msg.message = Msg.WM_NCPAINT;
- 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) {
- 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;
- 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 GetMessageResult;
- }
-
- 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_handle, hwnd.title_style, 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.ObjectFromHandle(handle).client_window;
-
- if (clear) {
- hwnd.erase_pending = true;
- 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 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) {
- if (hwnd.erase_pending) {
- // In our implementation WM_ERASEBKGND always returns 1; otherwise we'd check the result and only call clear if it returned 0
- NativeWindow.WndProc(hwnd.client_window, Msg.WM_ERASEBKGND, IntPtr.Zero, IntPtr.Zero);
- hwnd.erase_pending = false;
- }
-
- hwnd.client_dc = Graphics.FromHwnd (hwnd.client_window);
- hwnd.client_dc.SetClip(hwnd.invalid);
- paint_event = new PaintEventArgs(hwnd.client_dc, hwnd.invalid);
-
- 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));
-
- 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);
- }
-
- internal static void PostMessage (IntPtr handle, Msg message, IntPtr wparam, IntPtr lparam) {
- XEvent xevent = new XEvent ();
-
- xevent.type = XEventName.ClientMessage;
- xevent.ClientMessageEvent.display = DisplayHandle;
- xevent.ClientMessageEvent.window = Hwnd.ObjectFromHandle(handle).whole_window;
- 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);
- }
-
- 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.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 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 void SetAllowDrop (IntPtr handle, bool value)
- {
- // We allow drop on all windows
- }
-
- internal override void SetBorderStyle(IntPtr handle, BorderStyle border_style) {
- Hwnd hwnd;
-
- hwnd = Hwnd.ObjectFromHandle(handle);
- hwnd.border_style = border_style;
-
- // FIXME - do we need to trigger some resize?
- }
-
- 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, IntPtr menu_handle) {
- Hwnd hwnd;
-
- hwnd = Hwnd.ObjectFromHandle(handle);
- hwnd.menu_handle = menu_handle;
-
- // 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 SetWindowBackground(IntPtr handle, Color color) {
- XColor xcolor;
- Hwnd hwnd;
-
- hwnd = Hwnd.ObjectFromHandle(handle);
- xcolor = new XColor();
-
- xcolor.red = (ushort)(color.R * 257);
- xcolor.green = (ushort)(color.G * 257);
- xcolor.blue = (ushort)(color.B * 257);
-
- lock (XlibLock) {
- XAllocColor(DisplayHandle, DefaultColormap, ref xcolor);
- XSetWindowBackground(DisplayHandle, hwnd.client_window, xcolor.pixel);
- XClearWindow(DisplayHandle, hwnd.client_window);
- }
- }
-
- 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 (width < 1) {
- width = 1;
- }
-
- if (height < 1) {
- height = 1;
- }
-
- client_rect = Hwnd.GetClientRectangle(hwnd.border_style, hwnd.menu_handle, hwnd.title_style, 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;
- }
-
- 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 bool SetZOrder(IntPtr handle, IntPtr after_handle, bool top, bool bottom) {
- Hwnd hwnd;
- Hwnd after_hwnd;
-
- hwnd = Hwnd.ObjectFromHandle(handle);
- if (after_handle != IntPtr.Zero) {
- after_hwnd = Hwnd.ObjectFromHandle(after_handle);
- } else {
- after_hwnd = null;
- }
-
- if (top) {
- lock (XlibLock) {
- XRaiseWindow(DisplayHandle, hwnd.whole_window);
- }
- return true;
- } else if (!bottom) {
- 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 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 true
- if (!hwnd.visible || hwnd.expose_pending) {
- return;
- }
-
- 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
- }
- #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, 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="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")]\r
- internal extern static int XInitThreads();\r
-\r
- [DllImport ("libX11", EntryPoint="XConvertSelection")]\r
- internal extern static int XConvertSelection(IntPtr display, int selection, int target, int property, IntPtr requestor, IntPtr time);\r
-\r
- [DllImport ("libX11", EntryPoint="XGetSelectionOwner")]
- internal extern static IntPtr XGetSelectionOwner(IntPtr display, int selection);
-
- [DllImport ("libX11", EntryPoint="XSetSelectionOwner")]\r
- internal extern static int XSetSelectionOwner(IntPtr display, int selection, IntPtr owner, IntPtr time);\r
- #endregion
- }
-}
+++ /dev/null
-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/ControlEventTest.cs
-System.Windows.Forms/ControlTest.cs
-System.Windows.Forms/DataGridTableStyleTest.cs
-System.Windows.Forms/DataGridTest.cs
-System.Windows.Forms/DataGridTextBoxColumnTest.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/ListBoxEventTest.cs
-System.Windows.Forms/ListBoxTest.cs
-System.Windows.Forms/ListViewEventTest.cs
-System.Windows.Forms/ListViewTest.cs
-System.Windows.Forms/MenuTest.cs
-System.Windows.Forms/MonthCalendarTest.cs
-System.Windows.Forms/ProgressBarTest.cs
-System.Windows.Forms/RadioButtonTest.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
+++ /dev/null
-//\r
-// Copyright (c) 2005 Novell, Inc.\r
-//\r
-// Authors:\r
-// Ritvik Mayank (mritvik@novell.com)\r
-//\r
-\r
-using System;\r
-using System.Windows.Forms;\r
-using System.Drawing;\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.Windows.Forms\r
-{\r
- [TestFixture]\r
- public class ButtonTest\r
- {\r
- [Test]\r
- public void FlatStyleTest ()\r
- {\r
- Button B1 = new Button ();\r
- Assert.AreEqual (FlatStyle.Standard, B1.FlatStyle, "#1");\r
- }\r
-\r
- [Test]\r
- public void ImageTest ()\r
- {\r
- Button B1 = new Button ();\r
- B1.Visible = true;\r
- B1.Image = Image.FromFile ("M.gif");\r
- Assert.AreEqual (ContentAlignment.MiddleCenter, B1.ImageAlign, "#2");\r
- }\r
-\r
- [Test]\r
- public void ImageListTest ()\r
- {\r
- Button B1 = new Button ();\r
- B1.Image = Image.FromFile ("M.gif");\r
- Assert.AreEqual (null, B1.ImageList, "#3a");\r
- ImageList ImageList1 = new ImageList ();\r
- ImageList1.Images.Add(Image.FromFile ("M.gif"));\r
- B1.ImageList = ImageList1;\r
- Assert.AreEqual (-1, B1.ImageIndex, "#3b");\r
- B1.ImageIndex = 0;\r
- Assert.AreEqual (1, B1.ImageList.Images.Count, "#3c");\r
- Assert.AreEqual (16, B1.ImageList.ImageSize.Height, "#3d");\r
- Assert.AreEqual (16, B1.ImageList.ImageSize.Width, "#3e");\r
- }\r
-\r
- [Test]\r
- public void IMeModeTest ()\r
- {\r
- Button B1 = new Button ();\r
- Assert.AreEqual (ImeMode.Disable, B1.ImeMode, "#4");\r
- }\r
-\r
- [Test]\r
- public void TextAlignTest ()\r
- {\r
- Button B1 = new Button ();\r
- Assert.AreEqual (ContentAlignment.MiddleCenter, B1.TextAlign, "#5");\r
- }\r
-\r
- [Test]\r
- public void DialogResultTest ()\r
- {\r
- Form f = new Form ();\r
- Button B1 = new Button ();\r
- B1.Text = "DialogResult";\r
- B1.DialogResult = DialogResult.No;\r
- B1.TextAlign = ContentAlignment.BottomRight;\r
- B1.Visible = true;\r
- f.Controls.Add (B1);\r
- Assert.AreEqual (DialogResult.No, B1.DialogResult, "#6");\r
- }\r
-\r
- [Test]\r
- public void PerformClickTest ()\r
- {\r
- Form f = new Form ();\r
- Button B1 = new Button ();\r
- B1.Text = "DialogResult";\r
- B1.Visible = true;\r
- f.Controls.Add (B1);\r
- B1.PerformClick ();\r
- Assert.AreEqual (DialogResult.None, B1.DialogResult, "#7");\r
- }\r
-\r
- [Test]\r
- public void NotifyDefaultTest ()\r
- {\r
- Button B1 = new Button ();\r
- Assert.AreEqual ("System.Windows.Forms.Button, Text: ", B1.ToString (), "#8");\r
- }\r
-\r
- [Test]\r
- public void ToStringTest ()\r
- {\r
- Button B1 = new Button ();\r
- Assert.AreEqual ("System.Windows.Forms.Button, Text: " , B1.ToString (), "#9");\r
- }\r
- }\r
-}\r
+++ /dev/null
-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.
-
-
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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");
- }
- }
-
-}
+++ /dev/null
-
-using System;
-using NUnit.Framework;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Threading;
-
-namespace MonoTests.System.Windows.Forms
-{
- [TestFixture]
- 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");
- }
- }
-}
+++ /dev/null
-//\r
-// Copyright (c) 2005 Novell, Inc.\r
-//\r
-// Authors:\r
-// Ritvik Mayank (mritvik@novell.com)\r
-//\r
-\r
-using System;\r
-using System.Windows.Forms;\r
-using System.Drawing;\r
-using System.Threading;\r
-using System.Reflection;\r
-using System.Runtime.Remoting;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MWF.MonoTest\r
-{\r
- [TestFixture]\r
- public class ControlTest\r
- {\r
- internal static void TestAccessibility(Control c, string Default, string Description, string Name, AccessibleRole Role) {\r
- Assert.AreEqual(false, c.AccessibilityObject == null, "Acc1");\r
- Assert.AreEqual(Default, c.AccessibleDefaultActionDescription, "Acc2");\r
- Assert.AreEqual(Description, c.AccessibleDescription, "Acc3");\r
- Assert.AreEqual(Name, c.AccessibleName, "Acc4");\r
- Assert.AreEqual(Role, c.AccessibleRole, "Acc5");\r
- }\r
-\r
- [Test]\r
- public void PubPropTest()\r
- {\r
- Control c = new Control();\r
-\r
- TestAccessibility(c, null, null, null, AccessibleRole.Default);\r
-\r
- // A\r
- Assert.AreEqual(false, c.AllowDrop , "A1");\r
- Assert.AreEqual(AnchorStyles.Top | AnchorStyles.Left, c.Anchor, "A2");\r
-\r
- // B\r
- Assert.AreEqual("Control", c.BackColor.Name , "B1");\r
- Assert.AreEqual(null, c.BackgroundImage, "B2");\r
- Assert.AreEqual(null, c.BindingContext, "B3");\r
- Assert.AreEqual(0, c.Bottom, "B4");\r
- Assert.AreEqual (new Rectangle (0,0, 0, 0) , c.Bounds , "B5");\r
-\r
- // C\r
- Assert.AreEqual(false, c.CanFocus, "C1");\r
- Assert.AreEqual(true, c.CanSelect, "C2");\r
- Assert.AreEqual(false, c.Capture, "C3");\r
- Assert.AreEqual(true, c.CausesValidation, "C4");\r
- Assert.AreEqual (new Rectangle(0, 0, 0, 0) , c.ClientRectangle , "C5");\r
- Assert.AreEqual (new Size(0, 0), c.ClientSize , "C6");\r
-\r
- string name = c.CompanyName;\r
- if (!name.Equals("Mono Project, Novell, Inc.") && !name.Equals("Microsoft Corporation")) {\r
- Assert.Fail("CompanyName property does not match any accepted value - C7");\r
- }\r
- Assert.AreEqual(null, c.Container, "C8");\r
- Assert.AreEqual(false, c.ContainsFocus, "C9");\r
- Assert.AreEqual(null, c.ContextMenu, "C10");\r
- Assert.AreEqual(0, c.Controls.Count, "C11");\r
- Assert.AreEqual(true, c.Created, "C12");\r
- Assert.AreEqual(Cursors.Default, c.Cursor, "C13");\r
-\r
- // D\r
- Assert.AreEqual(false, c.DataBindings == null, "D1");\r
- Assert.AreEqual("Control", Control.DefaultBackColor.Name, "D2");\r
- Assert.AreEqual("ControlText", Control.DefaultForeColor.Name, "D3");\r
- Assert.AreEqual(FontStyle.Regular, Control.DefaultFont.Style, "D4");\r
- Assert.AreEqual (new Rectangle(0, 0, 0, 0), c.DisplayRectangle , "D5");\r
- Assert.AreEqual(false, c.Disposing, "D6");\r
- Assert.AreEqual(DockStyle.None, c.Dock, "D7");\r
-\r
- // E\r
- Assert.AreEqual(true, c.Enabled, "E1");\r
-\r
- // F\r
- Assert.AreEqual(false, c.Focused, "F1");\r
- Assert.AreEqual(FontStyle.Regular, c.Font.Style, "F2");\r
- Assert.AreEqual(SystemColors.ControlText, c.ForeColor, "F3");\r
-\r
- // G\r
-\r
- // H\r
- Assert.AreEqual (((IWin32Window)c).Handle, c.Handle, "H1");\r
- Assert.AreEqual(false, c.HasChildren, "H2");\r
- Assert.AreEqual(0, c.Height, "H3");\r
-\r
- // I\r
- Assert.AreEqual (ImeMode.NoControl, c.ImeMode, "I1");\r
- Assert.AreEqual(false, c.InvokeRequired, "I2");\r
- Assert.AreEqual(false, c.IsAccessible, "I3");\r
- Assert.AreEqual(false, c.IsDisposed, "I4");\r
- Assert.AreEqual(true, c.IsHandleCreated, "I5");\r
-\r
- // J\r
-\r
- // K\r
-\r
- // L\r
- Assert.AreEqual(0, c.Left, "L1");\r
- Assert.AreEqual(Point.Empty, c.Location, "L2");\r
-\r
- // M\r
- Assert.AreEqual(Keys.None, Control.ModifierKeys, "M1");\r
- Assert.AreEqual(false, Control.MousePosition.IsEmpty, "M2");\r
- Assert.AreEqual(MouseButtons.None, Control.MouseButtons, "M3");\r
-\r
- // N\r
- Assert.AreEqual("", c.Name, "N1");\r
-\r
- // O\r
-\r
- // P\r
- Assert.AreEqual(null, c.Parent, "P1");\r
- name = c.ProductName;\r
- if (!name.Equals("Novell Mono MWF") && !name.Equals("Microsoft (R) .NET Framework"))\r
- Assert.Fail("ProductName property does not match any accepted value - P2");\r
-\r
- name = c.ProductVersion;\r
- if (!name.Equals("1.1.4322.2032")) {\r
- Assert.Fail("This test is being run against the wrong framework version.\nExpected is Net 1.1sp1. - P3");\r
- }\r
-\r
- // R\r
- Assert.AreEqual(false, c.RecreatingHandle, "R1");\r
- Assert.AreEqual(null, c.Region, "R2");\r
- Assert.AreEqual(0, c.Right, "R3");\r
- Assert.AreEqual(RightToLeft.No, c.RightToLeft, "R4");\r
-\r
- // S\r
- Assert.AreEqual(null, c.Site, "S1");\r
- Assert.AreEqual (new Size(0, 0), c.Size, "S2");\r
-\r
- // T\r
- Assert.AreEqual(0, c.TabIndex , "T1");\r
- Assert.AreEqual(true, c.TabStop, "T2");\r
- Assert.AreEqual(null, c.Tag, "T3");\r
- Assert.AreEqual("", c.Text, "T4");\r
- Assert.AreEqual(0, c.Top, "T5");\r
- Assert.AreEqual(null, c.TopLevelControl, "T6");\r
-\r
- // U\r
-\r
- // V\r
- Assert.AreEqual(true, c.Visible, "V1");\r
-\r
- // W\r
- Assert.AreEqual(0, c.Width, "W1");\r
-\r
- // XYZ\r
- }\r
-\r
- [Test]\r
- public void RelationTest() {\r
- Control c1;\r
- Control c2;\r
-\r
- c1 = new Control();\r
- c2 = new Control();\r
-\r
- Assert.AreEqual(true , c1.Visible , "Rel1");\r
- Assert.AreEqual(false, c1.Contains(c2) , "Rel2");\r
- Assert.AreEqual("System.Windows.Forms.Control", c1.ToString() , "Rel3");\r
-\r
- c1.Controls.Add(c2);\r
- Assert.AreEqual(true , c2.Visible , "Rel4");\r
- Assert.AreEqual(true, c1.Contains(c2) , "Rel5");\r
-\r
- c1.Anchor = AnchorStyles.Top;\r
- c1.SuspendLayout ();\r
- c1.Anchor = AnchorStyles.Left ;\r
- c1.ResumeLayout ();\r
- Assert.AreEqual(AnchorStyles.Left , c1.Anchor, "Rel6");\r
-\r
- c1.SetBounds(10, 20, 30, 40) ;\r
- Assert.AreEqual(new Rectangle(10, 20, 30, 40), c1.Bounds, "Rel7");\r
-\r
- Assert.AreEqual(c1, c2.Parent, "Rel8");\r
- }\r
-\r
- private string TestControl(Control container, Control start, bool forward) {\r
- Control ctl;\r
-\r
- ctl = container.GetNextControl(start, forward);\r
-\r
- if (ctl == null) {\r
- return null;\r
- }\r
-\r
- return ctl.Text;\r
- }\r
-\r
- [Test]\r
- public void TabOrder() {\r
- Form form;\r
- Control active;\r
-
- 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);\r
- Assert.AreEqual(new Size(520, 520), form.ClientSize, "Tab1");\r
-\r
- form.Text = "SWF Taborder Test App Form";\r
- Assert.AreEqual("SWF Taborder Test App Form", form.Text, "Tab2");\r
-\r
- label1.Location = new Point(10, 10);\r
- Assert.AreEqual(new Point(10, 10), label1.Location, "Tab3");\r
- label1.Text = "Label1";\r
- form.Controls.Add(label1);\r
-\r
- label2.Location = new Point(200, 10);\r
- label2.Text = "Label2";\r
- form.Controls.Add(label2);\r
-\r
- group1.Text = "Group1";\r
- group2.Text = "Group2";\r
- group3.Text = "Group3";\r
-\r
- group1.Size = new Size(200, 400);\r
- group2.Size = new Size(200, 400);\r
- group3.Size = new Size(180, 180);\r
- Assert.AreEqual(new Size(180, 180), group3.Size, "Tab4");\r
-\r
- group1.Location = new Point(10, 40);\r
- group2.Location = new Point(220, 40);\r
- group3.Location = new Point(10, 210);\r
-\r
- group1.TabIndex = 30;\r
- Assert.AreEqual(30, group1.TabIndex, "Tab5");\r
- group1.TabStop = true;\r
-\r
- // Don't assign, test automatic assignment\r
- //group2.TabIndex = 0;\r
- group2.TabStop = true;\r
- Assert.AreEqual(0, group2.TabIndex, "Tab6");\r
-\r
- group3.TabIndex = 35;\r
- group3.TabStop = true;\r
-\r
- // Test default tab index\r
- Assert.AreEqual(0, radio11.TabIndex, "Tab7");\r
-\r
- text1.Text = "Edit Control";\r
-\r
- radio11.Text = "Radio 1-1 [Tab1]";\r
- radio12.Text = "Radio 1-2 [Tab2]";\r
- radio13.Text = "Radio 1-3 [Tab3]";\r
- radio14.Text = "Radio 1-4 [Tab4]";\r
-\r
- radio21.Text = "Radio 2-1 [Tab4]";\r
- radio22.Text = "Radio 2-2 [Tab3]";\r
- radio23.Text = "Radio 2-3 [Tab2]";\r
- radio24.Text = "Radio 2-4 [Tab1]";\r
-\r
- radio31.Text = "Radio 3-1 [Tab1]";\r
- radio32.Text = "Radio 3-2 [Tab3]";\r
- radio33.Text = "Radio 3-3 [Tab2]";\r
- radio34.Text = "Radio 3-4 [Tab4]";\r
-\r
- // We don't assign TabIndex for radio1X; test automatic assignment\r
- text1.TabStop = true;\r
- radio11.TabStop = true;\r
-\r
- radio21.TabIndex = 4;\r
- radio22.TabIndex = 3;\r
- radio23.TabIndex = 2;\r
- radio24.TabIndex = 1;\r
- radio24.TabStop = true;\r
-\r
- radio31.TabIndex = 11;\r
- radio31.TabStop = true;\r
- radio32.TabIndex = 13;\r
- radio33.TabIndex = 12;\r
- radio34.TabIndex = 14;\r
-\r
- text1.Location = new Point(10, 100);\r
-\r
- radio11.Location = new Point(10, 20);\r
- radio12.Location = new Point(10, 40);\r
- radio13.Location = new Point(10, 60);\r
- radio14.Location = new Point(10, 80);\r
-\r
- radio21.Location = new Point(10, 20);\r
- radio22.Location = new Point(10, 40);\r
- radio23.Location = new Point(10, 60);\r
- radio24.Location = new Point(10, 80);\r
-\r
- radio31.Location = new Point(10, 20);\r
- radio32.Location = new Point(10, 40);\r
- radio33.Location = new Point(10, 60);\r
- radio34.Location = new Point(10, 80);\r
-\r
- text1.Size = new Size(150, text1.PreferredHeight);\r
-\r
- radio11.Size = new Size(150, 20);\r
- radio12.Size = new Size(150, 20);\r
- radio13.Size = new Size(150, 20);\r
- radio14.Size = new Size(150, 20);\r
-\r
- radio21.Size = new Size(150, 20);\r
- radio22.Size = new Size(150, 20);\r
- radio23.Size = new Size(150, 20);\r
- radio24.Size = new Size(150, 20);\r
-\r
- radio31.Size = new Size(150, 20);\r
- radio32.Size = new Size(150, 20);\r
- radio33.Size = new Size(150, 20);\r
- radio34.Size = new Size(150, 20);\r
-\r
- group1.Controls.Add(text1);\r
-\r
- group1.Controls.Add(radio11);\r
- group1.Controls.Add(radio12);\r
- group1.Controls.Add(radio13);\r
- group1.Controls.Add(radio14);\r
-\r
- group2.Controls.Add(radio21);\r
- group2.Controls.Add(radio22);\r
- group2.Controls.Add(radio23);\r
- group2.Controls.Add(radio24);\r
-\r
- group3.Controls.Add(radio31);\r
- group3.Controls.Add(radio32);\r
- group3.Controls.Add(radio33);\r
- group3.Controls.Add(radio34);\r
-\r
- form.Controls.Add(group1);\r
- form.Controls.Add(group2);\r
- group2.Controls.Add(group3);\r
-\r
- // Perform some tests, the TabIndex stuff below will alter the outcome
- Assert.AreEqual(null, TestControl(group2, radio34, true), "Tab8");\r
- Assert.AreEqual(31, group2.TabIndex, "Tab9");\r
-
- // 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\r
- Assert.AreEqual(null, TestControl(group2, radio34, true), "Tab10");\r
- Assert.AreEqual(radio24.Text, TestControl(group2, group2, true), "Tab11");\r
- Assert.AreEqual(radio31.Text, TestControl(group2, group3, true), "Tab12");\r
- Assert.AreEqual(null, TestControl(group1, radio14, true), "Tab13");\r
- Assert.AreEqual(radio23.Text, TestControl(group2, radio24, true), "Tab14");\r
- Assert.AreEqual(group3.Text, TestControl(group2, radio21, true), "Tab15");\r
- Assert.AreEqual(radio13.Text, TestControl(form, radio12, true), "Tab16");\r
- Assert.AreEqual(label2.Text, TestControl(form, radio14, true), "Tab17");\r
- Assert.AreEqual(group1.Text, TestControl(form, radio34, true), "Tab18");\r
- Assert.AreEqual(radio23.Text, TestControl(group2, radio24, true), "Tab19");\r
-\r
- // Sanity checks\r
- Assert.AreEqual(null, TestControl(radio11, radio21, true), "Tab20");\r
- Assert.AreEqual(text1.Text, TestControl(group1, radio21, true), "Tab21");\r
-\r
- Assert.AreEqual(radio14.Text, TestControl(form, label2, false), "Tab22");\r
- Assert.AreEqual(radio21.Text, TestControl(group2, group3, false), "Tab23");\r
-\r
- Assert.AreEqual(4, radio21.TabIndex, "Tab24");\r
- Assert.AreEqual(1, radio11.TabIndex, "Tab25");\r
- Assert.AreEqual(3, radio13.TabIndex, "Tab26");\r
- Assert.AreEqual(35, group3.TabIndex, "Tab27");\r
- Assert.AreEqual(1, group2.TabIndex, "Tab28");\r
-\r
- Assert.AreEqual(label1.Text, TestControl(form, form, false), "Tab29");\r
- Assert.AreEqual(radio14.Text, TestControl(group1, group1, false), "Tab30");\r
- Assert.AreEqual(radio34.Text, TestControl(group3, group3, false), "Tab31");\r
-\r
- Assert.AreEqual(null, TestControl(label1, label1, false), "Tab31");\r
- Assert.AreEqual(null, TestControl(radio11, radio21, false), "Tab32");\r
- }\r
-\r
- [Test]\r
- public void ScaleTest()\r
- {\r
- Control r1 = new Control();\r
-\r
- r1.Width = 40;\r
- r1.Height = 20;\r
- r1.Scale(2);\r
- Assert.AreEqual(80, r1.Width, "Scale1");\r
- Assert.AreEqual(40, r1.Height, "Scale2");\r
- }\r
-\r
- [Test]\r
- public void TextTest()\r
- {\r
- Control r1 = new Control();\r
- r1.Text = "Hi" ;\r
- Assert.AreEqual("Hi" , r1.Text , "Text1");\r
-\r
- r1.ResetText();\r
- Assert.AreEqual("" , r1.Text , "Text2");\r
- }\r
-\r
- [Test]\r
- public void PubMethodTest7()\r
- {\r
- Control r1 = new Control();\r
- r1.RightToLeft = RightToLeft.Yes ;\r
- r1.ResetRightToLeft() ;\r
- Assert.AreEqual(RightToLeft.No , r1.RightToLeft , "#81");\r
- r1.ImeMode = ImeMode.Off ;\r
- r1.ResetImeMode () ;\r
- Assert.AreEqual(ImeMode.NoControl , r1.ImeMode , "#82");\r
- r1.ForeColor= SystemColors.GrayText ;\r
- r1.ResetForeColor() ;\r
- Assert.AreEqual(SystemColors.ControlText , r1.ForeColor , "#83");\r
- //r1.Font = Font.FromHdc();\r
- r1.ResetFont () ;\r
- //Assert.AreEqual(FontFamily.GenericSansSerif , r1.Font , "#83");\r
- r1.Cursor = Cursors.Hand ;\r
- r1.ResetCursor () ;\r
- Assert.AreEqual(Cursors.Default , r1.Cursor , "#83");\r
- //r1.DataBindings = System.Windows.Forms.Binding ;\r
- //r1.ResetBindings() ;\r
- //Assert.AreEqual(ControlBindingsCollection , r1.DataBindings , "#83");\r
- r1.BackColor = System.Drawing.Color.Black ;\r
- r1.ResetBackColor() ;\r
- Assert.AreEqual( SystemColors.Control , r1.BackColor , "#84");\r
- r1.BackColor = System.Drawing.Color.Black ;\r
- r1.Refresh() ;\r
- Assert.AreEqual( null , r1.Region , "#85");\r
- Rectangle M = new Rectangle(10, 20, 30 ,40);\r
- r1.RectangleToScreen(M) ;\r
- Assert.AreEqual( null , r1.Region , "#86");\r
-\r
- }\r
-\r
- [Test]\r
- public void ScreenClientCoords()\r
- {\r
- Label l;\r
- Point p1;\r
- Point p2;\r
- Point p3;\r
-\r
- l = new Label();\r
- l.Left = 10;\r
- l.Top = 12;\r
- l.Visible = true;\r
- p1 = new Point (10,10);\r
- p2 = l.PointToScreen(p1);\r
- p3 = l.PointToClient(p2);\r
-\r
- Assert.AreEqual (p1, p3, "SC1");\r
- }\r
-\r
- [Test]\r
- public void ContainsTest ()\r
- {\r
- Control t = new Control ();\r
- Control s = new Control ();\r
-\r
- t.Controls.Add (s);\r
-\r
- Assert.AreEqual (true, t.Contains (s), "Con1");\r
- Assert.AreEqual (false, s.Contains (t), "Con2");\r
- Assert.AreEqual (false, s.Contains (null), "Con3");\r
- Assert.AreEqual (false, t.Contains (new Control ()), "Con4");\r
- }\r
-\r
- [Test]\r
- public void CreateHandleTest ()\r
- {\r
- Control parent;\r
- Control child;\r
-\r
- parent = null;\r
- child = null;\r
-\r
- try {\r
- parent = new Control ();\r
- child = new Control ();\r
-\r
- parent.Visible = true;\r
- parent.Controls.Add (child);\r
-\r
- Assert.IsFalse (parent.IsHandleCreated, "CH1");\r
- Assert.IsFalse (child.IsHandleCreated, "CH2");\r
-\r
- parent.CreateControl ();\r
- Assert.IsNotNull (parent.Handle, "CH3");\r
- Assert.IsNotNull (child.Handle, "CH4");\r
- Assert.IsTrue (parent.IsHandleCreated, "CH5");\r
- Assert.IsTrue (child.IsHandleCreated, "CH6");\r
- } finally {\r
- if (parent != null)\r
- parent.Dispose ();\r
- if (child != null)\r
- child.Dispose ();\r
- }\r
-\r
- // Accessing Handle Property creates the handle\r
- try {\r
- parent = new Control ();\r
- parent.Visible = true;\r
- child = new Control ();\r
- parent.Controls.Add (child);\r
- Assert.IsFalse (parent.IsHandleCreated, "CH7");\r
- Assert.IsFalse (child.IsHandleCreated, "CH8");\r
- Assert.IsNotNull (parent.Handle, "CH9");\r
- Assert.IsTrue (parent.IsHandleCreated, "CH10");\r
- Assert.IsTrue (child.IsHandleCreated, "CH11");\r
- } finally {\r
- if (parent != null)\r
- parent.Dispose ();\r
- if (child != null)\r
- child.Dispose ();\r
- }\r
- }\r
-\r
- [Test]\r
- public void CreateGraphicsTest ()\r
- {\r
- Graphics g = null;\r
- Pen p = null;\r
-\r
- try {\r
- Control c = new Control ();\r
- c.SetBounds (0,0, 20, 20);\r
- g = c.CreateGraphics ();\r
- Assert.IsNotNull (g, "Graph1");\r
- } finally {\r
- if (p != null)\r
- p.Dispose ();\r
- if (g != null)\r
- g.Dispose ();\r
- }\r
- }\r
-\r
- bool delegateCalled = false;\r
- public delegate void TestDelegate ();\r
-\r
- [Test]\r
- [ExpectedException(typeof(System.InvalidOperationException))]\r
- public void InvokeException1 () {\r
- Control c = new Control ();\r
- IAsyncResult result;\r
-\r
- result = c.BeginInvoke (new TestDelegate (delegate_call));\r
- c.EndInvoke (result);\r
- }\r
-\r
- [Test]\r
- public void InvokeTest () {\r
- Control c = null;\r
-\r
- try {\r
- c = new Control ();\r
- IAsyncResult result;\r
-\r
- c.CreateControl ();\r
- result = c.BeginInvoke (new TestDelegate (delegate_call));\r
- c.EndInvoke (result);\r
- Assert.AreEqual (true, delegateCalled, "Invoke1");\r
- } finally {\r
- if (c != null)\r
- c.Dispose ();\r
- }\r
- }\r
-\r
- public void delegate_call () {\r
- delegateCalled = true;\r
- }\r
-\r
- [Test]\r
- public void FindFormTest () {\r
- Form f = new Form ();\r
-\r
- f.Name = "form";\r
- Control c = null;\r
-\r
- try {\r
- f.Controls.Add (c = new Control ());\r
- Assert.AreEqual (f.Name, c.FindForm ().Name, "Find1");\r
-\r
- f.Controls.Remove (c);\r
-\r
- GroupBox g = new GroupBox ();\r
- g.Name = "box";\r
- f.Controls.Add (g);\r
- g.Controls.Add (c);\r
-\r
- Assert.AreEqual (f.Name, f.FindForm ().Name, "Find2");\r
-\r
- g.Controls.Remove (c);\r
- Assert.IsNull(c.FindForm (), "Find3");\r
-\r
- } finally {\r
- if (c != null)\r
- c.Dispose ();\r
- if (f != null)\r
- f.Dispose ();\r
- }\r
- }\r
-\r
- [Test]\r
- public void FocusTest ()\r
- {\r
- Form f = null;\r
- Button c = null, d = null;\r
-\r
- try {\r
- f = new Form ();\r
- f.Visible = true;\r
- c = new Button ();\r
- c.Visible = true;\r
- f.Controls.Add (c);\r
-\r
- d = new Button ();\r
- d.Visible = false;\r
- f.Controls.Add (d);\r
-\r
- Assert.IsTrue (c.CanFocus, "Focus1");\r
- Assert.IsFalse (c.Focused, "Focus2");\r
- c.Focus ();\r
- Assert.IsTrue (c.Focused, "Focus3");\r
- d.Focus ();\r
- Assert.IsFalse (d.Focused, "Focus4");\r
-\r
- d.Visible = true;\r
- d.Focus ();\r
- Assert.IsTrue (d.Focused, "Focus5");\r
- Assert.IsFalse (c.Focused, "Focus6");\r
-\r
- c.Enabled = false;\r
- Assert.IsFalse (c.Focused, "Focus7");\r
- } finally {\r
- if (f != null)\r
- f.Dispose ();\r
- if (c != null)\r
- c.Dispose ();\r
- if (d != null)\r
- d.Dispose ();\r
- }\r
- }\r
-\r
- [Test]\r
- public void FromHandleTest ()\r
- {\r
- Control c1 = null;\r
- Control c2 = null;\r
-\r
- try {\r
- c1 = new Control ();\r
- c2 = new Control ();\r
-\r
- c1.Name = "parent";\r
- c2.Name = "child";\r
- c1.Controls.Add(c2);\r
-\r
- // Handle\r
- Assert.AreEqual (c1.Name, Control.FromHandle (c1.Handle).Name, "Handle1");\r
- Assert.IsNull (Control.FromHandle (IntPtr.Zero), "Handle2");\r
-\r
- // ChildHandle\r
- Assert.AreEqual (c1.Name, Control.FromChildHandle (c1.Handle).Name, "Handle3");\r
- Assert.IsNull (Control.FromChildHandle (IntPtr.Zero), "Handle4");\r
-\r
-\r
- } finally {\r
- if (c1 != null)\r
- c1.Dispose ();\r
-\r
- if (c2 != null)\r
- c2.Dispose ();\r
- }\r
- }\r
-\r
- [Test]\r
- public void GetChildAtPointTest ()\r
- {\r
- Control c = null, d = null, e = null;\r
-\r
- try {\r
- c = new Control ();\r
- c.Name = "c1";\r
- c.SetBounds (0, 0, 100, 100);\r
-\r
- d = new Control ();\r
- d.Name = "d1";\r
- d.SetBounds (10, 10, 40, 40);\r
- c.Controls.Add (d);\r
-\r
- e = new Control ();\r
- e.Name = "e1";\r
- e.SetBounds (55, 55, 10, 10);\r
-\r
- Control l = c.GetChildAtPoint (new Point (15, 15));\r
- Assert.AreEqual (d.Name, l.Name, "Child1");\r
- Assert.IsFalse (e.Name == l.Name, "Child2");\r
-\r
- l = c.GetChildAtPoint (new Point (57, 57));\r
- Assert.IsNull (l, "Child3");\r
-\r
- l = c.GetChildAtPoint (new Point (10, 10));\r
- Assert.AreEqual (d.Name, l.Name, "Child4");\r
-\r
- // GetChildAtPointSkip is not implemented and the following test is breaking for Net_2_0 profile
-// #if NET_2_0\r
-// c.Controls.Add (e);\r
-// e.Visible = false;\r
-// l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Invisible);\r
-// Assert.IsNull (l, "Child5");\r
-\r
-// e.Visible = true;\r
-// l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Invisible);\r
-// Assert.AreSame (e.Name, l.Name, "Child6");\r
-// #endif // NET_2_0 \r
- } finally {\r
- if (c != null)\r
- c.Dispose ();\r
- if (d != null)\r
- d.Dispose ();\r
- }\r
- }\r
- }\r
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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");
- }
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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)\r
- {\r
- eventhandled = true;\r
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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)\r
- {\r
- eventhandled = true;\r
- }
-
- // 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");
- }
-
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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)\r
- {\r
- eventhandled = true;\r
- }
- }
-}
+++ /dev/null
-//
-// 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;
- }
- }
- }
-}
+++ /dev/null
-//
-// 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 ();
- }
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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)\r
- {\r
- eventhandled = true;\r
- }
-
- private void OnCollectionEventHandler (object sender, CollectionChangeEventArgs e)\r
- { \r
- eventhandled = true;
- Element = e.Element;
- Action = e.Action;
- times++;\r
- }
-
-
- }
-
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, 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)\r
- {\r
- eventhandled = true;\r
- }
-
- private void OnCollectionEventHandler (object sender, CollectionChangeEventArgs e)\r
- {
- times++;\r
- eventhandled = true;
- Element = e.Element;
- Action = e.Action; \r
- }
-
- }
-}
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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]
- 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]
- 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");
- }
-
- }
- }
-}
+++ /dev/null
-//\r
-// Copyright (c) 2005 Novell, Inc.\r
-//\r
-// Authors:\r
-// Ritvik Mayank (mritvik@novell.com)\r
-//\r
-// $Log: LabelPropertyTest.cs,v $\r
-// Adding tests for Label\r
-//\r
-\r
-\r
-\r
-using System;\r
-using NUnit.Framework;\r
-using System.Windows.Forms;\r
-using System.Drawing;\r
-using System.Runtime.Remoting;\r
-\r
-namespace MonoTests.System.Windows.Forms\r
-{\r
- [TestFixture]\r
- public class LabelTest {\r
-\r
- [Test]\r
- public void PubPropTest ()\r
- {\r
- Label l = new Label ();\r
- \r
- Assert.AreEqual (false, l.AllowDrop , "#1");\r
- Assert.AreEqual (false, l.AccessibilityObject == null, "#2");\r
- Assert.AreEqual (false , l.AutoSize , "#3");\r
- Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, l.Anchor, "#4");\r
- Assert.AreEqual (false, l.AutoSize, "#5"); \r
- \r
- Assert.AreEqual ("Control", l.BackColor.Name , "#6");\r
- Assert.AreEqual (null, l.BindingContext, "#7");\r
- Assert.AreEqual (null, l.BackgroundImage, "#8");\r
- Assert.AreEqual (BorderStyle.None , l.BorderStyle, "#9"); \r
- Assert.AreEqual (23, l.Bottom, "#10");\r
- Assert.AreEqual (new Rectangle (0,0,100,23), l.Bounds, "#11");\r
- \r
- Assert.AreEqual (false, l.CanFocus, "#12");\r
- Assert.AreEqual (false, l.CanSelect, "#13");\r
- Assert.AreEqual (false, l.Capture, "#14");\r
- Assert.AreEqual (true, l.CausesValidation, "#15");\r
- Assert.AreEqual (new Rectangle (0,0,100,23), l.ClientRectangle, "#16");\r
- Assert.AreEqual (23, l.ClientSize.Height, "#17a");\r
- Assert.AreEqual (100, l.ClientSize.Width, "#17b");\r
- Assert.AreEqual ("Mono Project, Novell, Inc.", l.CompanyName, "#18");\r
- Assert.AreEqual (null, l.Container, "#19");\r
- Assert.AreEqual (false, l.ContainsFocus, "#20");\r
- Assert.AreEqual (null, l.ContextMenu, "#21");\r
- Assert.AreEqual (true, l.Created, "#23");\r
- Assert.AreEqual (Cursors.Default , l.Cursor, "#24");\r
- \r
- Assert.AreEqual (false, l.DataBindings == null , "#25");\r
- Assert.AreEqual (false, l.Disposing , "#27");\r
- Assert.AreEqual (DockStyle.None, l.Dock, "#28");\r
- \r
- Assert.AreEqual (true, l.Enabled, "#29");\r
- \r
- Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "#30");\r
- Assert.AreEqual (false, l.Focused, "#31");\r
- Assert.AreEqual (FontFamily.GenericSansSerif, l.Font.FontFamily, "#32");\r
- Assert.AreEqual (SystemColors.ControlText, l.ForeColor, "#33");\r
- \r
- Assert.AreEqual (((IWin32Window)l).Handle, l.Handle, "#34");\r
- Assert.AreEqual (false, l.HasChildren, "#35");\r
- Assert.AreEqual (23, l.Height, "#36");\r
- \r
- Assert.AreEqual (null, l.Image, "#37");\r
- Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "#38");\r
- Assert.AreEqual (-1, l.ImageIndex, "#39");\r
- Assert.AreEqual (null, l.ImageList, "#40");\r
- Assert.AreEqual (false, l.InvokeRequired, "#42");\r
- Assert.AreEqual (false, l.IsAccessible, "#43");\r
- Assert.AreEqual (false, l.IsDisposed, "#44");\r
- Assert.AreEqual (true, l.IsHandleCreated, "#45");\r
- \r
- Assert.AreEqual (0, l.Left, "#46");\r
- Assert.AreEqual (Point.Empty, l.Location, "#47");\r
- \r
- Assert.AreEqual ("", l.Name, "#48a");\r
- l.Name = "New Label";\r
- Assert.AreEqual ("New Label", l.Name, "#48b");\r
- \r
- Assert.AreEqual (null, l.Parent, "#49");\r
- Assert.AreEqual (16, l.PreferredHeight, "#50");\r
- Assert.AreEqual (0, l.PreferredWidth, "#51");\r
- Assert.AreEqual ("Novell Mono MWF", l.ProductName, "#52");\r
- Assert.AreEqual ("1.1.4322.573", l.ProductVersion, "#53");\r
-\r
- Assert.AreEqual (false, l.RecreatingHandle, "#54");\r
- Assert.AreEqual (null, l.Region, "#55");\r
- Assert.AreEqual (100, l.Right, "#56");\r
- Assert.AreEqual (RightToLeft.No, l.RightToLeft, "#57");\r
- \r
- Assert.AreEqual (null, l.Site, "#58");\r
- Assert.AreEqual (23, l.Size.Height, "#59a");\r
- Assert.AreEqual (100, l.Size.Width, "#59b");\r
- \r
- Assert.AreEqual (0, l.TabIndex, "#60");\r
- Assert.AreEqual (null, l.Tag, "#61");\r
- Assert.AreEqual ("", l.Text, "#62");\r
- Assert.AreEqual (ContentAlignment.TopLeft, l.TextAlign, "#63");\r
- Assert.AreEqual (0, l.Top, "#64");\r
- Assert.AreEqual (null, l.TopLevelControl, "#65");\r
- \r
- Assert.AreEqual (true, l.UseMnemonic, "#66");\r
- \r
- Assert.AreEqual (true, l.Visible, "#67");\r
- \r
- Assert.AreEqual (100, l.Width, "#68");\r
- }\r
-\r
- [Test]\r
- public void LabelEqualsTest () {\r
- Label s1 = new Label ();\r
- Label s2 = new Label ();\r
- s1.Text = "abc";\r
- s2.Text = "abc";\r
- Assert.AreEqual (false, s1.Equals (s2), "#69");\r
- Assert.AreEqual (true, s1.Equals (s1), "#70");\r
- }\r
- \r
- [Test]\r
- public void LabelScaleTest () {\r
- Label r1 = new Label ();\r
- r1.Width = 40;\r
- r1.Height = 20 ;\r
- r1.Scale (2);\r
- Assert.AreEqual (80, r1.Width, "#71");\r
- Assert.AreEqual (40, r1.Height, "#72");\r
-\r
- } \r
- }\r
-}\r
+++ /dev/null
-//
-// 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 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]
- 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");
- }
- }
- }
-}
+++ /dev/null
-//
-// 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");
- }
-
-
- }
-}
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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");
- 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 MergeMenuTest ()
- {
- 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, "#8");
- }
-
- [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");
- }
- }
-}
+++ /dev/null
-//
-// 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]
- 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");
- }
- }
-}
+++ /dev/null
-//
-// 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]
- 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)")]
- }
-}
-
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-//
-// 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
- {
- [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");
- }
-
- [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 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)")]
- }
-}
+++ /dev/null
-//
-// ScrollBarTest.cs: Test cases for ScrollBar.
-//
-// 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 ScrollBarTest
- {
-
- [Test]
- public void ScrollBarPropertyTest ()
- {
- ScrollBar myscrlbar = new HScrollBar (); // Could be checked for VScrollBar as well
-
- // B
- Assert.AreEqual ("Control", myscrlbar.BackColor.Name, "#B1");
- myscrlbar.BackColor = Color.Red;
- Assert.AreEqual (255, myscrlbar.BackColor.R, "#B2");
- myscrlbar.BackgroundImage = Image.FromFile ("M.gif");
- Assert.AreEqual (60, myscrlbar.BackgroundImage.Height, "#B3");
-
- // F
- Assert.AreEqual ("ControlText", 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");
-
- // S
- Assert.AreEqual (null, myscrlbar.Site, "#S1");
- Assert.AreEqual (1, myscrlbar.SmallChange, "#S2");
-
- // T
- Assert.AreEqual ("", myscrlbar.Text, "#T1");
- myscrlbar.Text = "MONO SCROLLBAR";
- Assert.AreEqual ("MONO SCROLLBAR", myscrlbar.Text, "#T2");
-
- // V
- Assert.AreEqual (0, myscrlbar.Value, "#V1");
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentException))]
- public void ExceptionChangeTest ()
- {
- ScrollBar myHscrlbar = new HScrollBar ();
- myHscrlbar.LargeChange = -1; // LargeChange must be greater than 0
- myHscrlbar.SmallChange = -1; // SmallChange must be greater than 0
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentException))]
- public void ExceptionValTest ()
- {
- ScrollBar myHscrlbar1 = new HScrollBar ();
- ScrollBar myHscrlbar2 = new HScrollBar ();
- myHscrlbar1.Value = -1 ;
- myHscrlbar2.Value = 101 ;
- }
-
- [Test]
- public void ToStringMethodTest ()
- {
- ScrollBar myHscrlbar = new HScrollBar ();
- myHscrlbar.Text = "New HScrollBar";
- Assert.AreEqual ("System.Windows.Forms.HScrollBar, Minimum: 0, Maximum: 100, Value: 0",
- myHscrlbar.ToString (), "#T3");
- }
- }
-
- [TestFixture]
- public class ScrollBarValueChangedEventClass
- {
- static bool eventhandled = false;
- public static void ValueChange_EventHandler (object sender, EventArgs e)
- {
- eventhandled = true;
- }
-
- [Test]
- public void ValueChangeEventTest ()
- {
- ScrollBar myHscrlbar = new HScrollBar ();
- myHscrlbar.Value = 40 ;
- myHscrlbar.ValueChanged += new EventHandler (ValueChange_EventHandler);
- myHscrlbar.Value = 50 ;
- Assert.AreEqual (true, eventhandled, "#1");
- }
- }
-}
+++ /dev/null
-//
-// 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]
- 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")]
- }
-}
+++ /dev/null
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT 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)
-//
-// $Revision: 1.1 $
-// $Modtime: $
-// $Log: TestImageIndexConverter.cs,v $
-// Revision 1.1 2004/08/27 22:17:37 ravindra
-// Adding test for ImageIndexConverter.cs
-//
-//
-//
-
-using NUnit.Framework;
-using System;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Globalization;
-
-namespace MonoTests.System.Windows.Forms
-{
- [TestFixture]
- 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.");
- }
- }
-}
+++ /dev/null
-//
-// 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");
- }
-
- }
-}
+++ /dev/null
-//
-// 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]
- 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)"]
-}
+++ /dev/null
-//
-// 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");
- }
- }
-}
+++ /dev/null
-using System;
-using NUnit.Framework;
-using 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;
- }
-
- [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 = System.Drawing.Color.AliceBlue;
- orig.ForeColor = System.Drawing.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 (System.Drawing.Color.AliceBlue, clone.BackColor, "#12");
- Assert.AreEqual (System.Drawing.Color.Beige, clone.ForeColor, "#13");
- }
-
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using NUnit.Framework;
-using System.Windows.Forms;
-using System.Drawing;
-
-[TestFixture]
-public class TreeViewTest {
-
- [Test]
- 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 ();
- }
-}
+++ /dev/null
-#!/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
-
-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 = "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>
-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
-}
-
-SWFtail()
-{
-cat << EOT
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-EOT
-}
-
-SWFhead > $OutFile
-SWFfilelist >> $OutFile
-SWFtail >> $OutFile
-
+++ /dev/null
-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
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<root>\r
- <!-- \r
- Microsoft ResX Schema \r
- \r
- Version 1.3\r
- \r
- The primary goals of this format is to allow a simple XML format \r
- that is mostly human readable. The generation and parsing of the \r
- various data types are done through the TypeConverter classes \r
- associated with the data types.\r
- \r
- Example:\r
- \r
- ... ado.net/XML headers & schema ...\r
- <resheader name="resmimetype">text/microsoft-resx</resheader>\r
- <resheader name="version">1.3</resheader>\r
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
- <data name="Name1">this is my long string</data>\r
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
- [base64 mime encoded serialized .NET Framework object]\r
- </data>\r
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
- [base64 mime encoded string representing a byte array form of the .NET Framework object]\r
- </data>\r
- \r
- There are any number of "resheader" rows that contain simple \r
- name/value pairs.\r
- \r
- Each data row contains a name, and value. The row also contains a \r
- type or mimetype. Type corresponds to a .NET class that support \r
- text/value conversion through the TypeConverter architecture. \r
- Classes that don't support this are serialized and stored with the \r
- mimetype set.\r
- \r
- The mimetype is used forserialized objects, and tells the \r
- ResXResourceReader how to depersist the object. This is currently not \r
- extensible. For a given mimetype the value must be set accordingly:\r
- \r
- Note - application/x-microsoft.net.object.binary.base64 is the format \r
- that the ResXResourceWriter will generate, however the reader can \r
- read any of the formats listed below.\r
- \r
- mimetype: application/x-microsoft.net.object.binary.base64\r
- value : The object must be serialized with \r
- : System.Serialization.Formatters.Binary.BinaryFormatter\r
- : and then encoded with base64 encoding.\r
- \r
- mimetype: application/x-microsoft.net.object.soap.base64\r
- value : The object must be serialized with \r
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
- : and then encoded with base64 encoding.\r
-\r
- mimetype: application/x-microsoft.net.object.bytearray.base64\r
- value : The object must be serialized into a byte array \r
- : using a System.ComponentModel.TypeConverter\r
- : and then encoded with base64 encoding.\r
- -->\r
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
- <xsd:element name="root" msdata:IsDataSet="true">\r
- <xsd:complexType>\r
- <xsd:choice maxOccurs="unbounded">\r
- <xsd:element name="data">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />\r
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
- </xsd:complexType>\r
- </xsd:element>\r
- <xsd:element name="resheader">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:string" use="required" />\r
- </xsd:complexType>\r
- </xsd:element>\r
- </xsd:choice>\r
- </xsd:complexType>\r
- </xsd:element>\r
- </xsd:schema>\r
- <resheader name="resmimetype">\r
- <value>text/microsoft-resx</value>\r
- </resheader>\r
- <resheader name="version">\r
- <value>1.3</value>\r
- </resheader>\r
- <resheader name="reader">\r
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
- </resheader>\r
- <resheader name="writer">\r
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
- </resheader>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAADftJREFUaEPVmntY\r
- 1FUax0efbbtaarr12D5bu6WbopZ5SVs1a3fV2rQsUcu8FJqlKCZkF9t1H7VUFBQVCXVFzTIIROU+DJoK\r
- iCggKgjC3JgZ5sZlbiAzot993zMMgjLjpT/W5Xk+npnf5Zz3e8573vOeM3YaGG0ddv89nX7fWSLpJKG/\r
- zuJf91+nTq3XWq/SffdntHtOfGm91/bdlnrb1t2J/q4CpvT3usiu1XKHn+YkNRwuNV2GN0qMLvjivNEJ\r
- X5wzONERX2VZry5IdWwCIPk1SIIyGjKuXr0Kb1y5cgU3o7m5Gd64fPkyOiK+xAGZvOkKiVj1fyuAheVr\r
- m5oDUx1L71TE/3QEWICLKDU2XZmb5PjoTkTcVAC71q9xIXYtby7kEWBpdOKIvKF59kGH/+2KuGsElOjt\r
- iCu2Xp6e6Bh3OyLuCgHWRop0JEBWVoetefUu/3j78FsVcXcIuORCqYEElNfh+1NGfHu4pum1H+39bkXE\r
- XSUgq0VAaFYVlqaaGl+KsT15MxF3rYCQAwp8ctBo/9Nma09fIv5nAgp1jQjKuCxYlOHCwnQXAltYQOWC\r
- NDcTfrLuvSsFcAiVKZoFmfLLXnk3wb7zjgV44r+vVMFbnG8b+10uF3zhdDrREY2XmvDefvsOnwIWptmk\r
- 3vIVz/U7NcBjVFNTE3xx6dIlNDY23oC9oRHT99u3+xaQapV664HbMcCbEWxYQ0ODTxwOBzrCYm/AjET7\r
- Np8CApPrpdw4s7vYgJAs1TVkSoTcAsGZCtyMT9MrMG1DHEbODsbgie/Db9RYPP3cMPiNHIshE6Zj1Owl\r
- eC98H/YUqGGz2QS1FjtmHrBH+xQw/1BNpsPRQD3gHbvdAV/YbHZqsGNyc09gypSpeLT7oxj8wmAsXvwp\r
- wsPC8eOP+5CeniHK8PANWLIkGEOGDEX3bt0xebI/jh49BlOdDbNuKuBgTaYvA/ie1WrzicViRX19ewoK\r
- ivDOO5Px5B+exLrQdSgpKYXRaLoppaUXhKCnnvojJkx8C6+vztzncwQ+OWDOtFhsYOKKqxF6XIV1zDEF\r
- wo4rEZ5NcHlcgQ1UbqTvETkqQolNxOZcFSJPEFRupTKK+GD5BvTo+RhWrFyFqiqNMFqvNyA5OQVBixbj\r
- r6/+Fc8/9zx69+6N5wY+h1fGvIp5H32M+PgE6HTV4nmtVofVq9egW/eernt/e6/XVFvy8X6jrLbWAqZS\r
- V4PzVTU4pzbjLFGsMhFmFClNKFQaUaAw4jRxisiXG3CSyKs0ILfCgJyLBhy9oMXUmXPRt28/nDyZ39rb\r
- UVFR8OvXHwEfBiAxMREqlUpEnK+//lpEJ7VajaSkJMz/ZD4G9B+AVatWCcEs5PTpAvR+prf9kYcf2UXb\r
- 8d9cPxqSefH6LLO5Hr4wmergC4OhBsycOXMxbux4KJUq0fiZM8UYP+41zJo5i9433bAW8ES9PkTztc9C\r
- luKlES8hOztH1KNWV2Hs2HENJOL7GwR89LM+y2isowfroNbVQqGtcaMxQ0WlmkZFrTNDrTWjikptdQ10\r
- AjOqqdTra6g0Y+WKbzBo0AvUu2rRaHh4uHCTtLQ0n4tYR2vMkSNHkJCQgBHDR4hRqq7WC1ccOGCg/YH7\r
- H1jWVoRkbmx1FhvCbCP//jylDEuJz5LLEJx0AcHJF7DkUCmW0OdPqVx86AKCDpZiEbHwQCkCiSnr4/G7\r
- x5/A+XPnhfHr1q2HP0WS+vr62zbeYrHgiSeeQGlpqQjtn1LUWrp0qaiXJ3iPR3vYyZVGeERI5v6kO6yl\r
- 3vWFRmOCL14cNgJRUd+JRjhsDnp+EAUFy20bz6MREBCAwMDA1nd5joweNRqpqWmi/pidMXi4y8PnSUQn\r
- FiGZs093WK1mP/OOSmUk1+iY6O9iyOAXaA4YRQQZNnQY8vLy7sj42NhY9O/fXyxibV3r4sWLwh0VCqUQ\r
- QZHLSgLeFQICftAeVlKEYWRnNEg6VYVk5nQVUgsILok0+pxOZBDSwipkFmqQWaTBsBGjsWf3HlFxMC1G\r
- Kyl03ix34vtOpwd3IieXy9GrVy8UFRWJe9fXsWPHDsx4f4ZoJzY2Dt26disSAj78XnNELjdSBUbspTi/\r
- RVaJzbIKbCIiiI2ZFQiXXkRYRjnCqFyfXo7QtHKsTS3Hv2Lz0KVLVzHBuHe4l3jIfWeeLnrGiaZLTvJx\r
- Ll2UJ7ndZEP4xpZrdJ2euV7Iy6NfRn7+KTHSDz34UCONQk/JB3s0Ry5SDPdFebkeHbF69Ua89eYk0Svb\r
- tm3HV19+5dV4NoaNYqMvkdGNtJFvaCAcLiz/1wqMH/+6+MzX+B4/wyKdbYRERkZixYoVor23J73d0LlT\r
- 5zmS2bs0v5SVGeCLCxf06Ig5AQsofK4UFU6bOs2r77caT+c/wnAy1G5zwmZxIkuWTVHn96is0MJa777G\r
- 9/gZIYTeYeE8qlqtFjwK3N7ataHo+kjXbZJZMZpfSksNFKIM+OGoEttlcuyQKbAzy02MQI5dVO6mUnBY\r
- jj3EqL9NxE6KClzh8BeHdxg2Pca7XcVtuJWMLDmvwI7teymdeBY/x6agxuRCrdmFuloXLPUuIcRhJ8H0\r
- DovwuFN/v/6iPZ53PXv0lEpm7tQcPXdOD+bHI0r8J5MEENuJbVI5ojPk+C69kpBja1olIoktqRXYQuWz\r
- A4aKjJIrpEWmQ/cRbsM932K8hXq5WmfDM0/3xqwZs/GP197CsV/O4vTJSpSc1UEpp1Xf0IR6EsIjwoL5\r
- XY8Azp24Pak0kzPcEsmMHVVHi4v18MWZM3pKC25k8ODhrQIoX0FISIjIcTyTWPQ++zy5AvcmG1RX40JB\r
- fjlG/WW0iDh+/QYiInw31nwTheX/DMMXS1ciaOEXFO9j3SLESNC5ES1iXD/nSpwnZWRIeVE7L5mxXXOs\r
- qMhAlXmnsFAPpqCgug16vDZ+EnbF7BI9MmTwELHrahuBeAJy77M/26xO1Ne5YKbfG/QaJ+bPC4Zf34GI\r
- 2Z6M8nNOQUWpE8oK8nWlCwatEzX0rIXesdO7TU3u0Opxod27dqMHu9D70Zpjp08bKOsz4D/pKmxJkiMy\r
- WYGodpAb0ffoZHKrFAW2p7p53X8evv12tRAw4Y0JYvlv1/tCAPe+2x3Yx43VTuhULigvuoTRJYUunD1J\r
- 5NPxYoETF887oWIRaidMeveI8SjwaPLqzh3F7a1ZsxaU3G2TTP9Oeyw/30Dx1YCYNMrpk5SIJLYwhyjf\r
- P6hAxAE5ocDGRDk2EOGJlYQc7y5ahzcmvCUq5Nw9LCysQwF2ch9LHfUoTVQ99WyVwoVK6m02uDDXhbwj\r
- Tpz8xYkzeeQqZ2hRK3NBw6Ogc4vmCc0dExcXJ3Ijbm/SpLcdtA58IHlvq/Z4Xp6RQqB3TpwwgMnNbU96\r
- ehn1QleR7p49ew5jXh7TsQCaiK0CyH2q5C5UlLh7/3S2C9lSJ3JlbjGlhSTggrOdgAaHW8BU2ppy0ODN\r
- zoMPPMgLWQ/Ju5Ha4zk5RvgiO9tAuXnHDH9xjEiwuFfenPim2LB4UgV3BHJPYI4+3Jvs29y78jKn6G12\r
- nwISUZBDbnTKhbKzTijKXcLN2N34Pa4vOzsbI/8yUrTD++hu3boXilRi2hZd9vHjJjBrYpVYG6tCKJXr\r
- 4mhbSaz/maAyLI62lfQ5PF6FDS1EUBnwWTT6USThZI4jBe+8eMHhRt0rr3vhYjdgf2a/1pF/qytpFMiN\r
- yordrlRCPc/Gc+/zCFVXkWByOfZ9Tss5TeE0ggX49fOztSZz0zZXZx89aqZTADMiE6oQuV+DzVRuiid+\r
- dpcbqQyPVSOshfVUrv9JjdCfSCyVffxeRETEptbeGT9ufMsouFOHa2sALVZklJF8myepmgxV0GTm0WB4\r
- YvP8YIFGEtpIEUyk2LQV9dQfHb3tapeHulxLp6dG6HMOHzbDTU2HZGWZ4YuoKBkef6yX2EJyD334QQBC\r
- Q0NF710/ChwWeTKze1TTfNCpKeKQu7DLsOEcYuvI1Xjk2HhOsSdOmCjq5Q0TLV7tNzRTNhpyZLJa+CIz\r
- swa+kErNCApaR0M7QGSlvK2cTEcqDGeOIoHjHIjCKbsSpwrsThznTfQ7sonEsGvxd54vbDi7TeCCQIz9\r
- +1jK08pFnXRYYL/vvvuD220p/cONOVJpHS3N7cnIqKPVzk16eq1P0tJqae9bC3//QIpEr1JqrhA9tnfv\r
- D2Ll5MXOSQsRC2mbD/EEFSutjefJtXyHTyjY5z1uw4cEY8a84qCd2A3npJLJYabctLR6MsA7qan1tKXz\r
- TkpKHZikpBpM8Q/C00/3oaiWK0RUVsoxc8ZMcRa0Z8+e1tMJdi+ZTNYadmtra4W7vPP2O3jjH2+IsMzv\r
- 5+WdxFNPPmUn46No4na+4VRi8vqa3JQUKxngneRkCx1KeScpqZ6Mt7Ty+ecxlCk+jmXL/tl6SnHs2HH6\r
- vkycNLxApxejRo5C32f7ivSY99BD6VgxJDhEJGmeo5Tly/+Nrt0edd7zm3tmeDudk0z9wbpsXrwt8eN4\r
- 2wHi4CdMgu0QMz/BlsQsSLAlB+63pbSQunC/LXVhoi2NyvRFTKItPchNxuJEm3TxAZv0/Y0nsvsMHWvq\r
- 0fPx5pUrv7laXHxWGOZBoVCIw6+Kisp218/RRF397Rr87rFeV/487O9107+MmOnzaPFmP6L92vs07ANp\r
- 47GPVk4LZazWBQsCmzmP4cXv4MFDYn7w98DAhc19+vzZQuc+Vno+lt4bdCtt/6r/KXIrDXie4WMQYght\r
- A0Mojm+lcJhC5NNpdCp9j6Lrn9H9YZ7jklut+7/JKVwBwotNkwAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="Red">\r
- <value>Rot</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA\r
- CxMBAJqcGAAAD0tJREFUaEPFmQlUVFeaxx/IUguKRo12MkmnuxM98cwkJmPapMdsRpOMY5bOMn1cMsak\r
- R4OmoygtoJSC7IqyFzsoigIqKEsha0GxF1XUvldRFEUJKGuxC9Q330NRcAFcMqlz/tz77rvvvf/vu+t7\r
- WBG/wu8/N26k4m3fHhgYeHkQ/3R3d6vUSqUSywZQll/hkU/vlv9w3kdlHPVezoxP2Oty0DN0j6v3cXdv\r
- 5h6v46f/6h92/hM3r7B1+9x93nFjeP7p6T31Kd1pv5u7raev3wpmXPwhoVLVfIlVdvNMZhWcyuRbQhIK\r
- bgZEZpo9/KKvM3xOcv1PhHh5+vrORVk/pcc/+W0Q4K3UjMwglaHJ1Dk4NNLc2WPJ4aggIEkKgam9lqPx\r
- 6rGUXPEoX6kfUjUZFYHBwQzUs0/+5KdwBzcG44M8NjsSjWk6BgZHe8csYB4dA1VzJ5wv0MAvx4VwmqWB\r
- InUraMwD0D4wOCDV6eSJKSm/eAcG/uEpWHi8W7gxjtA9vLw/YBWXxqsajbqO/qGx3lGACXUOjoBY3wGJ\r
- uUpIl5sg63oPcPuH4drwKHQMDI/WiiRV6Veydx4+6vv7x3Pw+FdZMY74zA9jxr2fkp55Xtfc1tbZP2Ix\r
- DwNMVjcetwyOgbjvJpxp74OEG2bI6OwHXu8wtA9ZoLVnYLSaLy48nZK+3fXgkUWPb+cRrlyyZCmx5bvt\r
- 9n6BJ9cnp1zMacUwd/VboHsApqgLj1uwvBYpIlt7IPl6H5y+3gtxbWZIwbzSPAo38Hzzjd6RGr6s2NM7\r
- 4Nt9LgdtUFaPYOfRqyKAfcDx0E2sgnKWsaXX3NFjsXSaATp7p8rYMwbF7UOQ1NoLZ1Hx18zjSmwxw6lW\r
- TFHKrhFo6x61NDZ3d1VzZUVo/hOU46O7msUVb7+9Zg7KISw88Uc2R8DSNnS0t3cBdJDqvqsbeKzvGANW\r
- 6wCcudYLSaZeSEDFN99OTWaIQ53Gc+ev9YGo/Sa03BgZ0zV23Shm87Ijmac+ddrl/MwsLM2+yrp1G2wP\r
- HvR9MSrq7LaiYj5bo+3sutEOcK9a2i2guj4KLNMgJDaZIRaVaETz9yjBaIYkLIvB85dN/SBqG4GWtpEx\r
- taa972p+bWJsXOrH27btfHot8e033z3j7x/x+eXMUpFe3zfQ1gZA6vokmdosIGtB88ZBCNX3QGIj9ncU\r
- sxG7jAEHcBMaNmArYD4JFYnlZ5v6IBrTi8Z+ULWOjt9PIr7WyWJVM48FRq/55uutFNTsI/2wmruc/rk8\r
- MiKFIRG3DRubRiwt13CAolonSdI8Chca+8FP1wXp+j4Ib+iB6AbsKo1oVo/9H9NkVKweobA8HeuebOiG\r
- U3icSJ5HTdxPwG++fjmDE4PmX0HNfrX+5BNiqZMT8QGDQfzv8ePEfiaT8E5KIiLOnLG9dO7cH4QX0reP\r
- iOqlFkPDMJiMANdui9c4Aucb+oGpw2jr+iBI0wNxWow4HkfoeiAey2IbeiFKh90JlYD5EG03JDcgHNaJ\r
- QqVgPhHPKZrGoKnh5oiAZ9KmnStkbvvO6aVPP/7Cbtpm2LaNsEGtuHKF8CgvJ7K5XIJbV0eIeDxCzecT\r
- xvp6op3Pt+2rrfndWGnJARDV88GgG4UGvQXKdMNwVtsHcRo0qDFDuNoM0epeiMSUicfRWM5ERWM+BtNx\r
- IVw8ppHj52+JzCdq+uCKbhBE+lHQqQaH6qqNmqT4bD9fb+aK/3hn7cMhXFwIKmpzZSVRo9MRoyYTAQ9T\r
- Tc3LUMnxBBFPChLNKISpelAYRRUCKDGyyh6IwTRCiQBYHo3lEXhM5mPIOigyH4dpONaNwjx5HIb141UY\r
- CBRLMwRi7RjoFMPDZUXqhuTEq64+R5ivvvynV+c8sCUCAwkHlLtIRCinMz9xrqryVSgp8IIqQTN4yzsh\r
- TtEHEYpeCJbj7IL5QFk3xOBxFCpUgbMRppGYhiMIWRaNOibvHq8bosAA4LlEzAfgdXFyHOSKfriqHAaD\r
- CsaVny2WJ0RlO//ixHj+gQBBQYQDioEA6tkANDVZQ13tCsi8cBSUkiE4I+uHBBlGD+WLJpKlfXBSisZk\r
- GGk0dFLWAxEy7Dp4PhzTECkObrzGH+vGShEKy/wwf07aD0EkPB4Xy4dBL8c1BaWTjY3lZYqE/l4x+xHg\r
- /lYICCDoKFcEUMwGgKyj01GBx30NcjPDoKLWCGniAQgXo2FJHxwX90Ak5iMkZghFg0wsC8d8CIpMmeLe\r
- 8ToxYoS7XR4jQQhxNyRg3WLJTRALb4KophtKcmWQlV4yFnwsUPb37WujN2yw+2bVKhs6gtzdcnh5EXTU\r
- XgSQzhaguRkhtFSoKFsFZQVxkF+hg1TBAIQK0bQAzQp6IITMC7EbiTDqIiybEFle3wP+FQbwKhTD0bwa\r
- 8L9aDgFXi+BsfiHk518FTkEWcApToTSfOZqdccCYmrKxICT495G7d1NdNm+2nzsF4MABgobaIRQSotkC\r
- kPVIiIYGKygrXg+c/NNQWN4Msbw+YPIxwrUdEFBhggC2DnzZcvAvlUBQqRCOlfLgWFkNRJVWgm/BZQjK\r
- TYbg7CgIzwmGizlBcDXXD4pyD0Nx3gFLWeHu4drKLSZuzepCheLF2MrKBf5eXnRnFNkCd3+7dhFU1FYE\r
- 4M8WwGgkoLGRBCBALLaFwrz/grxL53GGaoPAKgOcLFGAT1YpuKWmgVdKPHifDwOf1AA4lnYYQtP/CSGZ\r
- P8MFzl7IER8AjuoQSJWHQa88Mq4GBQOUov0j/JqtbTVV/5qj1T4XYTItOlZRseCoiwvtRxT54eDub+tW\r
- goL6CgFqZwPQ1ESATEZAaSkBOTkEZGVZQ1rqXEiKXwlxkT/B6WQGxFx2hXNl7sASMiBX4gEsySHIxzRP\r
- ehBYUjcolbpDjtwVKuUHQSY/DDo5Gr8tuWAv1Fb+tZNd8kqVXr80tLl58XESoLx8AeOHHyj/jaJMAfjs\r
- M8Ie9TEuWJVkt5gMoVAQUFNjBWy2NWrOuEpLbaCqyhYEAjsEsUdRQCKhAp+3CMpLXwdO8fdQXrUP2EI3\r
- KJS7Q7HiIJSgilAT+XyFO1TLMfIyBmhkR3CmuSUpfzeI69fjvV5pq65aVGA0LgoizZPicBa44iD+FGU/\r
- BWDNGsIW9RauwCV6/VQALtdq3DCXa39HdXUU7DZU7D40hL0rY5MDaLWLQCxYDZL67cAXu0IFmiRNTxYb\r
- o16F5TLZYdBI0ThKI0YY3i40vxaU8pdALndsraubdwdAq10YlJ8/3/nNN23eQNlOAVi2jJiDegm3Ebkq\r
- FWGZ3ALl5dZQWWk3xehk0/fmjUY6qFXPgETwHpr5O9RjVylTkBDuwEaQUhQZeTWa194x7w6y+p0gqPsQ\r
- lIrnwGCYi4Gg3+Dx5rGxBU6Q0edynzmZmjpv1+LFVktQ923wyDnVsaCAuCAWEyNTAeZgd7GfNcAEkFKx\r
- GFvhfYTYDQKZB3ButwJX7nEn6mTktTgupPwdUM99FzRqRyADQN4DAToQoGICgMWaHxQc7LBtyvR5z7Js\r
- k5VFJOEmrn8qANnfKY8MYDQ6gAqjKeS9B1LBfuDJDoEE+7v6dtRJ86RE3O9BxP8zGl6I0/It87cBuuvr\r
- 53InALKzHX18fenfTLcrtbp0iYiqqSG6JuZ4jYYYH6w83qMDkCYMhnkI8SJG9yOQCJ1BLWGMm74VeQYI\r
- a7eAVPjvoNU8eyfykwDMCCAwGheOd6HLlx0PubnRNky7rU5LI4Krq4m2CYDaWgLN24JKRX3kFpgwYmic\r
- B3LpC7h73QhK4R40fhjUOPeLeVtxsK9E84vR/NTJ4HYL9AsEDjIEOEkCXLzouH/nTsr70wKkpBABVVWE\r
- kQQgFyocEyAS2WHT3v+A6Qby/QPbAUTCF0HC/xLk9U4grd8C9bwVoNfPf+i9dTraoFDooCYBmpsXHcMB\r
- 7PTFF3arpgVITiY88Z1ANwGQn2+NAI8+gB8GJxL8EaorXkPzy2YMCgLcRAA9CaDXLzyekjJv2+uv2yyb\r
- FiAxkXBHgPEdKdkCTxuAHBONGHWDwXHGLolrzKhE4mBC82FFRfNDExLmfrZ0qTW5iXv4LyaGcMa1YHxD\r
- dwvABlvg8Qbwo3SxB9VtbKRZlEr6Dbl8QWxa2rwT4eEOax/4LjAZJzyccOJwiDoSwGAgoLDQFlfc3waA\r
- HNg6Hb2Lz5+fgtH3DQx0eGfa6JMnT5wgfigrIyrJzRquyMDh2OGS/vgz0JO2gsFA76mtdcxkMh08PDzo\r
- b8wI4OdHbMEdJlurvbXTlErtccv8ZDPQk0AggBkBWCEhdOeff6aumBEAvwd9zWYT+WT08/KsQKOhzDhb\r
- PInBma5FgF4ud16Rvz9t51df2f9xRoD9+4mNJSVEllJpBbm51uPvvTM95Nc8j63fX1bmUOHjQ/129Wqb\r
- JTMC7NhBrCsqIi6qVCSAzW8OgGvBQGYmrS4wkLL2hResaTMC/O1vxJrCQuIcCcBi2f5WAGPYqjdRQ2o1\r
- rTMujlIdFUWZeQCTdOvWEatw+5B0C8DutwDAdxG6GdVsMjnI1GoHTlQUNSksjLp8xuiTFVauJJZlZBDh\r
- PJ41VFRQcK/yq8xAGF16D8qEJlUGg0O9WOxQVVhIL7l0iZ6Zmko/lZxMD4uLo/kGB9Ncdu+2/+qnn+xn\r
- 9/+zpUuJJfHxhH9hofWYUkl94C5xFoMWo0h2AXoP7u/b9Hq6QSSiaaqqaGIOh1bJZtPyioroqVev0mNz\r
- cuhBGRl0j3Pn6D/FxNC/PnGCvu7oUfq7rq60Pzs5Ud/YtIny6kcf2T734Ye203+dntQ8DiEhVocyMuaQ\r
- fXC6GWi8n6LBPtyzdMvltHaJhGYSi2laNCsWCulV9fX0vLo6emp5OT36yhWaX2IizQUj+qOnJ+1bZ2fa\r
- BvyysPbLL+3e+ctfbF5bvnzOv6CHqS/qs+oz91eyCQ21dk5Pt+lDgxbcRo8aDLQR7EpDqAGUGdWFplsa\r
- Guga7KO8mhp68eXL1EunTlFjw8OpPp6e1J9x0dmyeTPli/Xr7T7CHeTKBQusFqIe/GX5MY0+9LKwMJt/\r
- pKbadWMXGNJo6NcrKmgNWVlUQVoapeDUKUpyWBgFv45R9u7ZY/8/339v9/mmTbZvenjY/y4+nuqIAHMR\r
- gIYAVASgIIAdAtiieWvU07b64Pvt22fzHoNh63v6NNUjIYGy48wZyufnz1PeTU6mvMVkUv7N25vy8q5d\r
- 9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD31JREFUaEPVmQdY\r
- VHe6xvFe9+59dJPsJttMTNas2WQfs4nuborGGzVmLdHYwIKiG0VAI6BIH5A6dJDelCkgRXrvvXcQaYJU\r
- UXoRLAgMzHu/cxRkaJZr7j7L87xMOTPnvL//+/2/859zFgGQ+rf+YwD+nfWTm9/p2fTWWk7c5x+f4v+w\r
- +ke+7V9VfGLWnA8t/VQrtv5TrbiWT7TiOz7WiO1b/flXx15mIF8KQFDQ958eOb3L9P2KvlKyDVdQtA11\r
- UrwYmXDaJaVcyS2jTskts1nBNevOSdesHiWX1AHNS6n3nMKLxyILGlB9ewiDw+MQizGlkZFRrF+/Xuf/\r
- DNBzX/Tft++OrsipaNzkF5PxozA81Z0fkZFyJb7omjC+pJYXV9J0Obb0tkdUcbdbWE6fV2TOvcjMClFx\r
- zS103h3GqEgsYWzS5NiYCM3NLUhLS4e3tw94PP6UzM0t2O9s3LjR5KUACgoKLlbV3Gi6VlnbVlRe1ZWe\r
- W9SbllM4VFJRI2pu68TDR2OYmJjb2KRBZntHRyfy8vLh7x8APl/AijHq5cWHUOiD1NR0FkIkkhx9Hk/A\r
- Amzbts3ypQDS09O9Ozq7MD6BBdXXfxclpeUICQkDjzHHGnxsVCAQIi4uAbW1NzA8/GjOFKaXzPTnzPeJ\r
- H7t377Z7KYDExESlkrKKMRpoVNc2ICIqjsx5w4svpEcSTwg+GQwLi0B5eQUGB4deyOB8xiffZwZiRATI\r
- 7D/o8lIA1dXVq5NS0gfvjQBGxlx0dnW/UoPPArjsJQBz7O+OHLvxmzV/k6Nz0pIXAZFqbGxcmpSS1tP/\r
- EHD14OERjQYzIqPjwBhJ9KS0mJifZeZltntRGTLHPukpEKs0d4p3efBavlbXjl2143vz1377u0+eBcO2\r
- 0dj4xDud9wB7Vx6GHoEdkfukB6PAQ9IwlRejnwLOi0q0i4592kMg5g5DbENTyInkPjwu1s/Mvy9rZlm6\r
- 5aSS4MPPPj9O6bw2E4gFCA4Nb2i7C9g689D7AKz6aFSYkRkYBqhDYpDA5oNj5g+bGolJ7UWS8/bxQ3Pv\r
- GFQJwJ6Mu5F4IxD7koJHIY4iJY5BHN3dLzb09m2T5+jH/2PvPsvfv7P8M3YZxPzzueJX1dQH2Ln5oJV2\r
- 1j4EdJCYVJjR6b4P9JBYMBILRmLAXhSOuijb7SZITMkFh4SjomUQ590F4ktk2pt0lUyHk+LIeCopRwRx\r
- CamSOnCdaEJsLfAZfvvbPb3/9dcNoSyAg5NzakXrfVyJyEBmWRNa+oHWAeAWiUnmNunOINDOaCG450iN\r
- LctpJRkVm4jsqg6cd/SEP5kOJcWQksl4FqmQjF8jCVLSRWsOnej6hZx6h5RDygOpbDGkpJUDWABTrplN\r
- bNZ1JBa3QBiahvoe4GbvYzVQMo2kJoJqJrUQFAtHUCwcQbFwc4CxyT2jJBNSsxFf2IRT5/RH9x0+cWeX\r
- vFIPr7xyPI9Mh1bfEK//56neX8qe7ZAyCRqUyhiDVA4ZnpS0ylUWwMjIaO8l34jholYRuI4+qOwEqkjV\r
- XUANqbYbuEGqI7BJuAaCY8FIDNiLwk2WZEp2KYJTq2Bq40UnwiHk5DSAo2fTu2H73p5FWp79Ukn3JU1P\r
- B5BRDWQBeDzeO9aOngOFtwADWz5KbwNld4By0rV2oIJ0vQOoJLFgLwg3V0lOJpdZXAthdBGMbXgswKTO\r
- apr1SIw2Y5zK5meuWfilggmkMkSQ2n82iAVwdnZexLWy785pBjhWfOS3AgUkBqiIURtQTCohsOeBY1Mj\r
- sak9I7ncila4BWXCcAGA/whsxFu6Xlil54UDYfVYa34VUqmPGIDgqeW0nqHZrfRGQMuSjwx6zGwCskjZ\r
- BMWA5bYAeaSZcCwYaRKMTY4SY5OjxNjkFijJfKpPa3489KzmTuC36i7Y4p4KxZIJHM8ahEzAtacAB849\r
- BVDT1K1PqgfULQRgHpNvAimk1AYgjcTAzQRj4QiKhaPEWDhKjE3uOVJj4Aob78PIJRS6NHBzldAHF4Q4\r
- FHETGwx42GTsjb/p8/A7NSdIZU1A6oBayFQCCqeVy6KqxqBh44eI66OIrQXibgDxpIQ6IJERgT0v3Fyp\r
- zQVXfGsCWja+0LKYAaDBZefASiqbb1wS8D7nMpaahUAq5eHTSX1Q7fF5gNEB2aMhvKRGmPlkwy22AWFV\r
- QDgpohqIJEXVANGkGAKbC44FI7GpPSO5mXDqlj7QsPBGTc3g00n8BODnNnFYFH5n7k508HzYFMD273Zo\r
- GLpFit2TboPjmYKr14DACiCIFHwdCCGFVgJhJBaMxIK9BBxTkil1IriFFEDTSggDzyRo2wWirKxzFsCs\r
- TkSpLAppfdyFDqmHPwXYvn2dgob5/SulE1A09oFPKXCF5FsG+JH8y4EAEgM2C46gWLgFUoupnoBTWDnO\r
- 0Ugrc4VQNveFXXgdu19GGrYhyM9vmQJQfZLAFED8XbxuFICVVEqrFAwhFdnJAERMAUhLSy/d/88z/cIS\r
- 4LiBEF5FAI9RMcAnCeh9Zps3QbFwBMXCPTFAzWEWmH1ELc6YXcEpEyGUTHxgGlABQbGY3Q+/aAKGgnyo\r
- Gl2GtoknHFyuSpTQJMDP3fOwXOcS1loEQT73AZTomN/SnGABZDWfAjDzYIe0XOelQuAYzXzXPMAtH3An\r
- eRQAniRm22XSJBwLRmLBSLZRzVDi+kPeQIATNAgcfiE888bZ7zCyiW2Hipk/1IwuwcDsMqKjiyU6z/Qu\r
- pKph2suM/grywpjeH1zFdqKdHin4VO0i/Qbog9ThGQCbtu1pYYwf4Qhhnw04kBxpJ04k51zAhcSCkRgw\r
- y+h2KJgG4Zi+AMf0BFBzzYRT5ii7nZEzrcY0XNNwxuAytIw94e4ZTj9Lu+Y1PR/AkdhWbKCy/ojK51cc\r
- PhaFtT2e1Ee0oiSuC32xfnMNY/qQjhBW6YB1Bo0ayTbzsUxj+nDCLByyOgLI6gpwyi4JVkkPWNBJ6QU2\r
- YI+KGz7ba4Jz2jZITq58LsPTzTPPVdUfJ/CWih1+T2fhxbzS2Z3oiLYkwKrVn2ebRPXh8IWrMIgfgX7U\r
- EI6ZxUJaS4D92gL8YB4Nk5i7sCGYSZknDUPOOHx4vazF+AdbbPHG5gy8tncUr22rh7IyR5yUVCGeae55\r
- Xk8CzNWFpt47oh0tkcCKlX/2ULRLwVl+DXaqukHWMBSc0G6Yp0FCZ/lVY9sUrdp2HdMe+Pjrkw+XSbdj\r
- udyEpPbWIDGxgq4LRcLIyAFcrut4UdHt507juQDkdGIkAN588025bQoWY0bJgPE06UYM4aCe39j3ikYj\r
- MkoaY2ZuHhMZdXVw9vKH3Gl78SrFcczUhwcr6EpczZThkpJ22NsLoa9vI3Zx8RdVVfUvCKNy3rRvwdFn\r
- 5oCMSpIEwOuvv/7Hv2yQGeLEi3HCsXBit+rFcWVzD1gLA2id04qawUEJCcNioMflY91Z0SytOVIk3rJz\r
- d5uRseNAVdWAhFkGzNzcDZqapqLg4MzxuUpqXgD/OqzYp9j3P1v39Ur9+p2tEgDL3n33vZWfrh06Z+GM\r
- 0Ny8WYZnAvhEx8HK3hfbdMZmadOpYmTdvAknX9/732zbkX327IXy1NQq0UyzQUEZTCrQ0bEYSU+vm5ov\r
- yudNniaQOY5fnLa4t+nQqQ6uhcdARUUPXRGMekBXKVZMAXy2fv1WjpVVw0yT872uHBhAbPk1uhjmCBmD\r
- IRwwGZXQTpU8pNfXg/1cSen49n37rnz44SdHDx9WCLe39+6cWUKVlf3w8AjBuXOGYzRfHskraT+UulQ4\r
- /mdphW75M5wu6mZP4W+PSAKsWr16h1tg4N1nma/o70dJTw/yOzqQfecO0qisuBau2HkqGidtRiQkcz4L\r
- 0ZWV7OcKOjuR1dyMnQcOxDEnzCVLlizbuPE7a+pSxQkJ5aMzUymk9biCsh6+3ys3UF19d9ZcqWoephJ0\r
- 76cE3mUTkFNSKlnIPGO8uLsbOazpW0hsakJM/U1E3LgBF14IpOVtoO76SEJHtVPhX1KCGCoj5vPpt27B\r
- LzNzfM3atbKTK2AysOijj1btOXhQPsjGxquNKY3pMPLyZ9unvy4t7YCJiXODtPRRwYoVH6xnrwvR36/t\r
- +ILR+QDKenvZEWcMJDQ2IZK6T3B1NfwqKuBdVgbry/5QVLeHMX9YQif1E3ApNxf+FdcRQp+PqqtnQbbJ\r
- 7E+c63Ih+Xjr66+3mP74o25uTEzRI8b4JEBgYPo9JSWNtC+/3KBJn1s6/ftSixcv/ktAcop4LgDGfB6Z\r
- Z0olroF+I9TUsoYEpaW0PiqkJUYu9Fy8oGHoAvurDyV0xjgGF9PS4FlYCGFpGQKuX0d4bS2kj5+gXw0L\r
- 35d7//0/bdm//wffr77a3Lxnz2H+8uUrvpjvO0wCSzmW1qKZANepbAqpdjNutSG+sZE9OGOeT2XhSjcy\r
- LmZmwjwlFWdsHWFkdQn8yAcSOm8aDm5iIuyzsmjdlE+r2VL4XbuGb7/fS78gXt2NRXYOyMge6ynv6pJo\r
- m8zo57a3I6WlBdHUTYKqqtiS8SgoIFPZrHmDuHgouLmDY2SP4MQhhNA1nElpmwfDIDYOlqlpcMzOoZVs\r
- IdRt7PHl2k0vdR9g3gSYDevWfeOoY2hOl1KenqxKqdswkzaZukcU1X1gZRVbCu75BTT6WTBLToE+GTwX\r
- HEILLyO4C/ORlHMPkcmd0LW6gh/0LVlABpQBVrvoCMUzmv3Llr373itPgLmpICsrn2ls7ojI3Hw2iXKm\r
- /imB1JZWtpMwE9envJwdSWZErai+jalEODExOKFvin2yilA2dcRRrjXUQ8OgFxsLk0RaraakQIFjBDsH\r
- 7webN+/Qe5Xm2S40raUtoQkT4uDkPcF1cEVUYRGKqKwy29rY7sG0zKvU15kUPNkJnAOb9Aw2CQZENyIC\r
- F2jEDeMTWOPGlI6SuRVU9c1ga8vvXLt246lXbV4C4ElPXbR1624HX9+EQf+AZJhau8LUyR3BBBNPXSjy\r
- Rh07F67QGZhXXMLOB2dqlQ5UIkxZWSYlQcXBGWcucGFq5Y709Fpa73Br1qz54tufwvwsgMmDvP32u2t2\r
- 7TroyeFYVZMJscA7GlZ2l8G1caeO4wyOpQM0zW2hybWFDvci9Kn0jCxcYEcXhpOTr9O94Nh7Cgrn09at\r
- 26Qz112VVwkjsZibuWM6+OK//33diePHVYPV1AwzdXUtq8zM3O54e8cNM0YjIwvErq5XBy5csGvS0uKW\r
- qKhwEnfuPOD13nt/XP0qTS60rwUB5jlj/ozA3v/DH1Z+98Ybv/qSnv/m/8vsnH7+lQd/Fcf+X104LlAR\r
- 5z/iAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAChxJREFUWEfNmPl3\r
- lPUVxmvX32p/6p/gsdqqgCxCIlpwqxU3IgWDtaBAlYTsxEjAEFBCksmiEEDBgBANmx7coIh7gklm35dk\r
- 9n3L7DOJTZ4+b0LSOTXIkNPT05zznPedmTfJJ/fe5977zQ0AfvJ/+SWA/afmzll4+4svVB4sKqruKC6m\r
- tlR3bCmhSqs7SgSVUeXVHaWCKqo7yiqpquqO8q1X14MPP9w40++62ns/gBIeXLggf63FnIbXA/h8gD8A\r
- BIJAMAyEIkA4SsWB4SQQSQHRDBAbBeLfA4kxavyH2lxRO7Z02f3HcoW7Kph5MA2PC/+G82fBDRNwCi6R\r
- BTdydbiG/Wewq+3s94uX/nF3LnAzgi2Yn7/WbEzD7cR/Da626TSOXgLKtu9PL1qc//y14K4KNqRPw2UH\r
- 3I4sOC/TOhW5EFN7jcjFs9JaVHcKO44DnZ8B6za/Eps3f/6yH4ObEWz+nXmFJm0KLityh4ux5qbSmmbN\r
- XUlr/J+T9VZYcRIFTGLtUeDIhXE88XRR6Kabb77puop//ry8QqMmBacZcF4DLpAduRngYjSEALemrBs3\r
- M4ErdwE1nUDHxyN4YMUz7l/feONvZoKbOWICmCoFxyDgmIKzZaXVTbdOpVVw7BSc4NgpODo2eiVygmMr\r
- 6jvxl9JurC47iU21p1G15wyqXz2Ce5c9NJA72Ny8QoMiBbuJYDnATbSTH4GLMq0T7eRKWrPbyR5RS2/O\r
- YHfOWbJGJ03CZgB+KzdgpdqNzboAKg0h1BjCqDYGUWrwY73Rhwe0dtyvc+BBnR3PDvlQbg2h1h5GvSOM\r
- bfYgSmx+rDa78SeTfUIFFhc8349N97oGUcvl6wLTipOw6oDfKczYoglgpz6CRkMELcYIRINR7DEN42UC\r
- bjB48Te9B88ZPaixhLDXFkG7PYIDzihed0XQ4BpGlT2AjVYv/m7zotThh390fLoR721p/S5nsHmMmGYg\r
- CYsGaFVHcVAbxzFDEu9QXaYkTlDHTQm8bY6jfZCw5gjaqKP2BN5zJXHKncJZ6pSbr718zhNDhzuCDm8E\r
- b/miCIyMT6aV7aSxra0vd7A7lqxR9yVhVgF5SjueVHvxoiaIrbphbNOFUaMLoVwfxLN6H5ZrHLhbY8cy\r
- ar3Jj/KhEHZYwqizMpVMa7E5gKdMbtxncGC50Y7Hh9xwpsama66xtf36wFSXkxhSAu8rUzivGsHn2lF8\r
- rhM0gi/0GXxp4pU6P5TGec7VC5Y0vnaM4FvnKHpcGVx2p3HZw6tvFF9507joT+FiIIUvQmkEBcdema8E\r
- y92Vc29fslrRk8CgHJgns+BhpQvrlH4Uq4MoZ+TKtUFsZt2tUnsYURsWKC3IU1mxlvX2gokmGQyhajDI\r
- awAbhvxYYXAiX2tFnsaCh4wO2GJj08O/sfX16wOTf5OASQpskvtQIw+hURVFuzqGfaoY3tDE0K6L4lWm\r
- tlzjR5HOhzKdH3tpiPYh1qQ5hkOWGA5aaQAbn2Nqq5nSlyx+1NmC8MTGp6dEU+sb4pxrbO5tS1bLvkrA\r
- yG+ploWwW04nKqOEiuOgJoH9BNyvjaFZG8UObYh1F0SdPox2YxQdQ3G8SVMcpo5Y4uiw8jnLMF6xBFFP\r
- 1zbah+GKjE+uTRxhTa37JDmDzSGY9MsEDP0sfpkNTyo82KQIoko5jBpVGC+pQqig1tIUy2iOfJUN96kc\r
- WMeolbHXbTOFUUttM4VQxNQWGNw0iA33am0ooBGsobHJtYlToqllH/Pyw2V1xpE05w+LV4kvxaGnX84O\r
- pPGxOIML0lF8Jh+Z0CXVKC5qRvCJOo0PtEl8oEvhnJ7FbcrgkmAK8yi+NGfwjYWFb+V79gw+cdBEjiQ+\r
- d2fgyZqvzS0dspzB7vj94lUDF+PQsSffKbXiEbkbz8rZCuRhlCtCKFMGsZFmeIqRvFthxwKFFUsZuUIN\r
- 2wrTWsW0VhnYXhi9DWwpj+pcWKRm8VOPGVww+8amR1iz6DrB+i/Eoe0BqgZYGwOsMTGLWprAQUkch2QJ\r
- dMhiaFNEUa8MYwfTuksdxj7W3WF9nI04ManBBA6ZomgzRVDPtL7K9Lax3py+8cl1nZFrFh1QXFfE+s/H\r
- ofkGeF7sQ8VACHUEa5LG0CiJYq+UQLIItjOCRYzkJqUPxaoAdmjC2KPlJKBjRVQrR9geA0cXo/eiwYdS\r
- ox/b2EosboJx4RTgmppnA/Y1cJfYisclLH4JUyMdxkvUVmkYm2UBFMo8WCazI09uw3KFA39V8Zezz9Wy\r
- jWzXsvg5JV6gIQo0LtwtGERtx0qmdcg1NrE2CQedZtEhtvEci/+OW+8q6D8fg4Zgx3s4+3oz+KB3BB9d\r
- HsWHfWl81D+CczTFOUkGp6UpdMuTOM016WP1CD6lLtAYF7UZXOSEOG9g4ZvSeJ/z9dxgCv/ghHByXfdy\r
- p/MSrrn5EAffLMAWSGz4s8SN9eIASsVhlFGlYha1JIDVMi/yGbGFjNhSRmwNI1aiDqGS9VapYUth9Naz\r
- pazQuHEXI3YPI/ao1gWjbQweHnQEuOamN9WzAnutl2tML5tmbxKdvQkc4ww99l0CR/oTeKs/PmGKvRKa\r
- g3X3pjyBE5ytXYoE3lUn8S6bcaeGZqEpWnURvKHnM4YYLNZxuHnQEeBEzW9xh5lFxFb1e7BxIICqfrqv\r
- LzKh7f0RbOXrUjr2abEHq6QePCP1oljO+lJG8IpiGDtV3ETo1irO1w1qHwpUbqymNmp9MJjH4BJWdcKJ\r
- mg5rcwa7/dZFK/s+jU7U2HKxA0+JvdhMZ1b1sfivqJhQ6+jY+/n5vVIHHpG5sJFgNYTaTtVxSrzMVlKi\r
- pElUXjygdOAhpRNPc/DrB8fgtPAExoOOqPEw19EcI5YN1sniP9GTwkka4HRPBmd7RnCG15NUd28anZe5\r
- CDKt7/TTJBIaQkpjSDP4UJHBOUGqDE6pUzjBtHZpEzjDKWE2jsMxxBMY4USNb88OLF/iwAqm6jm2iy0D\r
- YVT0D6OkP4Tn+7n2MJJLxDYskthxj8yJQva0LRz6lexvldxIShjBDQo/HlO6sZgTQtBjTKfGMDZ50CEc\r
- wXiymEXEDnIv62Thd/WyLfSk0f1tGu99ywjw/hijeaAnjgOM2iHqeB+fYRs5Q52WcL2W8cp2cpzt5LAy\r
- MaEummJQNz5x0BHgRHs7cwe77ZaFT3z3SWSixnKVllNCGGHCfNXzeCFsJsLaZOJSM8gxPcTBI2zEZjYH\r
- C8tdOOgIcKKGTmPOEZsN2MQfcA24wRngRA1HGbccUzlrsFnAifYc45H6fwGWDccz9nRaudkLaTUxrcJZ\r
- YiqtBKMFcgS75aZ5jzbUHve1737fK6ht11lPtlrrz3im1LLzlHtKorqT7mnt5P3ObpeovtvVsovX3e+5\r
- WgS9JqjLKai1ocu56snn9DmD8Z/FN1C/ytIveZ+tX/D1lH7O+yn9jPfZ+ilfT0n4mRO61j/thM//BR1x\r
- NCLR9Yu7AAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABChJREFUaEPVmVuITVEYx5fLmXGdaTSa3Br3mDAeCIlxeRAiRBE6pWQy5dJMETURDZHL\r
- FHIrzYuEGCK5ZR4kxIMm5VqIcnkh0ZAs/2/sc2adddl77bP32efMqX9n5uy91/r/1rfWty67A+ectesP\r
- AbRntWvzrb0n7NZHd+wHzYaqoO3QPmgvVAuthqZDRWHVGwoADE2BDnZk7Dm+aVDZ6KEDOCoITCAAGIh3\r
- YuyRpWE3qGsUtXRA0gJAZTM7M0YtaNPSfu65gDLL/ID4BkAFu7yMTwTYKgidnqPz8z3QFmgFVG4HXWUL\r
- YQ0A0z3zGKNQa1t0MX4/D/2gvOChT7h+AprhDnPYBsIKAKZ75zP2WGc+DhNPLUyboJrw7CwzyGkvCE8A\r
- mI51YeyBbH4gKr0SwLgMdAxlYVzpotvgBuEJEGPsnGyeWuxziOYTMAgxH6GH2GGCcAWA8RrZ/MIMGBej\r
- 8d480OfpIIwAMD5SNl+RYfMJkFeop68aiRe+ANB1kFTa+mQB/n4dEQCBIN3pxkOtDKGNAIxPklv/ZITm\r
- E5GoViG+UzoXIbQAWNM0iABRdR05M9GcUqxCVLsCECH0VwRozELrJ2B2qgBPvACWi+aHZ9E8QXzUj4Ux\r
- CQilC8H8KRFgc5YBCGKOCrHBCID1zksR4HYOAOxXAc5oAWjZIGcfDPu2xVkRNlLxeDQqKUnWe1cFaDYB\r
- DBUBBsitX16O5yL6VFQkAb5o0qkJYIIIMC5HAGgcaBZ6ecqmHuanigDY6Kau7bMUAQJAbpdn5gIdQMoM\r
- jHDkDACW9DJAVx1AygJuSI4AfFPNt5jGQA85C/0RIWIxzktLo1F+fjL6tE+QfCVXpspEhnXQW/Hm+zkw\r
- DxxXARrdZuKzIkBdDgAsVQG2ugFUigDKQI4Y6Bfq66YCTHYD6C+PA5oJvY5KMnX9qGr+jed+AACXRYgl\r
- WQQoUwHqbADmy1G4mgUIHGvrtpWDPQFaJwjGmkQITBD8d4QQzagLGVEGOGK1J3YAcPKXWsDKiABo7qHk\r
- IdVP++E+1gAOxAEZgjbamRqwiXIX6LtOpWxeWUpob2DsngyBVy8ZgaAlw1y9eePxoufRIswPgz7IEHS8\r
- iK1baCB3UJYm41A3atI1rHEeMERhPArCviK1X2L7xncHhKDNykZ9q5N5OlQuDgzgjIexKOyZDEH/0zHg\r
- NggvyKwjAmd8HYQ9uC5V0m/XoUI381ZjICXnojVQKL0GMlXKR+PaGqgewo38FnQDwgKr9W0NZbJBLs87\r
- Zdd7GffVhZTU9f8V6lc3kDSvUYQX2Zr3HQEpGr1QGV5/sZ9pmhWj+A5l1PgxHigCEkh3VL4WwhGSr7eW\r
- Lbj/IrQsHeOhAUgwhTCEgzS2CcI+hF1ywG46Y+cQvtdD06COQYxnBCAMQ37L8JzI/BYY9f3/AJQMVypF\r
- n/EwAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="No">\r
- <value>Nein</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABMNJREFUaEPtmW1o\r
- U1cYx5+mSZPcvHax6GTIGBNfPlUp6FBERIeonTCoyHBWOuyLVKE207UYCY3isszg2iTFpJ2hXW1ybReb\r
- tkq0nQhN04rECSW0VavWFtlg3YeBjK3b2TkdnV1y09x7d+dtsIHny3055/87z8t9zkkGQgjS+kcA0tnS\r
- WvxM9KTz6i8CLATvvT4hhEutdNkyWLtzJxw4ehQ+PXsWvnS5oKWhAXouXYLwsWPgEMMjjB7AYlWFhVBh\r
- s4H74kUINDXBYHs7TEaj8MfEBKDJyUQbHIQXGzfCerYQeA5q1SrIy8+HT8rK4JTJBE4837f19dBfWQmj\r
- +L6CzViMABYLhJ49YxbKJH72WnU12GcnxQIyly6Fd7Ztg4JDh+B4VRXYrFb4xuGA3sZGiAUCMHXvHvMc\r
- fX0wrdfD27wA8MRZHR3wfD6hye4NDMBPdXVwDYfV3dZWmAyHYfrpU+4LMTwMaMMGeJ8vgD4Ugl/4AAj5\r
- zu7dUMQXQNrWBj8KKYbPWCTs5gKQyFi5Upa7ejUY/nWdiRIn7WM+kwrxDsmLQECCSktlvSYTVXf+vCbg\r
- dmvv+v26511d+t9WrMhamxIAl8X7QohJNsaDB4Bu3MhAPl8mNhk2OfL7KWxqdOuWHj15sgRXukRratI9\r
- xp7ISAngdkPffwUgVSwSAXTligQLlM6I9PmU2FQoGNSioSEDo0gm4bPXnE5tT3zEMJZRpxOusQWIxQB1\r
- dUlQa6sUWxY2BTYK0bQG9fdno/Fx5tWcT2iyexaL2s0KwG4HPxOAz0eEyrDJsSmxqdH16zo0MsJ9NfkA\r
- FBcrP2MFcO4ceOIB7twBdPu2nrPb+QhleufhQwPavFmezwrg9GmwxwP4/RJBw4ErWDCo+xknsJYVgNEI\r
- 5niAy5dloq0+gfV4tFGmks+YxMXFUJkIoBAVwGZTt7EG2LcPDicCUKICGI2qL1gDkA5ybjdKPjwdHVpR\r
- AfbulZewBli3Dt4j9X3WC93dEjQ8/GpKJVNyRyLZ0/EtxD9tOyMVwFukJ58FIB8prlVDyOe93sQWIhUA\r
- FQzC1EsAuagAtbXq3mStddJNfUsLjL8EUIoKYDarGjgDeL0wRADIHph0iUKGBNexiooU1ZwBPB6IEADS\r
- UZKmjOukQj0/OsrcQsybA+QmPjIJEQCazsReEK6j5Ap29SpzC5ES4MIFaCMAZMPBdVIhn3e5NPfn2xsn\r
- TWJ8BPI1AfD7xW0hampUIV4AZjN89TeASlQPlJUpfbwATp4Ey8gIoO5ucVqIsTEDunlT/+uuXcwtRMoc\r
- OHIETnR2ShDZSAgZ03PHItvNcDh7urlZN4FjfcBqVbdXVVG1hYXKE1u2ZH1IUfBmqrOhpDmwfz+U0rQw\r
- LUQ0+safNK2bcrs139vtmk6TSV1fUqI4tWOH7OOcHHgXb1QkqYRy/g5s3w4f0TT7FiIWM+DTBt0Lr1c7\r
- 5nBoe86cUTWWl1M1e/YoDq9ZI1uPRcr5iuSVA3l5sJWcLsx1+aNHM3H5e3Oz5gePRx21WlV+o1H5eUGB\r
- vDw3V7oVi9T8HyJ5ASxfDksqKuSjTqfqO7OZch08qDy+aZP8Aywy51WL5AWwkEQuAixkb7w+f/ItVC8s\r
- ekBsz6S9B/4C+eG8h3vJrfkAAAAASUVORK5CYII=\r
-</value>\r
- </data>\r
- <data name="Green">\r
- <value>Grün</value>\r
- </data>\r
- <data name="Define Colours >>">\r
- <value>Farben definieren >></value>\r
- </data>\r
- <data name="Ignore">\r
- <value>Ignorieren</value>\r
- </data>\r
- <data name="Help">\r
- <value>Hilfe</value>\r
- </data>\r
- <data name="Add Colours">\r
- <value>Farben hinzufügen</value>\r
- </data>\r
- <data name="Retry">\r
- <value>Wiederholen</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABL5JREFUaEPVmX1olVUcx0+3ba6VDmP7w15w+TJ0rJc/EhuytuqP0Gz4UqhoDoLYcOAW\r
- TpQFW2KaKFZihbMg/CdCxTeU0VK2P0SdzD9CGlsrfGtg7Y81pFjiPH5/u7vee16fc577aHcXvmz3uec5\r
- 5/s5v3N+5zzneYRzzib0hwAmsia0+bHRE3XvYzg+DS2E6qAt0G5oF9QMfQC9Bk2Nqt1IAGCoHPqCsVgf\r
- /tKkctHFccDSdGDSAoCBasYe7XY0bINqo6iFAQkFgMbeYCyLetClp33KHEGdJT4g3gBo4NNg46/A9PtQ\r
- M7QL2gk1QWugF12A6lwhnAFgejJjORRqg4F3cP0w9M9YarDrT/z+DfS6DeYrFwgnAJguZGzSJb35apj4\r
- xcG0CaoT975pAvk+CCIQAKazGcvtUs0XodGTaRiXgVpRV5YO5IANwgEg+5Bqnnrsr0DzM2ZwvnEj5ytW\r
- BA2pxO+XUOccHcRWE4QVAMYbVfNLA43T+C8q4nx4GM2Of/budYX4wzTR39ZBGAFgfK5qvsLJPAHU1yfN\r
- 039DQ64AVO436Ck5Er96AmQfFgGmoMLfnQEWLxYBurt9AKhsm24oNcsQ2gjAeJna+986m0+k0G3bOB8Y\r
- 4Pz8ec5LsWEITq9ymQ0yxC1K56kQBoDYARHAfej4m7SB0ZpSIENssALEFyx2VwQ4FqL3wvS47p5PZICf\r
- gwBWi+aL/0fzBHRTNxdeSEAoQwjmvxMBNnsDlJVxXlGhV2FhmMgskiEaLAA5/SLAGS+Aqiox+8jfenvD\r
- AHwmA/ygBYhvG+TN2i0vgAULOB8dNUN0dIQBOCsDXDYBzBIBnvUyn8hAxcWcL1/O+eBgEqS1lfPKSs6z\r
- ssIADCrp1AQwXwR4ORRAAuTKlSRATU0Y46n3KBu9HIIQJjHMvyoClGcQwGQ5ClN0ANIKPD+DAHJlgMd0\r
- ANIGbmaGAAzL5kdMc+AJNQvdCQ0R3Ryg5wQhO97fmWoWstg1sfCFDADYLwMcs63EB0WA7RkAsFIG+MgG\r
- UCsChJ/I0Qyh/2A+TwbAchk/lNbthZ5R5wGthP55PBqAfbL5qw7PA+yECPGuM0BuLufTp8d140ZyIWtq\r
- il8rKPDtiBIZYLsLQJUahVNOEO3t9s0c7ZNoS+EW0d2yefqOs47kOw3bQ32nCDEXN98ObLinxw5Av65d\r
- 6wJwGW3FZICvU81r58D9yYFzPzUK7wUClJdz3tJiVgN28nl5QQC09lDyEHI/PQ9PcwYYo2PscxWCHrSD\r
- DKT7+xLd0KmVzVsjkBKJcypE3QOCoC3DWzrzxuNFh6NFNhsAAyoEHS/2RwjSgbqUjEMwnbqeN64D2jAx\r
- Ng8VDaoQ2WhgR5oQ9LDyoa7X6RodKiPxmt+kBkYgZSi9hMp6VQiaaHQM+DHU5wHThbLroRyT+R/RVr7N\r
- vNMcEHIuegOV0msgU6O4/jxUA+2BjkCnoXboIERvayiTPWe5f6zuPUHGvYaQkrrir1D/toOEen9GEV7m\r
- at47AlI0nkRjO6F/IwC5jjoafYynFQEJ5HE0vg464wkygvJHoVVhjEcGIMHkw9AiaBO0Hzo+DvbT+Nz5\r
- En/roUoolo7xBwIQhSHfOpzTqG/FD6v8PRJO78MpB02PAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACj1JREFUaEPtmQtQ\r
- E3cex9eKr7vO2evUu/Zs72F7147edTrezdmWdmyvnfM8q5718BwRX1WEU4vYIohKtYjhKSQ8E0ICojwl\r
- ikAtiqL4FpQozxACBAiEEBIgLIIC3/vvQtLwTBC8a2eOme8kM1l2P9/v7/vf3WymAKB+0H+MgR+yftDw\r
- bHu+z+lT1PZn58zZ/dbixd5bV22J4qz2yUz+RHjr1ofRd2pmHinY+D83QABnzJ69a76t7WGHVfahh+0O\r
- nT6xQnD96ieJUtmnkqJG+wvlHTultX1u1Rp4qrTgNGvANzTCt1KO6cIq36dugADaTJ/uPG/Roq/sVnwa\r
- dNDOMyVmZfiV3GUnCsv+kfZA9a9zZe1OBcpe18omfFHbAi91M47pmwikekwdliswPabaf8IGCOAzRC8v\r
- XHjwk6V/9/VY82VC1Cruxexlx+8WrUy9X2eXWdq69WZNj4usCS7VOrjXa+Gj0YBLII06pqnHgfzrcE2N\r
- h3uCEPvjwnFYenvQNubbM+89y6sZAwFWGSCAP58/f99fliw5usdul5i3OjA7c5k4X7oiSar89EyJbtO1\r
- qkc7itXYqdDBRanrH3WTBr4E1ChOUxM87t3DzrQUfC7mY19cJHziw8A9GYq4U+G4k58GvT4fNC1lFSvh\r
- Y883GYP2Yb6/PSVKYqAmaOASsP1Hr766992PPvLZZbeNH2h3NEtCFkrBigRp1SpJsXZ9rqJr+/1GOMt1\r
- cFbosVtJRq1qxqGG4XIrKoNTegYco/lwFYbDSxQKX3EIIk9wkXP5JBobr5kgjbCjvebeTIWzKHrE4+x4\r
- UEvWgPIYa+A9x3j+unw1HMtbsEXWiu1yPb6saYE7AR1Ju0tq8FlmDjZECeAUEQa3qBB8LQxGkDAQkkwh\r
- 5PLzVkNaMiFXXIRjkD++lDcOYtlaWM8YCGYN2O7LEDmUtsKlklTAgrbweIhLDkVh4Wm0thZMGuhYRphq\r
- fRHMgePNUhOfQ34DpglrQ/oNeGSI1txvg2Opfkw5RMejsCjriaGb2h/gVrMMSXW1ECsbIarRELUQtcGH\r
- 1NPSNIJiebA/ncsyrrmhxrToWp7JwMqCdmyQto6qtSeykH0lyeJBFPpiXGioRHytCnFKNWKVzRDX6Mlr\r
- O1LraORrOqFtp9HRMVhiYsSSAeZzSXY81vATsfKKBtMEdQMGSIWW3OiA3e32EbUy+RbiJNFjHuCwrA1x\r
- NQZ820CjQtcJwxDAocBPaoAxcfd+FhYHJDIGwkwT+OBKB5bnGYbpb6dl4AhCLKYjJvCWIMf63NoJGAz3\r
- cD4pGPZvvo2tz72kXUtR/2TXwDsXaHx8oWOQPjyrhosfxyI8k8rTNnDzjgQhCQI4bFoPLbl9yyNqIIqg\r
- qPOsgYVZD/FeZqdJtukG2B/0QXv7vadqwGCg0U4kqh6+BhSKHEQkRsErIR5H7skQ2Qa4+fmjj4D3EgmJ\r
- 3CgqlzWwIK0Lf0x9aNIyj0BoNDetgh/vBBhoFpws5rY2Gq1ERgPNzTcRlyaAd4IYB3KustDmCiSL3c1h\r
- HQ7MfQ3v/3n13V9T1M8oW/cM0WsJ3VhwvIvVBx4CVFRetBreWgMmaCN4Kw09kbbFAPfUb+B3Uoh9krPg\r
- abqGgYeoDPBKSwMvOQZXriVhoWs0poU1CPoXMTHwsqgb8/jd+JOnBNfvnB4X/FgGRoPW62nkXS9AQHwy\r
- 3E+mIUChGQYdru/FV+fOIzBJBElWDLlwfnev9OauGNiENkSbDMyJeIzfeN5CSmb8uOGHGjD22rwiTNIM\r
- tI4oIycP++NT8XVB2TBopi7eN+7CJzEW4pRIqFR5I/IscBbChtcYYzLwk2M9eH1b7BPBGw0M7XWrGXSL\r
- jkZLCwN/FQezh3ebU65iF2t4QgSKijMtcsx3JBMIaRSZDMw42ot5m57cgKja0L8gB3rNJK1joIm0BLxZ\r
- SyP928vwzLhoSp3p9b6kdPjFJsPjVLZFaPMr9etbRLA5phabDFAHgV+uOz6unZjvUFhlYOthDq0l0Ay4\r
- ppnGEcld7OSlQXA8FTxxMgLjUiBOTEdVjQ715OrNl1t3K2E85m83xMImUB03eQYUBjZpY9oMNKMmDQ11\r
- E41L8k48e6IPaSUPoWqkWeh6FY06otp6YqBifAZ+t9HcwN6z4olOILrSwAKbQzcS8EY1jQYCzEAfud2N\r
- 2Sf7kFvRyUIzUpIbvJpaGlHjNPD6RrHZBCbBgIAYUA+kzUITMdAqJmkiJuk6AvzXrMd4JbkXBZX94NVK\r
- mtSIRqTM+gkUSM/h+c2XzQ2kiyY6AX6FgYU2pm2CHqgImzSRVEHjxcRe2Gb0oIy8V1TTqCSKJN8Grbmd\r
- ZrZZvpsLag8m10AUMTC01wy0sSJs0gNpSx48xFtne+F67RFkZBIVxEiElQbSshIxa2vx5BuIlBmG9bra\r
- rCIKUhMm6coqGnIibkEX1l7uAb+wC+VyGuFllifQ0VGId7fyWPhJn0B4uYHttHmvGWi2IgPQTNIVJHEm\r
- 9dIKGr753eR50CNkFj9EeKllA4H8CDzjpH5KBkoNpooYe80kLWegiRhoJmlGZQS+VEa+XpbRCJN2Q3C/\r
- G0ElY38n1mpvY8EGvgl+yATOTHgRhxIDTEWGQsuGQDPgJeU0igl8fimNaGknOA86yFlIPeYidvEOALWr\r
- 8ykaKDGYkjamzSY9kPZdApxQRINX1I6IUi2EcjWSa5SoJA8BLJ19Ksmt/SvrEwfBT/oEuMUGUz0KScIM\r
- LJfAMotTUNEPK9eXWIQdycwaF29Qrr2WDdg4N2D5jqPk8d/1cR/IqbAdYeU6ckVVI0lZC5nuyWDNDVRX\r
- X0SEMAjPb7gwDH7QBN7b278G2NPT7h78fkMEzl1KHbcJS1UY7XPmydv1GynghAZjm9cxLHUJwx828vHC\r
- +kxQjg2D4Q/0YYZfV+cs/1bVFH77jv5no+YGBs6xL2y+hP1B3Ek3UVWVg/gUAb44GoQ1e0Px7vZI/Mr+\r
- OKZvkoJyefQd7F5gqvfjxzMDOnQzfVvKqED9Kep4zwHqDGypHMw0/1VpRAPMNKY6NWCpMwf19VfHbYRJ\r
- Ne9aKry5wfjMi4slLpGYv1GI59Zng3LSDE21b4bfQ3qWX2v9NF/tNSqCDqNSsJGAzrXm569RDbCVIovn\r
- DQcBzp5PHtUE8/gjhjyzcT3KxWq3cCzaHo256xIwdVMRqeTj4an6k1Q5LaUk1VSSqieVjncI7AxrYEfa\r
- hnp/hAoZL9fG159uzsNefy4u5aXiUAgPm73C8fHnAjC3tT+2vwjKuWV4qr4kVV993TSONo+kyiWpOhDQ\r
- Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J\r
- 9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l\r
- IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="Hue">\r
- <value>Farbt</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABLtJREFUaEPtmWtoVEcUx+/efb9ujGAKtoKk1mekUgkV+1KkSH1QlYjUZ7C2FcUiVTAF\r
- BQWr9V0q0jaIQbSUBFrFKGpFUPCB+EA/aLW11EdbTW1Sq631k6fn3Oy4s3PP7p3s3phdMPBPZvfeu/P/\r
- zTkzZ2bjAwCjpH8IoJT1RMxjhEOdNUidAoCGN6HQs52e9Ku+ZADQ7LiUaTIua1pnQHgaATQcQf2UBaAN\r
- 3+/lNYTXAF9mMS8isbtoAdD4ZNX8K6/61TSi1x95CeFJBNBUd9SvMsCQl/xw92EZvDk6wEEM9QrCK4Dt\r
- 6ujvPxy3Ac7/kIREImMyE9CJogFAMzNV83VLw7Z5oS31US4Kn3oBUVAE0HhPVKsMMGx4e+qomjYzyEGM\r
- KRSiUIAmdfSPnEiwAL+1WtC70lQhfsbn44VA5A2AHX+gml++MsKaF9Fo2h3jotDwxAHQeB/UAxlgxKhA\r
- TvMCYuGiMAdRmy9EXhFA483q6J88x6cONx+qX3bUh/v4eZX5QHQYADtaqJpfs4FPnTv3LSCwU+cT0PbA\r
- ehwhmidMxd7X6QDYaZXa8Vtj+dRZvT4CZWXp9b9qsAm376YhVq6JcBBLOgrRoQig+UMyQCxm2IVKTZNN\r
- m1lzoK5QY8axVXpYRyC0AdB4nTr6n22JOsy3/mtBxTM+x+gGgwZcb0lHgKAvXk1Ct3LHvWc8B0Dj1ar5\r
- iTVBdtU5fobNb5hRy99f38BW6Y26EFoRQPPHZYDy7j64/IszdWhUv93jXOsty4Afr/P30zO174a4+fC2\r
- DoQrABpfoY7+V9ucqSPmwRdbnSNKE5ZbTsV7f9yz4IW+jip9A/std4PICYAf8LpqfuoMPhWEmeWfZE7g\r
- vv1M+POfzNznYHbtZav0zkIBzsoAzz7nc0xE1cz8DzPT4bvmmFaFps9ZXMdW6fdyQWSNABpfq47+9m/c\r
- zdRMSe86x47X217IgzDceYp7iD76ZYNgAfCB0ar52e+HtEbyjZHt24RwmK8RueYCXTt2ml3FvtcGwM79\r
- qEsyQOXzJrT87Z7HZKD/gPbJSOngZjbb9bUb2UK4lINwRAA736yOPm2Ddc3cvGPZ80Te++g+K983YRJ7\r
- AHpNhcgAQOMTVPPzFuilzo7GGNBB3jQN+wy8bEX+ESCQK9eS0KPCUaUvZAVA40nUNRlgUJWpNfKr1vF7\r
- n6s3sxcvnag07GSr9OcyxOMIoPGt6ujvOdD+zUIu0dygTZ36LFVr2k67Pe92fc5ctkrXCAgbAH/eUQ0s\r
- WqKXAr+3WfaKIz8fChlAKeVmTuf6X/9ZMHCQo0rfwv4qUt6NHviiRTYwtJr/ZiFbh427YkDr94tDTJg+\r
- K2gfYnTM6d7TfDDO7ZUaBcDX6ugfOuqeOrqde3Xfx8vYKj2P0scR/mTSABKtJkLxuAFClPNC0agBpEgk\r
- LUopIUonIToTCAUCBgj5/QaQaAUT8vkMEFI9Sq8fOQBy3MyFsevfS+VR1xtRMkF7IEsZwPaeAuiGxGUp\r
- WfhXiIqbUALbQnFsC8WwTYpKov/UCIWxLRTCtlAQ20IBbJNoHyZkYlvIh21bObcSboeHYrzueqQsRtPs\r
- VqLYjWqfB0oN5GkKdXXEnkagqyPwP76kA5sYKmTOAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD6JJREFUaEPVmXdU\r
- VNfaxo/GfBo1GuONuUmMJTHGllhCchV74VOxtxgrKkhVFCkWlEAAEQQB6SoggrRh6EMZemfoAlKkqiBg\r
- A0VABH3uew5CBtCgN/pHZq1nTTtzzvPbb9l7n+kHgPlHP1iAf7L+0ea57HnT0S8tLR1cWFi4Li8v74Iw\r
- WZRgGO5RrRXk0awf4HffIyg+OzQ03Cc4OPiAv7//mDc957s4rk+AysrKcQXFpS7qwX7PJnvK4XOfORgX\r
- NAUTQydhsnAyJgknYYJgGr7ykcTXHqsh6ayF85f5Oa6urmvehcG+zvFagKqqqsGFZcVWOwU27R86zsZI\r
- 388xIWQCZkXMwoKYBZCKk8KK+BVYHr8cS2KXYHbUbEwNn4rRwaPx0dWxGGu/E7oOVhm2trYz+jLxd75/\r
- JQCZH+eeGVU83GktGPdBGBU4ClPCpmB+zHysTVyL7anbIZsuC4UMBchnyEMmTQabkzdzUBKREhgnGIeB\r
- /IFgHMdhkdWhNjMzs23/i8mV50uGTTtwRWLinvN7f1RwsJhxwCVohrpvyiyNwOwZshZJr6wBMj/9ckxR\r
- Qz/b6WB4DD7x/wSTwiZhYcxCziRrWuuaFvSu6+F04WkYFBjgZN5JHMo+hN2i3ZBOkOYg2Ej04/UD4zIU\r
- X+nJw8DA4ORLiH52SbWjNGzD58qe9pBXNPGyUTIPDFGxjkhRsY3KVrGLLlSxj61QtourOWwf/cDQPemJ\r
- e0zBC9GNu7jb2Ib258CLF4CdnV1pLwAy/0V4enXNB7P5YFyHYoDPAIwVjOXSY0PSBihlKkEnXweWNyzh\r
- VOGEqzev4krlFdiX2cOk0AR6+frQTD2Og2GaUA/ShXaQOfQEF2Ho6Q8Lj2Q4ByXfdRKk1TgGJt33jkhr\r
- jM8ueV5eU4/m1uecKXG1tDxFUVExQkPD4OPD7xKPx4eb21U4Ojreovmrf1cKkfkBafm3M4ctuA5mVBwY\r
- q18wzG8YJodNxrK4ZVyaHM89jvMl5+F5yxPCWiES7iUg9m4sknOSkZ6Xhbi0ZCRmiFBYUo6HDY1do9XT\r
- HPu+ra0dFRWViI6OAZ/v2yUfn47XQUEC5Obmo7HxSS849nsvL+8aAhjSBUDdRvHn/WVghoSCmV8JRm8/\r
- RgaMxHThdKxOXM2ljn6BPpwrnBFeE47chlzcarqFksYSxKXG4TmZ6qnqOzVITEqGr58/fH39OPH5Hc8B\r
- AYHIyMjCw4f1vQy+Clj8MxZAIBA8IIDPOAAy/7GFW0kD82EAmO8ywPx/NZgDzvjM7wvMjJjJFa5ypjKX\r
- 866Vroipi+GMt7S3oK6lDsL4CLQ8A4SRsfDhk1nWsF8AUlJSUVtb99YG+wLgUZQiY+IbCWAMB1BSUqL6\r
- 5TwyzviCmX0DzOoaML/exKdXJbkIrEpYxXWbP67/AcdyR4TWhCLrYRZKG0tR+KgQfKEvqu89hqs7j4tC\r
- Xwb+7vee3r6IT8lsI4DvOYCY1OJk5qNgMB/4g1lBo7+hDsy2+xhqK4fvQ7/n+vxO0U6u+5wrPge3SjcI\r
- bicg6nYehOUFuBIqRGJ6Ljx9Bbjf0MRF42kb0Ep61k75Tp2D7R7vCs7T2w8p2UUYMmToLIaWB6MOW914\r
- wY3+iIiO0d9yF8zuB+h/oByjA2bil8hfuDTan7EfJ/JOwPS6GxySWuCc1ArH2Kew8a+Eu28oYkTXkZJV\r
- gPpm4FEL8Pgp0Eh60go0kZoJrAuOwP5XOE+eH9Lyb+KbCROXMrm5uVILD1LasACfRoJZWwtm6z0wex+C\r
- UX6EoQ6a+C70O8yLnof1SeuxL30f1DKNoC3yhm5qIHTSXOm1FRzc3FBQ1QQ3nxDUNgJ1pHtPgPukB03A\r
- QxIL1kBgr4WjiHGRewnHRe1l3xdPOw8CyKR5YeqPMzcxWVlZu6bJFHcAsCm0hiLQCaDyCMyxWnzqs4DW\r
- PhMxJ2oOt3zYkrIFu0S7sDdtL/ak7cG21G0wv2yHG/cAG2cf3KwHbpFuNwBVpOpHQM1joJbEgt3tCUdg\r
- r4PrFrWXKXnVyw85lU8w82fJfYxIJNL8Vr6qA4DVgtKuFGIUCOBwI5g/sjDEYxE3qf0Q/gM3sbEzM1sb\r
- i2MXc9HRtTuN/BrA8pIPB1JCKr0PlD0AykkVD4FKEgdG6gS78zo4ihgXOTG4xxQ9NiWvePgh985zSMxZ\r
- qMYkJSUdmXaUUobx6wCYktVVxMzeejBKLyF0RejvsghDfIdwa6PxgvH4NuRbbt3zeeDnUDE9jKwqwPQC\r
- H3kEwsJcrwUK6oBCUtFdoJjEwREYC8eBkViwm51wYlHrBUfpyKalk7s/sqqBOQuXH2fi4uK2LzaitBmT\r
- 1AEwlCayldSJNlEhb7/fUQvyDR0gahSdS8u4NVJPbTPYhZSK5zjjwEfGbSCTYFigbLpQDunaHSCXoDg4\r
- AuuEKyK4LrDOqPWE65GSF9z8IboJLFy+/ncmMjJyyeZz5WCWi6XRl/EdtcBCsPWw4wHXlRgZgjkSCMbr\r
- o14A8/QWgp9QBn07PpIqgORKIIWUShdiL5Z2C0gnsF5wBNYJ1xU1AuwVNTE4e7cgxJU+x9LVvxkyYWFh\r
- w/WcU9oYFZoQJoj+rIXJlErSd8Cso660keYFFmYziX22XdALYLzhdJg4BsHIMRQhec2IprViLCmuDIgv\r
- BxJIiQTWBUdQHByB9YTrFjUC7JmSl7wjEZzTiOUb95hyE5k3PyBksGorpUo7mJFRHRD9qSamXQMjRZFh\r
- J7eVBMMCsc/aR3sBDNfeApXjlnAQFMIhpBChRUBYMS0vWN0AIklRJUA0KYaFI7BecBQxLnJicOkE2DNq\r
- lwNT4JFUB+mtCuc5AB6PJ7NMn+YCNgq7msAMolm5syt9QpObBLXZRbfBLCYtukV14dQdwJHW/lL+2KWk\r
- B6+MZpyyD4N/PhBwHQgkBRUAwSTi6gAjhb+Ei2DhCIqDI7BecOJRe5mSbmHXcEFYgVU7DtpzAO7u7h9a\r
- XuKVDzz4rANiPeX94JA/IfpRRP6dAGZ6AZj/UL3MzQPj0/9PCDUFMJMKsW7bMXhfA9TN/eCVA+41Lxfw\r
- IfHzAF+SHwv2Ei6I4FgwClpvOAIThxMWtsLcIx4nLXnQOOsOl6RHWCuj4dS1nKYNwsb1+lQDLACr/W00\r
- 8rQ3+IBWqJ3RYJ/7UWp9RHBugzsATKeAGRbEHbd0hQrcsoBDpn64kgG4ZoJ7f5Xkng14kDwJTByOT3Ac\r
- GEk8agF57TDzFEHzHA/qZjxoWgbCNqKWO9elhMc4fJZfM1d6x9lue2Ira1v/qVq0J+iEYJ9lmsFMTO8O\r
- wYJc+pQgBlFEqB5eAv5nriyc0gEVEz9cFNGFSI5p1LdJzvT5ZZILgV0hMHE4Fswj+wWMiezQWR5UTUg0\r
- CKbBt7jfOaW9gK5rZssOTaus5TvUnSf/vESOVqIf99pSWlhYDDEwOZ/z5WFqoeIQnSCr6HNJqpVJmdSJ\r
- vgajKN2xAfqa5pDpufh+/kGYR9RD4Yw/rGjLbUOyTab9K8k+BXBIBS6QOuEMvAuhfMYHikY8KJ7hw4BX\r
- wh3Dyiz8PmT1rt5cK/9HsMTSXw3+9eX4H151Y6DXXQkjI6PRJ/RMiieqFfWGEIdyWUKbHkozsc8+k7aC\r
- mnU0ZE/7wzSOTJDM4wGLBFpikHS8y7Hf0Bf79HmQNfDBiSv5sEoEJ8u4dqhax7cu23uufu46BZdvfpi7\r
- jUZ5UF93M155W0VHR2fY8eMnBPPVwjBAhdprz2iw742ce30+aHMM1imbQf5sOHRDmnGMV41d+tSddH2w\r
- W88HahcycTbmOQfG6pRP1Yv1Rxwf/bz5bP3XSx3ah60sx7AVJe1k/F99Ge/8/rU3trS0tPqr0WPfQe0H\r
- 05SiMED56V9HhKD6y9VDYpUCjnlXY/NxNyhaJcMgog1G0eCkH96KvWdCm1bK6Ves36XRNHqecfvYnS0Y\r
- t7u9S6PXF7QSwIi/DdB5AkVFxWFycnK6O2X2VyyUOYtvZCMxUu46hshXY4DSEwyUv4uP9xVh5M5YjF9j\r
- jMm/SL3QiwA6pepS8mKzhl37DnXjdo0zlgi7lovrDQ1wdA/Esh22mKHU1k2Tfs15SgDD3xmA+Im2bt06\r
- ZdOmTepr1661lZaW9peSkkpdvHixcP78+Zdnz55tICEhsfyriT9VbdHhP910yPSZhukluAqjkPfwIWda\r
- XI5egdiv6YhF6s+6SVIuE0rHjqVLrVun8CYQfd7cfZOTdB4zb+nS1crHtOuSKyt7Ge4J4MQPxCkjV2zQ\r
- ae2mlarpyKypgfDatfZ1v/3mRNH4v7/y8M4A1mzdetArMupJT6Pi7/Pq65F57x5EtbVwFIRCz+gC9ho/\r
- 7abNmimIpQEQ0e2Y1Dt3aHmilPhX3eidANAFPtDUN6h5nflrlEJpdXVIqKpCFJkLLS2DV1YWlFS1oWbV\r
- 0k0yJxIQUFCAsLIyRN+8ifCiIkhISmq+LgrvBEBi3rzd8TduvDJt2BFPrK5GJBkXlJSAT+Y8qJCvEIDa\r
- UX0o66VAz6m5S4q60XDJzIJnbh78CgsRUlKKrfIKtFp69V9h7wRg8Urpq/mUHj0jwJpnR11YXo4AGknW\r
- 1OXMTNinptLElgBDa2fsUbXEea+mLqkZCnE+MREXRCK4EKR3Xj5ktY7R7YD3CDDtx1maTv6B3QByHjxA\r
- MuUwO/KBxcWceeeMDNgkJ8M0Nhb6QiGOWzhAWescrgQ96dKJs2EwjIjEubg42KWkcNHYuGsfbTzfIwDV\r
- wEClI0ebxCPQOfrhlMu+BYVwy87hRtU8Pp4zqB0sgKLxOWjoWCIwurFL2sY8nAoJgVFkFM4nJOLERWq1\r
- S1a6vVcA9uQbN+700je1RjrlOwvSCcAWoziABQGcJoCTAgHkLK2hpK6L8Nga6Fl40sLOGgr2F6ATEooz\r
- UVFQt7SB1knj5jFjJkx97wAjRowYvn27Qujps7bwiopBVwrRfwDiKWRLKWQWG0dRiOBGeo+BMRTMraDp\r
- 74/jQcH4nf7QOOXnB2UdQxiZXLwnJbXmLye0d1LEXQsraqcbNmy3u+wiaDWzcsYZm4vwIsPhVMT+XBHn\r
- ckXsQEXMFioLYhwdzaWLPhlXNjaD1mlzWDt4019SNoWSkguW9DWRvlOAzov99NOc9QoKR9ytrT2qrnoI\r
- YWLhiNMWF6FPRatrYQ9tC1ucOGcNbVMbnDKxwe/GNnTMZfrTI6Xt6NEzotWrfzs9bty4f/dlvteG5k1+\r
- 8DbHsKtKKan1p1RVT/GOHTOK0dW1yDM3d6nm8WKfOjsHNxga2padOmWapqFhELJnz0HHGTN+WvU253/v\r
- AK/cQTHMYAKbSPqC1O9tDfc8/r2k0N819Ta//8cD/Bf1OK6O+/e5egAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="User Colors">\r
- <value>Benutzerdefinierte Farben</value>\r
- </data>\r
- <data name="Sat">\r
- <value>Sätt</value>\r
- </data>\r
- <data name="OK">\r
- <value>Ok</value>\r
- </data>\r
- <data name="Blue">\r
- <value>Blau</value>\r
- </data>\r
- <data name="Base Colours">\r
- <value>Grundfarben</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACTtJREFUaEPVmXls\r
- VUUYxVtrLJFUTZTFJUgQgooouEAxGheM/qMREo0b0aCJ0bA0smihRUE0alwQlQfiAu67uOPCYlUoguKK\r
- Ii4gsgikaGmLRoz1/B73NNPb+15f+4wJvhzv5c52zvd9M/PNtLCxsbFgj/4PAXsy/jPyBXMLOghHCqXC\r
- 2cKFwlUReOcbZdTp8F8ZLS8BInKocI4wVpgpzBYeEh6O8Iiehr9RTl3a0PbQfMS0WYAGLBT6CZMCwpB8\r
- VJgj+PeY3uJwGfWoTzsE0Rd9FrZVTM4CEohjUUjwg+jjwhPCk8JTwtMJ4Dvl1KM+7fjRD/21WUhOAtRx\r
- R2GUQIiExCFhws/o/VnhOeH5CC/oafgb5dSjvgXRTyiEsTrm4o1WBaij7sJtAq62xU0cK0MGchB9UXg5\r
- wjw943AZ9ahPO9rTD4YIhdzO2K2JyCpAHZwipASsTtzicgZiQCwZkn5F/35VeE14XXgjAXynnHrUR5DF\r
- 0J+FMA7jzYJDNhEZBaghS96DAXmsg8tt8Zf0joVNGsJvCvOFtyO8o6fhb5RTj/oWQz/0Z48wDuMhAs+X\r
- ZhKRKEAN+ggsdawS/Jh0odWxHBbEoiYN0XeF94QFwsIE8J1y6lHfYujHHsGr9gbj8mPu9UkS0UKAKh4u\r
- 3C8QNnHyuBtrYTksCAGIQArCi4T3haoIH+hp+Bvl1KM+7SzEHqF/xomLmAG3uIhmAlRhL2FKRB734UZb\r
- nk6xEuSxOiFh4osjwh8WzCio7jm+90/9xh2/Qd+qAyzV+xLhI+HDqD7tLIT+6Jf+GScU4XC6GY6hiLiA\r
- waqAu1htHPNYwuRx9VuR1QgHLIllIbTkoKmdvqmYMblh09baxrLU+Fp9WxHDcv3740gUYiyEfugPb9C/\r
- Q8oiPCfgNThRgApKhHsF4t6rDROWmHTYhOSxHuEBkepjr++/Yd6C+bu2/bazEYxOjduh758H+EzvK4VP\r
- I1GhEPqhv1AEnmBcxocHqx+8CO8Si2jygD5eIjDjCR0mDxsNqwIT1mGDhRiEwbDeUi10y8+dMGT7mrUb\r
- 08SNUalx9SpfFeBrvX8lfBGJspBl6X529xeKcDgxPjzgAy/4XdpMgD4UCaH1cVkYOkwwx7wtv7RwZuEn\r
- l065onZLTX0z8ogYlRrboDbfBVit92+FbwTEIASvfCLgDUTYE8wtxmPccD7Ay14oSp9l0v+bW9BXIPZD\r
- 68dDh6WPWE2HTdEDRZ9eecvVdVu3N7Qgj4CRqbE7Ve+nAD/q/QdhjYAYvPNlTAThSP+Mw3iEbBhKoRf6\r
- hgKGq6KXTWKNmPPEtfUJHZbAj4rvK1454vay+jBk4u8jU2P+UN31wi/R82c910WCvtcT7+ANi2DCE06s\r
- UozDeHEveC6wvF+5+zS5Oz2eLnjy4qYw9rFCk/WLphetGH3H2IZs5CkbkbruT7XbHGCT3llaEbVWwBuI\r
- wBOEExOcVcqhFPeC54LD6IE0d/1vfyFcOnGTw4fljM2KmHxfU3zJBeUX1bZGnvIJqZt2nThpwE7jpMqB\r
- DUK9UCfUDqgs/X1ARen2ARWDagZWDNo2sOLkLaUTT94sbDxsUjdCDC8wLuPDwysS/FjiWVL3RwA7b3z1\r
- iYcPm03VqWWnbd3w6/bEmM9FVK51zrt56BbGExg3HkbhPOiOgH6BgDD+SdJYylg6F/YZ03fd59+u+SdX\r
- EvnUO2/qEAQwmRHA+PCAD4b1PGDB6Y+AMyIBTAwLIDNsEnBI5WFfvb5oQdMmlQ+5XNoGApgHoQB4hRP5\r
- DAScJsRXoFDAu8eW9/sxvlHlQqS9dWICWEDsgbiA0xFwXGseUPmiiyZfVtNeQm1t1wYPHIeAbrnMgX2m\r
- 71M97ckZf7SVTHvqRwI8ibPNgW4IIIlL2oXZwsNNrKr7lB7fvf1B1d+5kNq8bUcjK1Z7cO6U870KxTcz\r
- lvdwFSrxRnaPCpxCk/8n7QPpBK7nxF5r36pa3KqIa+4YuatzeZcdQl305L228w1dfhNqhG1dru/6q7Cp\r
- y/iuvwjru447eK3wQ8nU/chiGS9pH4Af+8B9QqFzoWH6R7gTk8g5C222E+v70iMm9Fz35uKFWUWMSI2J\r
- 78Qb1ZadmJTCO7FzInZistPWdmJ4eSe+PMyFeiesRBlzIdWt7lF+xLqn3ngp49Ia5EKkDsDESerIheIJ\r
- HbkQJ7hcc6HeoQDyobtiYZQpH2JykTUuO+DWA1aX3TW+ISmdjrJRyJKROhN1EkdaHc9GSeTol/4z5UEO\r
- n2mET5OAKKUeEoRRpoyUmAxPYst0d7HyrBvOqfls1epmu3SW8wDEfbAhgeM8YPLZzgPhqWxo0omsOPJC\r
- eJi3F7wrk5f4RObjJIOv6DWx9/o5857+KzhS1uk7BxcD0qTOPsiEJzKfA3wi8wGfcZ2FhtYvbiEg8gKX\r
- WfFdOTzYODcKRRCzxO7HHW8rWXXtnWV1LKHRmZgTFysKT5+JsTjx7jMx7eNnYh8n42di0p1B2W4lmAvl\r
- AksqRzdmvA83PtiHVyq+B0rfSqSFzC5YfvqEwVsurhwWv5XwjQQeQ7BvJXxP5GNkSN7Jm1eeCrVrdgWf\r
- dLHVSZXuFsJQ8vk4LoI8hYwR1zP5sCQWXVI8uQOhwuEkBKRtcerTjvb0E94LMU78XohDV6esF1tNcbU7\r
- veDEk0kEscku7WsWCPieCFLh7RxEDb5T7nsgXzHSD/3RbxJ5rjlb3Mo1W4VaKJtbcJQazQpEOJyYE74b\r
- 5cBtIVjQ14yIAeH9qL/5OpH6Ju7bOPr1PRDjseNy2Dq6TZe7gSeOUWO2bHuCTn1fhIvjQohfSIU31BA1\r
- +E459XwXSs5FP/Tn+x+TJwrStw/tEhCtTAeqk0rBE9s31UxuBrQQXE8IYE3AOTYOlzlUQuL0x1JJ/ywg\r
- NwoH5fUHjsATe6uzywRft+NaNjsGZGAmOa5HDIcOiAFEGf5GOfWoTzsTpz/65Udutndr5LPOgaTG6pTJ\r
- PVLAG/wYEIvhcsQk/Z3MfxvjacLUoz7taG/ioxgjF+KJG1muDSMhI/T0bQYutxgsCbFMoNykaYdXMUqb\r
- iOclIAitfTXwicJwwWcKJrx/EDT8jXKSMdqcJOybq+ESoyKfxglLL5tgT+EE4UxhaATe+UZZi80oHw6t\r
- /pk1n87/j7Z7vIB/AbqI4PWoWfWuAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="Color">\r
- <value>Farbe</value>\r
- </data>\r
- <data name="Abort">\r
- <value>Abbrechen</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB6pJREFUaEO9mQtQ\r
- lFUUx/+77LJP3o32HMvUIqxMe/hEGlHTMTVSS53M8UFoTWmDItSWGiMWkQgLu6CwmbtLigpJVgrjjFkO\r
- A6mlkZQUmNRMNb2cqWzSbucu7bIL34tlF2eu7Hzf/b57fvece8//nk/FGMNA/1NFq25kl1hnSMblAAPZ\r
- MBGzkIvvMRuFBBDZ37EH1njAiJdwEmfA8Am159GIB/BgfyAGFmABbDhNhnMAb3PjF8zBdvKGLhiQAQPA\r
- BMxALX4PMN4LcZKAMj3emNJXiAEBoNk1wEJB4z/zQr/34Fekoagv3hgYgAUo7RU6YjDcG1lowlikKvFG\r
- 2AEodKajRiR0pDxSTd54FFbyhl4KpM8A9EKtVouhd9+Nh1NSsOKmm3AXXVMLDcIHp9Bplg0dMZBT5I1s\r
- 8sY4TBODEASggQcnJWHGtGlYt3Qp3sjMhPOVV3B42zacdjjQeewY/m5rA+vsBPvwQ1xJTcVTggALaAZ7\r
- 7jpy60Do/n78hnko4Wup5zgegMREjFm5EuUFBThhteLrAwdw6dNPwb77TlnLycG7vV48HlNxgAYOxmD+\r
- DIFrDtDfreig3NGADDiQiPm9xiEqVW4uzis1VqjfoUP49frrMdz7ck/o5AQXOje4wZ6qAMvfDbavBmzY\r
- MKRIroHbb8e9J07gSn8A+LOvvYYTNBHuwkIcnfAcfgaP3yBmf62t2+vffAM2bhxWSAKMHYsVFy4oCxUl\r
- kG9/ABZd62f8cbDBlWBG/2sSYBvKA22ZORPZkgBjxmBea2toAPiMjcwAG0VGpFEYrH8TrKoOjF+3VoFp\r
- 6+W98lxZoC2LF+NVSYARI/DgKXK3ktmV6/Pll2BSkzGlSB4gvQfAqlWw+62tG0aP1syfO1dnWb3aYEtO\r
- 1i6jTR0jjh7t/xqQg+P391J46Q9JQyy2gn1A/RwONaus1LCsLF3Hli2mY0VF5ra6upg/WlvjabKvYR0d\r
- CWzyZG06P1MkVFfjNyUGhKLPJFqkUos7ZZOGNTfHUY5J8Bgq1urrYy/HxqqGcwC13Y7OUBjX8x0tLWB1\r
- tAbeektNTcN27dKxaZYISYDZtkhJw71AxcXm8zwFeBLZ9u1oDRagowOMMjNzu9XM6dRQi2S7d+upGdnB\r
- g9Hs88+7XO5thU4zowwhCjG9VBlAbq6p3nMc5v+9/jqa5QA++wyspkZFhkZQ01LTMZfLyPbsMbPGxlh2\r
- 8aK0y70ALS3xLHaXOEByiVaRB9auNZT7APLycFQI4OxZMLtdz6qqTKy+Poa1tSkzUip2+b17SzSiHrif\r
- 7sk9z++npelyfAAbN+KgEMD+/Sraw0NjtL9RC206UYC7rBGyAGfOxLOkpIipPoDsbLiEAHi4KJmNvvbZ\r
- VGHyiDWh3WhEsVp2TKcz+kdawCYfwJo1sAsDKFtQfQVobIpl+reFAYYoACgoMDf7khv/kZ6OfGEAg+xs\r
- 9NV4b//EIuHtNKlY3usWi7E6AGDhQrzcE4ALvL17TWEDSBZZyJOs8os4PV3v00eebZQU3/M9ARoawE6d\r
- igsbwOyySME1MFsmD1y4kMCmTNGuDPDA+PFY9u23gYKOJ6Zgw0PJc09WCO9ES216yXEbGmIvx8WphgYA\r
- 0JEyle/5/l7gyUqJIcH2yXDoe3uAkuWLFUbJcW22qPP+8toTQqRIbzt+HFcDAXRhBVi6s7cHzHvBmmiH\r
- kpqUrVu7JESAB2hPvaa2NlCRut3SMxHszHufe7y8N4CSLLx+vbFMCCBi585uRcp1z+HD0WH1wBx770W8\r
- rFQ6/jn8Y4/pNvQC4BdKSroVaXW1irW3h15C+HstlURbQCYmRevYFyU5aWfPxrNRozQBBWBfLFE1wadI\r
- XS75vbi/IXQnJSx/gJspA/NTltR73e7on3oWt3wAVBbxKVKXKzwSwmscF4iD7KpuANJFq2S2T/4sHSub\r
- BCtz/CLVdN7x7kIuV/gkBDfk/YYYpnqvWwsNK1UrkuqbN5v2iAJYLHBygPZ2LiHMYV3AWypJjVLp0hNC\r
- jWCWSmU73tNPG/JEAdatg40DHDkCdvp0+CQE98AzOwy+8BldqFF0muMSYvr0yOWiAKtXdylSlyu8EoID\r
- zPs/B0RQoaukWpm3Gxpirl53nfpmUYAnnoClCyC8EoIDTCzvOlJOLlA+Vnm5+QehCp1vF5ozB2s4gNMZ\r
- XgnBAYba1cy0D2z/Eelkee5cPJVlYv4qLY1qz8gwuCQBJk7Esi4AZQsq2DzQ1BTHoqn6tr6ia6fjhQIq\r
- GPxTVhZ1kU5aTRs3mmqefdZQMn++7oUJE7Rpej2ulayNem+OHImH6GuLp/oQrHFiz/EF+NFHsVcdjqgf\r
- snMMX4xaEPE1lUV2LFqk25SSol0yaJDqVrHPVFLG+87E/IfBgDtKS1X/ymVDMSN5KZCXBKuqoi4VFprP\r
- 8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B\r
- bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe\r
- incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAAA1pJREFUaEPtl11oUmEYx/2aigx30ag2XXURYQwTkiBDMaSrugi61CBidhVaKUF4M6Iy\r
- ugga9kHBRqMkKiq6ihYYMYqtj6tiUBch0UAq4oSY0Nbs/4xz4PBybJ4v5wGFP8ej7/ue/+99nvO872tu\r
- NBomQ38IwMgytPnl7DHy7HcBOiF63RQSRwHlOAaN9fb2vnW5XN+dTudvfK95vd5v4XD4/ejo6KNqtZpD\r
- n4PQdsiqNoqaRACmh6E3EC0q/5Xb7ebS6fRYxwDAcADiVjIu/t9sNjcSicQsIE5DATVRUBUBmLJAH+SY\r
- F7fN5XLPYJ6isVcphFqA/UrNUz+8H3WO467wEDuVQKgFuMEC2O32xWQy+XJmZuZmpVK5Vi6XrxeLxfs+\r
- n++rFGyhUHjMA5zHtUcuhFqAV6ypeDz+mjd0Edc9UD/kHBkZGUTbRbZ9KpV6wbenVBpuN8BH1tDU1NRt\r
- 3tA+psT2oO0ftn0mk3kuAoi2G2BWbGhoaOiHyMwgA3BAKoUmJiYeiPqE2w0QHRgYqGDRqvn9/i+lUumW\r
- FACM26E5FqCvr69Wr9cLqwbAz1YWVxLlsKBTzOxfZc1bLJalfD7/hOm3pa0R4B+2GVcSmaZKchRaLxiB\r
- 8ROseZvNtoBtxVPG/Fncy95aqKpCK80WjFPe/xUDYH/E3cOHMX8J97Q3ku1HdodWHwLTG6FfYvMOh+Pn\r
- 9PT0JGOeyu2OVsdl2+kJcJdNHabi0PtyDtqk1Dz10wUAxtdAC2IA2jZI5PxaNeb1BIiysx8MBj+rrThS\r
- sHpFYBsLkM1mS4YBWA6tyXSHIGjvHwqFPtVqtcsiACq3mkyeJoM0M4NqGaQdKTPz9PIeMQQATNJ+SLxC\r
- C99l73maAesaAf6hhxiIw7iXveK2FQC53w8dE4SD/EmPx7MLJpxapY4wjuYRgGk6J7+T2DrTqhwwAoBD\r
- at/P/3a8C8CUXz1SqGkEIpEIHV6i0AatIqEHgBXpMs+mkdVqXRofH3/IV6QLuHq0gNAcgF+Ft+LQMhmL\r
- xeYESZy+dncsAG/M1mQRExazLsBytLUIY5MxLPj9TJMo0BFS9gFe6jl6AtDY66CEhBSdf1cDQO8J0jWF\r
- dDev9zvQBWilwLRllloxorRNF0DpzGnVz/AR+AcOBL1o7Kmu0QAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="Yes">\r
- <value>Ja</value>\r
- </data>\r
- <data name="Bri">\r
- <value>Hell</value>\r
- </data>\r
- <data name="Cancel">\r
- <value>Abbrechen</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAfNJREFUaEPtmk8o\r
- REEcxxe7J/9WbvawVxcpBzkhpUi5OLg67EWSFAclxcnJHrW5UFw4iDO2uMiKZ6WltSVa689jd7Nr/6j3\r
- NbslntFr9Gqnec3W57avme98f7/vTO9NGQCb0L+CAJEhi49WgiYo4wUBneXlRQGklsTBbi/OeVpcAQ4p\r
- gG+52aUDnBu+4mcTO+uQb2oBRKLGiQ+SQqPFFOrqhXpPdjOR6BvAC5l7jxTAyzVrO3AcPMHG4gJFKHrH\r
- 1CcrCjCyThPOsvXZEeZwiCkdCpZ0Yxs6cLC/C9/kMEXw+opJgGeNbHJDNEqCTcA26rEJu44ddEkBkA7I\r
- EvruIdnERhsY9xS6Sb2hkPm/uc1lmWJ0KwzM79FEcmwxeoZlnMKn4wLb7DHK63jwn3GtfZT4z0rw+q90\r
- gNfKf41rcQfSaTzEYhT3uRxTjJbCHUMHEl7vny99VL+fScDE7AJc7laK8yeV6fnGlya4VLeO/uQg+z5g\r
- VoBnbIa8Z22gUGKPTAKqn2phe7TpaHvtkALAWkLSAVlCJlOIewm9rq4i39xM8RwIMKUIdwFmN6LIewah\r
- eJIiqmlMC3CpJRDS4jrC2ht7jJoVUIrnLX4WEuBVu3SgFHVuNIalHGh3OJCprEJKJMics+QTU7fQFz2K\r
- N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACKZJREFUaEPVmg1M\r
- lPcdx//3fs9z99yBEJt1WzqTrc2SZmk6a+K2LpvGtGE1jd1qRnWmXRpaK77WicU5GOCqgnIg4AsHihYq\r
- xyFUsWoEkbM4DirH+/sd9waKAqIyqw3+f/s9d0B5u+OgGK4kv+S457k/38/v/3v7P4cAAMgP+ocH+CHb\r
- vIqvWK3+HZrYmwPxuszb9XkFMIaqMyvXqT//+u8q4VQiq95VLTKuVRv9FuBGmKrUtIGjNVu4zNqPOcFY\r
- oTVbuT+ZNnJ91R+qHvktQO02zlq/U0kbditpY7QihRfaFKMQNv1bEdf4L+WT+kglrfsHN+iXAHURSgmK\r
- HGreo6Ct+xW07SBL2zRscruGvdyWyNLWBJa2fKqgCDPglwDo6Z/zwtuTWGo+zFBLOkM7M4dNy1DzUYZ2\r
- pCDUAbZ3XgGwivwULaTqPdUKUzj3BwyZ36L4JejhDzpSUXAGQ22fyan9tJw68mTUqZdRhw5/z5FT6wk5\r
- D9Iz5wDY+KRoCl/6B4pXGNeoG258qKK12zmMdSVtjWdpRxrjEujIldOuQhm9+aWU3rrktpsXpLT7nBuG\r
- h7McY+5jeNViuBXWf6I8iMm9CR2yEtdWT1lGUZyYZcnzS5eSNaGhZOeWLUQTHU1yEhJIyeHDpCE7m/To\r
- dKR/82ZyDe8dVz2mLIfvqX5p2sTd55OyGeO6/RDrChdePC+0p1hK71yT0DvXJbT3upj2lkvo7VI3iPMM\r
- QpzCnTjCuPKCdwBWLIoV7DMsw2IXwEsvkRe3bSOavXvJ+eRkUnn8OLEbDOSxzUagq8uzNTcT+tpr5C++\r
- 7ARWnNDGKCVticfYPiJHz6KHv5DCrWIJ3Lkuhv5qEQzUozUI4W6tmPZXiumdMolrZ/jQ4oHbk1nKJz2G\r
- obZ6A+fqHYRhyMKsLNLrTai3a1FRJGcsAL97zz5LfrFiBQl9/32yIzKSaPbvJ7kpKaSsNEE60JbEgCVT\r
- Do48Kdy8iOK/QvE1IrjfJoRBmwAG7QJ4YBbRe40i2meU0J4SKe36YngXMOxa9ilSGv6pHN11EhJC3p3O\r
- 094AjEZyf98+cjotjZzHnTPl5pJbFRXkid0+eeec+J75lBysWTJwFri932sUw71mIfzPIYBHfQQe3yXw\r
- 8KaQPugQ0bsm3AWDhHYXyaj9c1dCx0/cbbJmDYmYrfdn+jmbSQgdRxiwnpRBVyECXJFAX5UI7rUK4WG3\r
- AL4dJDD0LYFHvQI62CmkAxhKfG7wYYRV6gkm8/JJAKtWkc0zFTKb+61GETTvY6HjEAJMuwMCTzvQgxXs\r
- x+NCdvlyEjYbQTP5jOWaCOoiFdAUy0K7hoHO4RzonioHMJQemIWYzCLaWyGht4ql4CyU4a7JoSNVDpgD\r
- XzXsUkpGIMjLL5O3LBbv1WYmYife21EshhvrOajdpoTGKAW0JjBgPioHezbmwbgqJMYqhNYggrs1YujD\r
- 3LhdJoHuL6WY8DKEZqAtiYXhKpQ4CrBwIfl1dfXTA2i+IoKyoxK4+KkMru5loPIACw0pfCViwJ4rh65z\r
- MkxmKdw2YEX677CVS6CnVArdF9D7Z2SAfQCwDwBfgvlSPNwHVo+cJn9SXEwefh8vO50EsBrB6dMCyMoS\r
- o0nhJG75iRMs6HQcVFUtAKczGHvKd2a9ogLsxIDNDBNaBt3nsaxechsvnAfDTgy2IhYcTYHQVhkIcX+T\r
- R2An/j124mXYiZeOALBY+np8AWhqIlBUJEBhIhQpQZPhawbFKqCkJAAslqBxIscKnvi686IaYxrzIYMB\r
- HBcAq4wrVHjROAsBzkIuQOslzrVmQYG6H3tM4KQqxL+Rnk7MUwHk5YlQoBSN96YCF1FBXd0Cn0V6AzCf\r
- VQNOo4DTKOA0ChZ0hL1cDZ0nEUrL5wkDOI2CtUTt+nupqarqqTq+a5RITSU1UwMo5kTsVCBtOjXgeYBP\r
- SmjXKsHR6naMvQ7D5RCLyc4CngfAWh7oej8uTnnGI4BGQ65NBGhpIXARt9mbF7/PtZasAKxMHLSdUoPT\r
- Pj70bF8HQmOMEnD4A5vJDbZxI3PAIwDOKhcmApw7J4TOTt9jeqYwzRmB0H7e7d2prLN8AZi2cOAwB7kK\r
- QEiIbINHgNhYopsIkJ8veWre5wU7bdM7x2Jwe7+8PHDomWfIix4Bdu0iGRMB9FgNZurVp3W/VqvqxAo0\r
- 5aMXVxLzZ4HJAKzfAMTHK0s9nTlcAGFhJHYsgMNBID/fXX/9wSIj2eNeAfDYuGMsgMEggOrquan3c+GA\r
- devkUV4B8Fi4fixAfr7ILzzPw7e0BMGSJdJVXgFeeYX8deypLA+Pe3PhublYIz8/YAATOMArwHPPkd/U\r
- 1X03ker1OGD5SfwnJ3O13h4auJIYf35WVkYej4SRXv/0RoiZOiYmRlnoC4AqP9/9ZKKxkcDlywF+swPh\r
- 4QrNtAD8DVotsfIAZ88KwWr1j/LpcATDypWyTT4B4GOReh4gL0/sN943GAKfLFok/ZVPAElJ5DoPoNP5\r
- zwiRmqrs8zRCjJ6JR17gc89LPIBe7z8jRGwsa/HmfVcBGrlhzx6i55+mFRT4zwixc6f8rM8Au3eTE1ev\r
- CqCmZn5GCJstGAyGgG+ys1Xm9HTu6sGD3Km33/bcgSeF0Pbt5BB/Bp5pnZ7J/XxVMRoXDOXkqJzHjnEV\r
- Go1SHxWlSAwLYz5etky6Ch/p/2g6j0+8PhpC69eT/+j1czNCmPAYqNer+rVarjYxkSuKjlYe/ugj+a7X\r
- X5euDQ4mz2NiimYq1OsowV9cu5Z8otMxPu9AY2MQ9gz1NxkZnCUpSVkSE6M4Hh7Oxr35puyDF16QLEaR\r
- Xr+gnnOAN94g4Xl540eI9vYg/mA/lJmpuJ2WpjBhVdBt3apIWL2a2bp4sWwFilTPlZDZrjMaQvgtzR8j\r
- IpjOhATWsGMHk/7OO/LIV1+V/nk2cTlbMbP53Lz+q8FsBHtM4rlYbD7W+D9MzRR6eEGuxwAAAABJRU5E\r
- rkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA\r
- AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////\r
- //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP\r
- +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
- +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/\r
- //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP\r
- +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA\r
- AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
- +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg\r
- /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP\r
- +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP\r
- +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX\r
- +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////\r
- //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA\r
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\r
-</value>\r
- </data>\r
-</root>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<root>\r
- <!-- \r
- Microsoft ResX Schema \r
- \r
- Version 1.3\r
- \r
- The primary goals of this format is to allow a simple XML format \r
- that is mostly human readable. The generation and parsing of the \r
- various data types are done through the TypeConverter classes \r
- associated with the data types.\r
- \r
- Example:\r
- \r
- ... ado.net/XML headers & schema ...\r
- <resheader name="resmimetype">text/microsoft-resx</resheader>\r
- <resheader name="version">1.3</resheader>\r
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
- <data name="Name1">this is my long string</data>\r
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
- [base64 mime encoded serialized .NET Framework object]\r
- </data>\r
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
- [base64 mime encoded string representing a byte array form of the .NET Framework object]\r
- </data>\r
- \r
- There are any number of "resheader" rows that contain simple \r
- name/value pairs.\r
- \r
- Each data row contains a name, and value. The row also contains a \r
- type or mimetype. Type corresponds to a .NET class that support \r
- text/value conversion through the TypeConverter architecture. \r
- Classes that don't support this are serialized and stored with the \r
- mimetype set.\r
- \r
- The mimetype is used forserialized objects, and tells the \r
- ResXResourceReader how to depersist the object. This is currently not \r
- extensible. For a given mimetype the value must be set accordingly:\r
- \r
- Note - application/x-microsoft.net.object.binary.base64 is the format \r
- that the ResXResourceWriter will generate, however the reader can \r
- read any of the formats listed below.\r
- \r
- mimetype: application/x-microsoft.net.object.binary.base64\r
- value : The object must be serialized with \r
- : System.Serialization.Formatters.Binary.BinaryFormatter\r
- : and then encoded with base64 encoding.\r
- \r
- mimetype: application/x-microsoft.net.object.soap.base64\r
- value : The object must be serialized with \r
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
- : and then encoded with base64 encoding.\r
-\r
- mimetype: application/x-microsoft.net.object.bytearray.base64\r
- value : The object must be serialized into a byte array \r
- : using a System.ComponentModel.TypeConverter\r
- : and then encoded with base64 encoding.\r
- -->\r
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
- <xsd:element name="root" msdata:IsDataSet="true">\r
- <xsd:complexType>\r
- <xsd:choice maxOccurs="unbounded">\r
- <xsd:element name="data">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />\r
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
- </xsd:complexType>\r
- </xsd:element>\r
- <xsd:element name="resheader">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:string" use="required" />\r
- </xsd:complexType>\r
- </xsd:element>\r
- </xsd:choice>\r
- </xsd:complexType>\r
- </xsd:element>\r
- </xsd:schema>\r
- <resheader name="resmimetype">\r
- <value>text/microsoft-resx</value>\r
- </resheader>\r
- <resheader name="version">\r
- <value>1.3</value>\r
- </resheader>\r
- <resheader name="reader">\r
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
- </resheader>\r
- <resheader name="writer">\r
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
- </resheader>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAADftJREFUaEPVmntY\r
- 1FUax0efbbtaarr12D5bu6WbopZ5SVs1a3fV2rQsUcu8FJqlKCZkF9t1H7VUFBQVCXVFzTIIROU+DJoK\r
- iCggKgjC3JgZ5sZlbiAzot993zMMgjLjpT/W5Xk+npnf5Zz3e8573vOeM3YaGG0ddv89nX7fWSLpJKG/\r
- zuJf91+nTq3XWq/SffdntHtOfGm91/bdlnrb1t2J/q4CpvT3usiu1XKHn+YkNRwuNV2GN0qMLvjivNEJ\r
- X5wzONERX2VZry5IdWwCIPk1SIIyGjKuXr0Kb1y5cgU3o7m5Gd64fPkyOiK+xAGZvOkKiVj1fyuAheVr\r
- m5oDUx1L71TE/3QEWICLKDU2XZmb5PjoTkTcVAC71q9xIXYtby7kEWBpdOKIvKF59kGH/+2KuGsElOjt\r
- iCu2Xp6e6Bh3OyLuCgHWRop0JEBWVoetefUu/3j78FsVcXcIuORCqYEElNfh+1NGfHu4pum1H+39bkXE\r
- XSUgq0VAaFYVlqaaGl+KsT15MxF3rYCQAwp8ctBo/9Nma09fIv5nAgp1jQjKuCxYlOHCwnQXAltYQOWC\r
- NDcTfrLuvSsFcAiVKZoFmfLLXnk3wb7zjgV44r+vVMFbnG8b+10uF3zhdDrREY2XmvDefvsOnwIWptmk\r
- 3vIVz/U7NcBjVFNTE3xx6dIlNDY23oC9oRHT99u3+xaQapV664HbMcCbEWxYQ0ODTxwOBzrCYm/AjET7\r
- Np8CApPrpdw4s7vYgJAs1TVkSoTcAsGZCtyMT9MrMG1DHEbODsbgie/Db9RYPP3cMPiNHIshE6Zj1Owl\r
- eC98H/YUqGGz2QS1FjtmHrBH+xQw/1BNpsPRQD3gHbvdAV/YbHZqsGNyc09gypSpeLT7oxj8wmAsXvwp\r
- wsPC8eOP+5CeniHK8PANWLIkGEOGDEX3bt0xebI/jh49BlOdDbNuKuBgTaYvA/ie1WrzicViRX19ewoK\r
- ivDOO5Px5B+exLrQdSgpKYXRaLoppaUXhKCnnvojJkx8C6+vztzncwQ+OWDOtFhsYOKKqxF6XIV1zDEF\r
- wo4rEZ5NcHlcgQ1UbqTvETkqQolNxOZcFSJPEFRupTKK+GD5BvTo+RhWrFyFqiqNMFqvNyA5OQVBixbj\r
- r6/+Fc8/9zx69+6N5wY+h1fGvIp5H32M+PgE6HTV4nmtVofVq9egW/eernt/e6/XVFvy8X6jrLbWAqZS\r
- V4PzVTU4pzbjLFGsMhFmFClNKFQaUaAw4jRxisiXG3CSyKs0ILfCgJyLBhy9oMXUmXPRt28/nDyZ39rb\r
- UVFR8OvXHwEfBiAxMREqlUpEnK+//lpEJ7VajaSkJMz/ZD4G9B+AVatWCcEs5PTpAvR+prf9kYcf2UXb\r
- 8d9cPxqSefH6LLO5Hr4wmergC4OhBsycOXMxbux4KJUq0fiZM8UYP+41zJo5i9433bAW8ES9PkTztc9C\r
- luKlES8hOztH1KNWV2Hs2HENJOL7GwR89LM+y2isowfroNbVQqGtcaMxQ0WlmkZFrTNDrTWjikptdQ10\r
- AjOqqdTra6g0Y+WKbzBo0AvUu2rRaHh4uHCTtLQ0n4tYR2vMkSNHkJCQgBHDR4hRqq7WC1ccOGCg/YH7\r
- H1jWVoRkbmx1FhvCbCP//jylDEuJz5LLEJx0AcHJF7DkUCmW0OdPqVx86AKCDpZiEbHwQCkCiSnr4/G7\r
- x5/A+XPnhfHr1q2HP0WS+vr62zbeYrHgiSeeQGlpqQjtn1LUWrp0qaiXJ3iPR3vYyZVGeERI5v6kO6yl\r
- 3vWFRmOCL14cNgJRUd+JRjhsDnp+EAUFy20bz6MREBCAwMDA1nd5joweNRqpqWmi/pidMXi4y8PnSUQn\r
- FiGZs093WK1mP/OOSmUk1+iY6O9iyOAXaA4YRQQZNnQY8vLy7sj42NhY9O/fXyxibV3r4sWLwh0VCqUQ\r
- QZHLSgLeFQICftAeVlKEYWRnNEg6VYVk5nQVUgsILok0+pxOZBDSwipkFmqQWaTBsBGjsWf3HlFxMC1G\r
- Kyl03ix34vtOpwd3IieXy9GrVy8UFRWJe9fXsWPHDsx4f4ZoJzY2Dt26disSAj78XnNELjdSBUbspTi/\r
- RVaJzbIKbCIiiI2ZFQiXXkRYRjnCqFyfXo7QtHKsTS3Hv2Lz0KVLVzHBuHe4l3jIfWeeLnrGiaZLTvJx\r
- Ll2UJ7ndZEP4xpZrdJ2euV7Iy6NfRn7+KTHSDz34UCONQk/JB3s0Ry5SDPdFebkeHbF69Ua89eYk0Svb\r
- tm3HV19+5dV4NoaNYqMvkdGNtJFvaCAcLiz/1wqMH/+6+MzX+B4/wyKdbYRERkZixYoVor23J73d0LlT\r
- 5zmS2bs0v5SVGeCLCxf06Ig5AQsofK4UFU6bOs2r77caT+c/wnAy1G5zwmZxIkuWTVHn96is0MJa777G\r
- 9/gZIYTeYeE8qlqtFjwK3N7ataHo+kjXbZJZMZpfSksNFKIM+OGoEttlcuyQKbAzy02MQI5dVO6mUnBY\r
- jj3EqL9NxE6KClzh8BeHdxg2Pca7XcVtuJWMLDmvwI7teymdeBY/x6agxuRCrdmFuloXLPUuIcRhJ8H0\r
- DovwuFN/v/6iPZ53PXv0lEpm7tQcPXdOD+bHI0r8J5MEENuJbVI5ojPk+C69kpBja1olIoktqRXYQuWz\r
- A4aKjJIrpEWmQ/cRbsM932K8hXq5WmfDM0/3xqwZs/GP197CsV/O4vTJSpSc1UEpp1Xf0IR6EsIjwoL5\r
- XY8Azp24Pak0kzPcEsmMHVVHi4v18MWZM3pKC25k8ODhrQIoX0FISIjIcTyTWPQ++zy5AvcmG1RX40JB\r
- fjlG/WW0iDh+/QYiInw31nwTheX/DMMXS1ciaOEXFO9j3SLESNC5ES1iXD/nSpwnZWRIeVE7L5mxXXOs\r
- qMhAlXmnsFAPpqCgug16vDZ+EnbF7BI9MmTwELHrahuBeAJy77M/26xO1Ne5YKbfG/QaJ+bPC4Zf34GI\r
- 2Z6M8nNOQUWpE8oK8nWlCwatEzX0rIXesdO7TU3u0Opxod27dqMHu9D70Zpjp08bKOsz4D/pKmxJkiMy\r
- WYGodpAb0ffoZHKrFAW2p7p53X8evv12tRAw4Y0JYvlv1/tCAPe+2x3Yx43VTuhULigvuoTRJYUunD1J\r
- 5NPxYoETF887oWIRaidMeveI8SjwaPLqzh3F7a1ZsxaU3G2TTP9Oeyw/30Dx1YCYNMrpk5SIJLYwhyjf\r
- P6hAxAE5ocDGRDk2EOGJlYQc7y5ahzcmvCUq5Nw9LCysQwF2ch9LHfUoTVQ99WyVwoVK6m02uDDXhbwj\r
- Tpz8xYkzeeQqZ2hRK3NBw6Ogc4vmCc0dExcXJ3Ijbm/SpLcdtA58IHlvq/Z4Xp6RQqB3TpwwgMnNbU96\r
- ehn1QleR7p49ew5jXh7TsQCaiK0CyH2q5C5UlLh7/3S2C9lSJ3JlbjGlhSTggrOdgAaHW8BU2ppy0ODN\r
- zoMPPMgLWQ/Ju5Ha4zk5RvgiO9tAuXnHDH9xjEiwuFfenPim2LB4UgV3BHJPYI4+3Jvs29y78jKn6G12\r
- nwISUZBDbnTKhbKzTijKXcLN2N34Pa4vOzsbI/8yUrTD++hu3boXilRi2hZd9vHjJjBrYpVYG6tCKJXr\r
- 4mhbSaz/maAyLI62lfQ5PF6FDS1EUBnwWTT6USThZI4jBe+8eMHhRt0rr3vhYjdgf2a/1pF/qytpFMiN\r
- yordrlRCPc/Gc+/zCFVXkWByOfZ9Tss5TeE0ggX49fOztSZz0zZXZx89aqZTADMiE6oQuV+DzVRuiid+\r
- dpcbqQyPVSOshfVUrv9JjdCfSCyVffxeRETEptbeGT9ufMsouFOHa2sALVZklJF8myepmgxV0GTm0WB4\r
- YvP8YIFGEtpIEUyk2LQV9dQfHb3tapeHulxLp6dG6HMOHzbDTU2HZGWZ4YuoKBkef6yX2EJyD334QQBC\r
- Q0NF710/ChwWeTKze1TTfNCpKeKQu7DLsOEcYuvI1Xjk2HhOsSdOmCjq5Q0TLV7tNzRTNhpyZLJa+CIz\r
- swa+kErNCApaR0M7QGSlvK2cTEcqDGeOIoHjHIjCKbsSpwrsThznTfQ7sonEsGvxd54vbDi7TeCCQIz9\r
- +1jK08pFnXRYYL/vvvuD220p/cONOVJpHS3N7cnIqKPVzk16eq1P0tJqae9bC3//QIpEr1JqrhA9tnfv\r
- D2Ll5MXOSQsRC2mbD/EEFSutjefJtXyHTyjY5z1uw4cEY8a84qCd2A3npJLJYabctLR6MsA7qan1tKXz\r
- TkpKHZikpBpM8Q/C00/3oaiWK0RUVsoxc8ZMcRa0Z8+e1tMJdi+ZTNYadmtra4W7vPP2O3jjH2+IsMzv\r
- 5+WdxFNPPmUn46No4na+4VRi8vqa3JQUKxngneRkCx1KeScpqZ6Mt7Ty+ecxlCk+jmXL/tl6SnHs2HH6\r
- vkycNLxApxejRo5C32f7ivSY99BD6VgxJDhEJGmeo5Tly/+Nrt0edd7zm3tmeDudk0z9wbpsXrwt8eN4\r
- 2wHi4CdMgu0QMz/BlsQsSLAlB+63pbSQunC/LXVhoi2NyvRFTKItPchNxuJEm3TxAZv0/Y0nsvsMHWvq\r
- 0fPx5pUrv7laXHxWGOZBoVCIw6+Kisp218/RRF397Rr87rFeV/487O9107+MmOnzaPFmP6L92vs07ANp\r
- 47GPVk4LZazWBQsCmzmP4cXv4MFDYn7w98DAhc19+vzZQuc+Vno+lt4bdCtt/6r/KXIrDXie4WMQYght\r
- A0Mojm+lcJhC5NNpdCp9j6Lrn9H9YZ7jklut+7/JKVwBwotNkwAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="Red">\r
- <value>Red</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA\r
- CxMBAJqcGAAAD0tJREFUaEPFmQlUVFeaxx/IUguKRo12MkmnuxM98cwkJmPapMdsRpOMY5bOMn1cMsak\r
- R4OmoygtoJSC7IqyFzsoigIqKEsha0GxF1XUvldRFEUJKGuxC9Q330NRcAFcMqlz/tz77rvvvf/vu+t7\r
- WBG/wu8/N26k4m3fHhgYeHkQ/3R3d6vUSqUSywZQll/hkU/vlv9w3kdlHPVezoxP2Oty0DN0j6v3cXdv\r
- 5h6v46f/6h92/hM3r7B1+9x93nFjeP7p6T31Kd1pv5u7raev3wpmXPwhoVLVfIlVdvNMZhWcyuRbQhIK\r
- bgZEZpo9/KKvM3xOcv1PhHh5+vrORVk/pcc/+W0Q4K3UjMwglaHJ1Dk4NNLc2WPJ4aggIEkKgam9lqPx\r
- 6rGUXPEoX6kfUjUZFYHBwQzUs0/+5KdwBzcG44M8NjsSjWk6BgZHe8csYB4dA1VzJ5wv0MAvx4VwmqWB\r
- InUraMwD0D4wOCDV6eSJKSm/eAcG/uEpWHi8W7gxjtA9vLw/YBWXxqsajbqO/qGx3lGACXUOjoBY3wGJ\r
- uUpIl5sg63oPcPuH4drwKHQMDI/WiiRV6Veydx4+6vv7x3Pw+FdZMY74zA9jxr2fkp55Xtfc1tbZP2Ix\r
- DwNMVjcetwyOgbjvJpxp74OEG2bI6OwHXu8wtA9ZoLVnYLSaLy48nZK+3fXgkUWPb+cRrlyyZCmx5bvt\r
- 9n6BJ9cnp1zMacUwd/VboHsApqgLj1uwvBYpIlt7IPl6H5y+3gtxbWZIwbzSPAo38Hzzjd6RGr6s2NM7\r
- 4Nt9LgdtUFaPYOfRqyKAfcDx0E2sgnKWsaXX3NFjsXSaATp7p8rYMwbF7UOQ1NoLZ1Hx18zjSmwxw6lW\r
- TFHKrhFo6x61NDZ3d1VzZUVo/hOU46O7msUVb7+9Zg7KISw88Uc2R8DSNnS0t3cBdJDqvqsbeKzvGANW\r
- 6wCcudYLSaZeSEDFN99OTWaIQ53Gc+ev9YGo/Sa03BgZ0zV23Shm87Ijmac+ddrl/MwsLM2+yrp1G2wP\r
- HvR9MSrq7LaiYj5bo+3sutEOcK9a2i2guj4KLNMgJDaZIRaVaETz9yjBaIYkLIvB85dN/SBqG4GWtpEx\r
- taa972p+bWJsXOrH27btfHot8e033z3j7x/x+eXMUpFe3zfQ1gZA6vokmdosIGtB88ZBCNX3QGIj9ncU\r
- sxG7jAEHcBMaNmArYD4JFYnlZ5v6IBrTi8Z+ULWOjt9PIr7WyWJVM48FRq/55uutFNTsI/2wmruc/rk8\r
- MiKFIRG3DRubRiwt13CAolonSdI8Chca+8FP1wXp+j4Ib+iB6AbsKo1oVo/9H9NkVKweobA8HeuebOiG\r
- U3icSJ5HTdxPwG++fjmDE4PmX0HNfrX+5BNiqZMT8QGDQfzv8ePEfiaT8E5KIiLOnLG9dO7cH4QX0reP\r
- iOqlFkPDMJiMANdui9c4Aucb+oGpw2jr+iBI0wNxWow4HkfoeiAey2IbeiFKh90JlYD5EG03JDcgHNaJ\r
- QqVgPhHPKZrGoKnh5oiAZ9KmnStkbvvO6aVPP/7Cbtpm2LaNsEGtuHKF8CgvJ7K5XIJbV0eIeDxCzecT\r
- xvp6op3Pt+2rrfndWGnJARDV88GgG4UGvQXKdMNwVtsHcRo0qDFDuNoM0epeiMSUicfRWM5ERWM+BtNx\r
- IVw8ppHj52+JzCdq+uCKbhBE+lHQqQaH6qqNmqT4bD9fb+aK/3hn7cMhXFwIKmpzZSVRo9MRoyYTAQ9T\r
- Tc3LUMnxBBFPChLNKISpelAYRRUCKDGyyh6IwTRCiQBYHo3lEXhM5mPIOigyH4dpONaNwjx5HIb141UY\r
- CBRLMwRi7RjoFMPDZUXqhuTEq64+R5ivvvynV+c8sCUCAwkHlLtIRCinMz9xrqryVSgp8IIqQTN4yzsh\r
- TtEHEYpeCJbj7IL5QFk3xOBxFCpUgbMRppGYhiMIWRaNOibvHq8bosAA4LlEzAfgdXFyHOSKfriqHAaD\r
- CsaVny2WJ0RlO//ixHj+gQBBQYQDioEA6tkANDVZQ13tCsi8cBSUkiE4I+uHBBlGD+WLJpKlfXBSisZk\r
- GGk0dFLWAxEy7Dp4PhzTECkObrzGH+vGShEKy/wwf07aD0EkPB4Xy4dBL8c1BaWTjY3lZYqE/l4x+xHg\r
- /lYICCDoKFcEUMwGgKyj01GBx30NcjPDoKLWCGniAQgXo2FJHxwX90Ak5iMkZghFg0wsC8d8CIpMmeLe\r
- 8ToxYoS7XR4jQQhxNyRg3WLJTRALb4KophtKcmWQlV4yFnwsUPb37WujN2yw+2bVKhs6gtzdcnh5EXTU\r
- XgSQzhaguRkhtFSoKFsFZQVxkF+hg1TBAIQK0bQAzQp6IITMC7EbiTDqIiybEFle3wP+FQbwKhTD0bwa\r
- 8L9aDgFXi+BsfiHk518FTkEWcApToTSfOZqdccCYmrKxICT495G7d1NdNm+2nzsF4MABgobaIRQSotkC\r
- kPVIiIYGKygrXg+c/NNQWN4Msbw+YPIxwrUdEFBhggC2DnzZcvAvlUBQqRCOlfLgWFkNRJVWgm/BZQjK\r
- TYbg7CgIzwmGizlBcDXXD4pyD0Nx3gFLWeHu4drKLSZuzepCheLF2MrKBf5eXnRnFNkCd3+7dhFU1FYE\r
- 4M8WwGgkoLGRBCBALLaFwrz/grxL53GGaoPAKgOcLFGAT1YpuKWmgVdKPHifDwOf1AA4lnYYQtP/CSGZ\r
- P8MFzl7IER8AjuoQSJWHQa88Mq4GBQOUov0j/JqtbTVV/5qj1T4XYTItOlZRseCoiwvtRxT54eDub+tW\r
- goL6CgFqZwPQ1ESATEZAaSkBOTkEZGVZQ1rqXEiKXwlxkT/B6WQGxFx2hXNl7sASMiBX4gEsySHIxzRP\r
- ehBYUjcolbpDjtwVKuUHQSY/DDo5Gr8tuWAv1Fb+tZNd8kqVXr80tLl58XESoLx8AeOHHyj/jaJMAfjs\r
- M8Ie9TEuWJVkt5gMoVAQUFNjBWy2NWrOuEpLbaCqyhYEAjsEsUdRQCKhAp+3CMpLXwdO8fdQXrUP2EI3\r
- KJS7Q7HiIJSgilAT+XyFO1TLMfIyBmhkR3CmuSUpfzeI69fjvV5pq65aVGA0LgoizZPicBa44iD+FGU/\r
- BWDNGsIW9RauwCV6/VQALtdq3DCXa39HdXUU7DZU7D40hL0rY5MDaLWLQCxYDZL67cAXu0IFmiRNTxYb\r
- o16F5TLZYdBI0ThKI0YY3i40vxaU8pdALndsraubdwdAq10YlJ8/3/nNN23eQNlOAVi2jJiDegm3Ebkq\r
- FWGZ3ALl5dZQWWk3xehk0/fmjUY6qFXPgETwHpr5O9RjVylTkBDuwEaQUhQZeTWa194x7w6y+p0gqPsQ\r
- lIrnwGCYi4Gg3+Dx5rGxBU6Q0edynzmZmjpv1+LFVktQ923wyDnVsaCAuCAWEyNTAeZgd7GfNcAEkFKx\r
- GFvhfYTYDQKZB3ButwJX7nEn6mTktTgupPwdUM99FzRqRyADQN4DAToQoGICgMWaHxQc7LBtyvR5z7Js\r
- k5VFJOEmrn8qANnfKY8MYDQ6gAqjKeS9B1LBfuDJDoEE+7v6dtRJ86RE3O9BxP8zGl6I0/It87cBuuvr\r
- 53InALKzHX18fenfTLcrtbp0iYiqqSG6JuZ4jYYYH6w83qMDkCYMhnkI8SJG9yOQCJ1BLWGMm74VeQYI\r
- a7eAVPjvoNU8eyfykwDMCCAwGheOd6HLlx0PubnRNky7rU5LI4Krq4m2CYDaWgLN24JKRX3kFpgwYmic\r
- B3LpC7h73QhK4R40fhjUOPeLeVtxsK9E84vR/NTJ4HYL9AsEDjIEOEkCXLzouH/nTsr70wKkpBABVVWE\r
- kQQgFyocEyAS2WHT3v+A6Qby/QPbAUTCF0HC/xLk9U4grd8C9bwVoNfPf+i9dTraoFDooCYBmpsXHcMB\r
- 7PTFF3arpgVITiY88Z1ANwGQn2+NAI8+gB8GJxL8EaorXkPzy2YMCgLcRAA9CaDXLzyekjJv2+uv2yyb\r
- FiAxkXBHgPEdKdkCTxuAHBONGHWDwXHGLolrzKhE4mBC82FFRfNDExLmfrZ0qTW5iXv4LyaGcMa1YHxD\r
- dwvABlvg8Qbwo3SxB9VtbKRZlEr6Dbl8QWxa2rwT4eEOax/4LjAZJzyccOJwiDoSwGAgoLDQFlfc3waA\r
- HNg6Hb2Lz5+fgtH3DQx0eGfa6JMnT5wgfigrIyrJzRquyMDh2OGS/vgz0JO2gsFA76mtdcxkMh08PDzo\r
- b8wI4OdHbMEdJlurvbXTlErtccv8ZDPQk0AggBkBWCEhdOeff6aumBEAvwd9zWYT+WT08/KsQKOhzDhb\r
- PInBma5FgF4ud16Rvz9t51df2f9xRoD9+4mNJSVEllJpBbm51uPvvTM95Nc8j63fX1bmUOHjQ/129Wqb\r
- JTMC7NhBrCsqIi6qVCSAzW8OgGvBQGYmrS4wkLL2hResaTMC/O1vxJrCQuIcCcBi2f5WAGPYqjdRQ2o1\r
- rTMujlIdFUWZeQCTdOvWEatw+5B0C8DutwDAdxG6GdVsMjnI1GoHTlQUNSksjLp8xuiTFVauJJZlZBDh\r
- PJ41VFRQcK/yq8xAGF16D8qEJlUGg0O9WOxQVVhIL7l0iZ6Zmko/lZxMD4uLo/kGB9Ncdu+2/+qnn+xn\r
- 9/+zpUuJJfHxhH9hofWYUkl94C5xFoMWo0h2AXoP7u/b9Hq6QSSiaaqqaGIOh1bJZtPyioroqVev0mNz\r
- cuhBGRl0j3Pn6D/FxNC/PnGCvu7oUfq7rq60Pzs5Ud/YtIny6kcf2T734Ye203+dntQ8DiEhVocyMuaQ\r
- fXC6GWi8n6LBPtyzdMvltHaJhGYSi2laNCsWCulV9fX0vLo6emp5OT36yhWaX2IizQUj+qOnJ+1bZ2fa\r
- BvyysPbLL+3e+ctfbF5bvnzOv6CHqS/qs+oz91eyCQ21dk5Pt+lDgxbcRo8aDLQR7EpDqAGUGdWFplsa\r
- Guga7KO8mhp68eXL1EunTlFjw8OpPp6e1J9x0dmyeTPli/Xr7T7CHeTKBQusFqIe/GX5MY0+9LKwMJt/\r
- pKbadWMXGNJo6NcrKmgNWVlUQVoapeDUKUpyWBgFv45R9u7ZY/8/339v9/mmTbZvenjY/y4+nuqIAHMR\r
- gIYAVASgIIAdAtiieWvU07b64Pvt22fzHoNh63v6NNUjIYGy48wZyufnz1PeTU6mvMVkUv7N25vy8q5d\r
- 9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD31JREFUaEPVmQdY\r
- VHe6xvFe9+59dJPsJttMTNas2WQfs4nuborGGzVmLdHYwIKiG0VAI6BIH5A6dJDelCkgRXrvvXcQaYJU\r
- UXoRLAgMzHu/cxRkaJZr7j7L87xMOTPnvL//+/2/859zFgGQ+rf+YwD+nfWTm9/p2fTWWk7c5x+f4v+w\r
- +ke+7V9VfGLWnA8t/VQrtv5TrbiWT7TiOz7WiO1b/flXx15mIF8KQFDQ958eOb3L9P2KvlKyDVdQtA11\r
- UrwYmXDaJaVcyS2jTskts1nBNevOSdesHiWX1AHNS6n3nMKLxyILGlB9ewiDw+MQizGlkZFRrF+/Xuf/\r
- DNBzX/Tft++OrsipaNzkF5PxozA81Z0fkZFyJb7omjC+pJYXV9J0Obb0tkdUcbdbWE6fV2TOvcjMClFx\r
- zS103h3GqEgsYWzS5NiYCM3NLUhLS4e3tw94PP6UzM0t2O9s3LjR5KUACgoKLlbV3Gi6VlnbVlRe1ZWe\r
- W9SbllM4VFJRI2pu68TDR2OYmJjb2KRBZntHRyfy8vLh7x8APl/AijHq5cWHUOiD1NR0FkIkkhx9Hk/A\r
- Amzbts3ypQDS09O9Ozq7MD6BBdXXfxclpeUICQkDjzHHGnxsVCAQIi4uAbW1NzA8/GjOFKaXzPTnzPeJ\r
- H7t377Z7KYDExESlkrKKMRpoVNc2ICIqjsx5w4svpEcSTwg+GQwLi0B5eQUGB4deyOB8xiffZwZiRATI\r
- 7D/o8lIA1dXVq5NS0gfvjQBGxlx0dnW/UoPPArjsJQBz7O+OHLvxmzV/k6Nz0pIXAZFqbGxcmpSS1tP/\r
- EHD14OERjQYzIqPjwBhJ9KS0mJifZeZltntRGTLHPukpEKs0d4p3efBavlbXjl2143vz1377u0+eBcO2\r
- 0dj4xDud9wB7Vx6GHoEdkfukB6PAQ9IwlRejnwLOi0q0i4592kMg5g5DbENTyInkPjwu1s/Mvy9rZlm6\r
- 5aSS4MPPPj9O6bw2E4gFCA4Nb2i7C9g689D7AKz6aFSYkRkYBqhDYpDA5oNj5g+bGolJ7UWS8/bxQ3Pv\r
- GFQJwJ6Mu5F4IxD7koJHIY4iJY5BHN3dLzb09m2T5+jH/2PvPsvfv7P8M3YZxPzzueJX1dQH2Ln5oJV2\r
- 1j4EdJCYVJjR6b4P9JBYMBILRmLAXhSOuijb7SZITMkFh4SjomUQ590F4ktk2pt0lUyHk+LIeCopRwRx\r
- CamSOnCdaEJsLfAZfvvbPb3/9dcNoSyAg5NzakXrfVyJyEBmWRNa+oHWAeAWiUnmNunOINDOaCG450iN\r
- LctpJRkVm4jsqg6cd/SEP5kOJcWQksl4FqmQjF8jCVLSRWsOnej6hZx6h5RDygOpbDGkpJUDWABTrplN\r
- bNZ1JBa3QBiahvoe4GbvYzVQMo2kJoJqJrUQFAtHUCwcQbFwc4CxyT2jJBNSsxFf2IRT5/RH9x0+cWeX\r
- vFIPr7xyPI9Mh1bfEK//56neX8qe7ZAyCRqUyhiDVA4ZnpS0ylUWwMjIaO8l34jholYRuI4+qOwEqkjV\r
- XUANqbYbuEGqI7BJuAaCY8FIDNiLwk2WZEp2KYJTq2Bq40UnwiHk5DSAo2fTu2H73p5FWp79Ukn3JU1P\r
- B5BRDWQBeDzeO9aOngOFtwADWz5KbwNld4By0rV2oIJ0vQOoJLFgLwg3V0lOJpdZXAthdBGMbXgswKTO\r
- apr1SIw2Y5zK5meuWfilggmkMkSQ2n82iAVwdnZexLWy785pBjhWfOS3AgUkBqiIURtQTCohsOeBY1Mj\r
- sak9I7ncila4BWXCcAGA/whsxFu6Xlil54UDYfVYa34VUqmPGIDgqeW0nqHZrfRGQMuSjwx6zGwCskjZ\r
- BMWA5bYAeaSZcCwYaRKMTY4SY5OjxNjkFijJfKpPa3489KzmTuC36i7Y4p4KxZIJHM8ahEzAtacAB849\r
- BVDT1K1PqgfULQRgHpNvAimk1AYgjcTAzQRj4QiKhaPEWDhKjE3uOVJj4Aob78PIJRS6NHBzldAHF4Q4\r
- FHETGwx42GTsjb/p8/A7NSdIZU1A6oBayFQCCqeVy6KqxqBh44eI66OIrQXibgDxpIQ6IJERgT0v3Fyp\r
- zQVXfGsCWja+0LKYAaDBZefASiqbb1wS8D7nMpaahUAq5eHTSX1Q7fF5gNEB2aMhvKRGmPlkwy22AWFV\r
- QDgpohqIJEXVANGkGAKbC44FI7GpPSO5mXDqlj7QsPBGTc3g00n8BODnNnFYFH5n7k508HzYFMD273Zo\r
- GLpFit2TboPjmYKr14DACiCIFHwdCCGFVgJhJBaMxIK9BBxTkil1IriFFEDTSggDzyRo2wWirKxzFsCs\r
- TkSpLAppfdyFDqmHPwXYvn2dgob5/SulE1A09oFPKXCF5FsG+JH8y4EAEgM2C46gWLgFUoupnoBTWDnO\r
- 0Ugrc4VQNveFXXgdu19GGrYhyM9vmQJQfZLAFED8XbxuFICVVEqrFAwhFdnJAERMAUhLSy/d/88z/cIS\r
- 4LiBEF5FAI9RMcAnCeh9Zps3QbFwBMXCPTFAzWEWmH1ELc6YXcEpEyGUTHxgGlABQbGY3Q+/aAKGgnyo\r
- Gl2GtoknHFyuSpTQJMDP3fOwXOcS1loEQT73AZTomN/SnGABZDWfAjDzYIe0XOelQuAYzXzXPMAtH3An\r
- eRQAniRm22XSJBwLRmLBSLZRzVDi+kPeQIATNAgcfiE888bZ7zCyiW2Hipk/1IwuwcDsMqKjiyU6z/Qu\r
- pKph2suM/grywpjeH1zFdqKdHin4VO0i/Qbog9ThGQCbtu1pYYwf4Qhhnw04kBxpJ04k51zAhcSCkRgw\r
- y+h2KJgG4Zi+AMf0BFBzzYRT5ii7nZEzrcY0XNNwxuAytIw94e4ZTj9Lu+Y1PR/AkdhWbKCy/ojK51cc\r
- PhaFtT2e1Ee0oiSuC32xfnMNY/qQjhBW6YB1Bo0ayTbzsUxj+nDCLByyOgLI6gpwyi4JVkkPWNBJ6QU2\r
- YI+KGz7ba4Jz2jZITq58LsPTzTPPVdUfJ/CWih1+T2fhxbzS2Z3oiLYkwKrVn2ebRPXh8IWrMIgfgX7U\r
- EI6ZxUJaS4D92gL8YB4Nk5i7sCGYSZknDUPOOHx4vazF+AdbbPHG5gy8tncUr22rh7IyR5yUVCGeae55\r
- Xk8CzNWFpt47oh0tkcCKlX/2ULRLwVl+DXaqukHWMBSc0G6Yp0FCZ/lVY9sUrdp2HdMe+Pjrkw+XSbdj\r
- udyEpPbWIDGxgq4LRcLIyAFcrut4UdHt507juQDkdGIkAN588025bQoWY0bJgPE06UYM4aCe39j3ikYj\r
- MkoaY2ZuHhMZdXVw9vKH3Gl78SrFcczUhwcr6EpczZThkpJ22NsLoa9vI3Zx8RdVVfUvCKNy3rRvwdFn\r
- 5oCMSpIEwOuvv/7Hv2yQGeLEi3HCsXBit+rFcWVzD1gLA2id04qawUEJCcNioMflY91Z0SytOVIk3rJz\r
- d5uRseNAVdWAhFkGzNzcDZqapqLg4MzxuUpqXgD/OqzYp9j3P1v39Ur9+p2tEgDL3n33vZWfrh06Z+GM\r
- 0Ny8WYZnAvhEx8HK3hfbdMZmadOpYmTdvAknX9/732zbkX327IXy1NQq0UyzQUEZTCrQ0bEYSU+vm5ov\r
- yudNniaQOY5fnLa4t+nQqQ6uhcdARUUPXRGMekBXKVZMAXy2fv1WjpVVw0yT872uHBhAbPk1uhjmCBmD\r
- IRwwGZXQTpU8pNfXg/1cSen49n37rnz44SdHDx9WCLe39+6cWUKVlf3w8AjBuXOGYzRfHskraT+UulQ4\r
- /mdphW75M5wu6mZP4W+PSAKsWr16h1tg4N1nma/o70dJTw/yOzqQfecO0qisuBau2HkqGidtRiQkcz4L\r
- 0ZWV7OcKOjuR1dyMnQcOxDEnzCVLlizbuPE7a+pSxQkJ5aMzUymk9biCsh6+3ys3UF19d9ZcqWoephJ0\r
- 76cE3mUTkFNSKlnIPGO8uLsbOazpW0hsakJM/U1E3LgBF14IpOVtoO76SEJHtVPhX1KCGCoj5vPpt27B\r
- LzNzfM3atbKTK2AysOijj1btOXhQPsjGxquNKY3pMPLyZ9unvy4t7YCJiXODtPRRwYoVH6xnrwvR36/t\r
- +ILR+QDKenvZEWcMJDQ2IZK6T3B1NfwqKuBdVgbry/5QVLeHMX9YQif1E3ApNxf+FdcRQp+PqqtnQbbJ\r
- 7E+c63Ih+Xjr66+3mP74o25uTEzRI8b4JEBgYPo9JSWNtC+/3KBJn1s6/ftSixcv/ktAcop4LgDGfB6Z\r
- Z0olroF+I9TUsoYEpaW0PiqkJUYu9Fy8oGHoAvurDyV0xjgGF9PS4FlYCGFpGQKuX0d4bS2kj5+gXw0L\r
- 35d7//0/bdm//wffr77a3Lxnz2H+8uUrvpjvO0wCSzmW1qKZANepbAqpdjNutSG+sZE9OGOeT2XhSjcy\r
- LmZmwjwlFWdsHWFkdQn8yAcSOm8aDm5iIuyzsmjdlE+r2VL4XbuGb7/fS78gXt2NRXYOyMge6ynv6pJo\r
- m8zo57a3I6WlBdHUTYKqqtiS8SgoIFPZrHmDuHgouLmDY2SP4MQhhNA1nElpmwfDIDYOlqlpcMzOoZVs\r
- IdRt7PHl2k0vdR9g3gSYDevWfeOoY2hOl1KenqxKqdswkzaZukcU1X1gZRVbCu75BTT6WTBLToE+GTwX\r
- HEILLyO4C/ORlHMPkcmd0LW6gh/0LVlABpQBVrvoCMUzmv3Llr373itPgLmpICsrn2ls7ojI3Hw2iXKm\r
- /imB1JZWtpMwE9envJwdSWZErai+jalEODExOKFvin2yilA2dcRRrjXUQ8OgFxsLk0RaraakQIFjBDsH\r
- 7webN+/Qe5Xm2S40raUtoQkT4uDkPcF1cEVUYRGKqKwy29rY7sG0zKvU15kUPNkJnAOb9Aw2CQZENyIC\r
- F2jEDeMTWOPGlI6SuRVU9c1ga8vvXLt246lXbV4C4ElPXbR1624HX9+EQf+AZJhau8LUyR3BBBNPXSjy\r
- Rh07F67QGZhXXMLOB2dqlQ5UIkxZWSYlQcXBGWcucGFq5Y709Fpa73Br1qz54tufwvwsgMmDvP32u2t2\r
- 7TroyeFYVZMJscA7GlZ2l8G1caeO4wyOpQM0zW2hybWFDvci9Kn0jCxcYEcXhpOTr9O94Nh7Cgrn09at\r
- 26Qz112VVwkjsZibuWM6+OK//33diePHVYPV1AwzdXUtq8zM3O54e8cNM0YjIwvErq5XBy5csGvS0uKW\r
- qKhwEnfuPOD13nt/XP0qTS60rwUB5jlj/ozA3v/DH1Z+98Ybv/qSnv/m/8vsnH7+lQd/Fcf+X104LlAR\r
- 5z/iAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAChxJREFUWEfNmPl3\r
- lPUVxmvX32p/6p/gsdqqgCxCIlpwqxU3IgWDtaBAlYTsxEjAEFBCksmiEEDBgBANmx7coIh7gklm35dk\r
- 9n3L7DOJTZ4+b0LSOTXIkNPT05zznPedmTfJJ/fe5977zQ0AfvJ/+SWA/afmzll4+4svVB4sKqruKC6m\r
- tlR3bCmhSqs7SgSVUeXVHaWCKqo7yiqpquqO8q1X14MPP9w40++62ns/gBIeXLggf63FnIbXA/h8gD8A\r
- BIJAMAyEIkA4SsWB4SQQSQHRDBAbBeLfA4kxavyH2lxRO7Z02f3HcoW7Kph5MA2PC/+G82fBDRNwCi6R\r
- BTdydbiG/Wewq+3s94uX/nF3LnAzgi2Yn7/WbEzD7cR/Da626TSOXgLKtu9PL1qc//y14K4KNqRPw2UH\r
- 3I4sOC/TOhW5EFN7jcjFs9JaVHcKO44DnZ8B6za/Eps3f/6yH4ObEWz+nXmFJm0KLityh4ux5qbSmmbN\r
- XUlr/J+T9VZYcRIFTGLtUeDIhXE88XRR6Kabb77puop//ry8QqMmBacZcF4DLpAduRngYjSEALemrBs3\r
- M4ErdwE1nUDHxyN4YMUz7l/feONvZoKbOWICmCoFxyDgmIKzZaXVTbdOpVVw7BSc4NgpODo2eiVygmMr\r
- 6jvxl9JurC47iU21p1G15wyqXz2Ce5c9NJA72Ny8QoMiBbuJYDnATbSTH4GLMq0T7eRKWrPbyR5RS2/O\r
- YHfOWbJGJ03CZgB+KzdgpdqNzboAKg0h1BjCqDYGUWrwY73Rhwe0dtyvc+BBnR3PDvlQbg2h1h5GvSOM\r
- bfYgSmx+rDa78SeTfUIFFhc8349N97oGUcvl6wLTipOw6oDfKczYoglgpz6CRkMELcYIRINR7DEN42UC\r
- bjB48Te9B88ZPaixhLDXFkG7PYIDzihed0XQ4BpGlT2AjVYv/m7zotThh390fLoR721p/S5nsHmMmGYg\r
- CYsGaFVHcVAbxzFDEu9QXaYkTlDHTQm8bY6jfZCw5gjaqKP2BN5zJXHKncJZ6pSbr718zhNDhzuCDm8E\r
- b/miCIyMT6aV7aSxra0vd7A7lqxR9yVhVgF5SjueVHvxoiaIrbphbNOFUaMLoVwfxLN6H5ZrHLhbY8cy\r
- ar3Jj/KhEHZYwqizMpVMa7E5gKdMbtxncGC50Y7Hh9xwpsama66xtf36wFSXkxhSAu8rUzivGsHn2lF8\r
- rhM0gi/0GXxp4pU6P5TGec7VC5Y0vnaM4FvnKHpcGVx2p3HZw6tvFF9507joT+FiIIUvQmkEBcdema8E\r
- y92Vc29fslrRk8CgHJgns+BhpQvrlH4Uq4MoZ+TKtUFsZt2tUnsYURsWKC3IU1mxlvX2gokmGQyhajDI\r
- awAbhvxYYXAiX2tFnsaCh4wO2GJj08O/sfX16wOTf5OASQpskvtQIw+hURVFuzqGfaoY3tDE0K6L4lWm\r
- tlzjR5HOhzKdH3tpiPYh1qQ5hkOWGA5aaQAbn2Nqq5nSlyx+1NmC8MTGp6dEU+sb4pxrbO5tS1bLvkrA\r
- yG+ploWwW04nKqOEiuOgJoH9BNyvjaFZG8UObYh1F0SdPox2YxQdQ3G8SVMcpo5Y4uiw8jnLMF6xBFFP\r
- 1zbah+GKjE+uTRxhTa37JDmDzSGY9MsEDP0sfpkNTyo82KQIoko5jBpVGC+pQqig1tIUy2iOfJUN96kc\r
- WMeolbHXbTOFUUttM4VQxNQWGNw0iA33am0ooBGsobHJtYlToqllH/Pyw2V1xpE05w+LV4kvxaGnX84O\r
- pPGxOIML0lF8Jh+Z0CXVKC5qRvCJOo0PtEl8oEvhnJ7FbcrgkmAK8yi+NGfwjYWFb+V79gw+cdBEjiQ+\r
- d2fgyZqvzS0dspzB7vj94lUDF+PQsSffKbXiEbkbz8rZCuRhlCtCKFMGsZFmeIqRvFthxwKFFUsZuUIN\r
- 2wrTWsW0VhnYXhi9DWwpj+pcWKRm8VOPGVww+8amR1iz6DrB+i/Eoe0BqgZYGwOsMTGLWprAQUkch2QJ\r
- dMhiaFNEUa8MYwfTuksdxj7W3WF9nI04ManBBA6ZomgzRVDPtL7K9Lax3py+8cl1nZFrFh1QXFfE+s/H\r
- ofkGeF7sQ8VACHUEa5LG0CiJYq+UQLIItjOCRYzkJqUPxaoAdmjC2KPlJKBjRVQrR9geA0cXo/eiwYdS\r
- ox/b2EosboJx4RTgmppnA/Y1cJfYisclLH4JUyMdxkvUVmkYm2UBFMo8WCazI09uw3KFA39V8Zezz9Wy\r
- jWzXsvg5JV6gIQo0LtwtGERtx0qmdcg1NrE2CQedZtEhtvEci/+OW+8q6D8fg4Zgx3s4+3oz+KB3BB9d\r
- HsWHfWl81D+CczTFOUkGp6UpdMuTOM016WP1CD6lLtAYF7UZXOSEOG9g4ZvSeJ/z9dxgCv/ghHByXfdy\r
- p/MSrrn5EAffLMAWSGz4s8SN9eIASsVhlFGlYha1JIDVMi/yGbGFjNhSRmwNI1aiDqGS9VapYUth9Naz\r
- pazQuHEXI3YPI/ao1gWjbQweHnQEuOamN9WzAnutl2tML5tmbxKdvQkc4ww99l0CR/oTeKs/PmGKvRKa\r
- g3X3pjyBE5ytXYoE3lUn8S6bcaeGZqEpWnURvKHnM4YYLNZxuHnQEeBEzW9xh5lFxFb1e7BxIICqfrqv\r
- LzKh7f0RbOXrUjr2abEHq6QePCP1oljO+lJG8IpiGDtV3ETo1irO1w1qHwpUbqymNmp9MJjH4BJWdcKJ\r
- mg5rcwa7/dZFK/s+jU7U2HKxA0+JvdhMZ1b1sfivqJhQ6+jY+/n5vVIHHpG5sJFgNYTaTtVxSrzMVlKi\r
- pElUXjygdOAhpRNPc/DrB8fgtPAExoOOqPEw19EcI5YN1sniP9GTwkka4HRPBmd7RnCG15NUd28anZe5\r
- CDKt7/TTJBIaQkpjSDP4UJHBOUGqDE6pUzjBtHZpEzjDKWE2jsMxxBMY4USNb88OLF/iwAqm6jm2iy0D\r
- YVT0D6OkP4Tn+7n2MJJLxDYskthxj8yJQva0LRz6lexvldxIShjBDQo/HlO6sZgTQtBjTKfGMDZ50CEc\r
- wXiymEXEDnIv62Thd/WyLfSk0f1tGu99ywjw/hijeaAnjgOM2iHqeB+fYRs5Q52WcL2W8cp2cpzt5LAy\r
- MaEummJQNz5x0BHgRHs7cwe77ZaFT3z3SWSixnKVllNCGGHCfNXzeCFsJsLaZOJSM8gxPcTBI2zEZjYH\r
- C8tdOOgIcKKGTmPOEZsN2MQfcA24wRngRA1HGbccUzlrsFnAifYc45H6fwGWDccz9nRaudkLaTUxrcJZ\r
- YiqtBKMFcgS75aZ5jzbUHve1737fK6ht11lPtlrrz3im1LLzlHtKorqT7mnt5P3ObpeovtvVsovX3e+5\r
- WgS9JqjLKai1ocu56snn9DmD8Z/FN1C/ytIveZ+tX/D1lH7O+yn9jPfZ+ilfT0n4mRO61j/thM//BR1x\r
- NCLR9Yu7AAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABChJREFUaEPVmVuITVEYx5fLmXGdaTSa3Br3mDAeCIlxeRAiRBE6pWQy5dJMETURDZHL\r
- FHIrzYuEGCK5ZR4kxIMm5VqIcnkh0ZAs/2/sc2adddl77bP32efMqX9n5uy91/r/1rfWty67A+ectesP\r
- AbRntWvzrb0n7NZHd+wHzYaqoO3QPmgvVAuthqZDRWHVGwoADE2BDnZk7Dm+aVDZ6KEDOCoITCAAGIh3\r
- YuyRpWE3qGsUtXRA0gJAZTM7M0YtaNPSfu65gDLL/ID4BkAFu7yMTwTYKgidnqPz8z3QFmgFVG4HXWUL\r
- YQ0A0z3zGKNQa1t0MX4/D/2gvOChT7h+AprhDnPYBsIKAKZ75zP2WGc+DhNPLUyboJrw7CwzyGkvCE8A\r
- mI51YeyBbH4gKr0SwLgMdAxlYVzpotvgBuEJEGPsnGyeWuxziOYTMAgxH6GH2GGCcAWA8RrZ/MIMGBej\r
- 8d480OfpIIwAMD5SNl+RYfMJkFeop68aiRe+ANB1kFTa+mQB/n4dEQCBIN3pxkOtDKGNAIxPklv/ZITm\r
- E5GoViG+UzoXIbQAWNM0iABRdR05M9GcUqxCVLsCECH0VwRozELrJ2B2qgBPvACWi+aHZ9E8QXzUj4Ux\r
- CQilC8H8KRFgc5YBCGKOCrHBCID1zksR4HYOAOxXAc5oAWjZIGcfDPu2xVkRNlLxeDQqKUnWe1cFaDYB\r
- DBUBBsitX16O5yL6VFQkAb5o0qkJYIIIMC5HAGgcaBZ6ecqmHuanigDY6Kau7bMUAQJAbpdn5gIdQMoM\r
- jHDkDACW9DJAVx1AygJuSI4AfFPNt5jGQA85C/0RIWIxzktLo1F+fjL6tE+QfCVXpspEhnXQW/Hm+zkw\r
- DxxXARrdZuKzIkBdDgAsVQG2ugFUigDKQI4Y6Bfq66YCTHYD6C+PA5oJvY5KMnX9qGr+jed+AACXRYgl\r
- WQQoUwHqbADmy1G4mgUIHGvrtpWDPQFaJwjGmkQITBD8d4QQzagLGVEGOGK1J3YAcPKXWsDKiABo7qHk\r
- IdVP++E+1gAOxAEZgjbamRqwiXIX6LtOpWxeWUpob2DsngyBVy8ZgaAlw1y9eePxoufRIswPgz7IEHS8\r
- iK1baCB3UJYm41A3atI1rHEeMERhPArCviK1X2L7xncHhKDNykZ9q5N5OlQuDgzgjIexKOyZDEH/0zHg\r
- NggvyKwjAmd8HYQ9uC5V0m/XoUI381ZjICXnojVQKL0GMlXKR+PaGqgewo38FnQDwgKr9W0NZbJBLs87\r
- Zdd7GffVhZTU9f8V6lc3kDSvUYQX2Zr3HQEpGr1QGV5/sZ9pmhWj+A5l1PgxHigCEkh3VL4WwhGSr7eW\r
- Lbj/IrQsHeOhAUgwhTCEgzS2CcI+hF1ywG46Y+cQvtdD06COQYxnBCAMQ37L8JzI/BYY9f3/AJQMVypF\r
- n/EwAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="No">\r
- <value>No</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABMNJREFUaEPtmW1o\r
- U1cYx5+mSZPcvHax6GTIGBNfPlUp6FBERIeonTCoyHBWOuyLVKE207UYCY3isszg2iTFpJ2hXW1ybReb\r
- tkq0nQhN04rECSW0VavWFtlg3YeBjK3b2TkdnV1y09x7d+dtsIHny3055/87z8t9zkkGQgjS+kcA0tnS\r
- WvxM9KTz6i8CLATvvT4hhEutdNkyWLtzJxw4ehQ+PXsWvnS5oKWhAXouXYLwsWPgEMMjjB7AYlWFhVBh\r
- s4H74kUINDXBYHs7TEaj8MfEBKDJyUQbHIQXGzfCerYQeA5q1SrIy8+HT8rK4JTJBE4837f19dBfWQmj\r
- +L6CzViMABYLhJ49YxbKJH72WnU12GcnxQIyly6Fd7Ztg4JDh+B4VRXYrFb4xuGA3sZGiAUCMHXvHvMc\r
- fX0wrdfD27wA8MRZHR3wfD6hye4NDMBPdXVwDYfV3dZWmAyHYfrpU+4LMTwMaMMGeJ8vgD4Ugl/4AAj5\r
- zu7dUMQXQNrWBj8KKYbPWCTs5gKQyFi5Upa7ejUY/nWdiRIn7WM+kwrxDsmLQECCSktlvSYTVXf+vCbg\r
- dmvv+v26511d+t9WrMhamxIAl8X7QohJNsaDB4Bu3MhAPl8mNhk2OfL7KWxqdOuWHj15sgRXukRratI9\r
- xp7ISAngdkPffwUgVSwSAXTligQLlM6I9PmU2FQoGNSioSEDo0gm4bPXnE5tT3zEMJZRpxOusQWIxQB1\r
- dUlQa6sUWxY2BTYK0bQG9fdno/Fx5tWcT2iyexaL2s0KwG4HPxOAz0eEyrDJsSmxqdH16zo0MsJ9NfkA\r
- FBcrP2MFcO4ceOIB7twBdPu2nrPb+QhleufhQwPavFmezwrg9GmwxwP4/RJBw4ErWDCo+xknsJYVgNEI\r
- 5niAy5dloq0+gfV4tFGmks+YxMXFUJkIoBAVwGZTt7EG2LcPDicCUKICGI2qL1gDkA5ybjdKPjwdHVpR\r
- AfbulZewBli3Dt4j9X3WC93dEjQ8/GpKJVNyRyLZ0/EtxD9tOyMVwFukJ58FIB8prlVDyOe93sQWIhUA\r
- FQzC1EsAuagAtbXq3mStddJNfUsLjL8EUIoKYDarGjgDeL0wRADIHph0iUKGBNexiooU1ZwBPB6IEADS\r
- UZKmjOukQj0/OsrcQsybA+QmPjIJEQCazsReEK6j5Ap29SpzC5ES4MIFaCMAZMPBdVIhn3e5NPfn2xsn\r
- TWJ8BPI1AfD7xW0hampUIV4AZjN89TeASlQPlJUpfbwATp4Ey8gIoO5ucVqIsTEDunlT/+uuXcwtRMoc\r
- OHIETnR2ShDZSAgZ03PHItvNcDh7urlZN4FjfcBqVbdXVVG1hYXKE1u2ZH1IUfBmqrOhpDmwfz+U0rQw\r
- LUQ0+safNK2bcrs139vtmk6TSV1fUqI4tWOH7OOcHHgXb1QkqYRy/g5s3w4f0TT7FiIWM+DTBt0Lr1c7\r
- 5nBoe86cUTWWl1M1e/YoDq9ZI1uPRcr5iuSVA3l5sJWcLsx1+aNHM3H5e3Oz5gePRx21WlV+o1H5eUGB\r
- vDw3V7oVi9T8HyJ5ASxfDksqKuSjTqfqO7OZch08qDy+aZP8Aywy51WL5AWwkEQuAixkb7w+f/ItVC8s\r
- ekBsz6S9B/4C+eG8h3vJrfkAAAAASUVORK5CYII=\r
-</value>\r
- </data>\r
- <data name="Green">\r
- <value>Geen</value>\r
- </data>\r
- <data name="Define Colours >>">\r
- <value>Define Colours >></value>\r
- </data>\r
- <data name="Ignore">\r
- <value>Ignore</value>\r
- </data>\r
- <data name="Help">\r
- <value>Help</value>\r
- </data>\r
- <data name="Add Colours">\r
- <value>Add Colours</value>\r
- </data>\r
- <data name="Retry">\r
- <value>Retry</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABL5JREFUaEPVmX1olVUcx0+3ba6VDmP7w15w+TJ0rJc/EhuytuqP0Gz4UqhoDoLYcOAW\r
- TpQFW2KaKFZihbMg/CdCxTeU0VK2P0SdzD9CGlsrfGtg7Y81pFjiPH5/u7vee16fc577aHcXvmz3uec5\r
- 5/s5v3N+5zzneYRzzib0hwAmsia0+bHRE3XvYzg+DS2E6qAt0G5oF9QMfQC9Bk2Nqt1IAGCoHPqCsVgf\r
- /tKkctHFccDSdGDSAoCBasYe7XY0bINqo6iFAQkFgMbeYCyLetClp33KHEGdJT4g3gBo4NNg46/A9PtQ\r
- M7QL2gk1QWugF12A6lwhnAFgejJjORRqg4F3cP0w9M9YarDrT/z+DfS6DeYrFwgnAJguZGzSJb35apj4\r
- xcG0CaoT975pAvk+CCIQAKazGcvtUs0XodGTaRiXgVpRV5YO5IANwgEg+5Bqnnrsr0DzM2ZwvnEj5ytW\r
- BA2pxO+XUOccHcRWE4QVAMYbVfNLA43T+C8q4nx4GM2Of/budYX4wzTR39ZBGAFgfK5qvsLJPAHU1yfN\r
- 039DQ64AVO436Ck5Er96AmQfFgGmoMLfnQEWLxYBurt9AKhsm24oNcsQ2gjAeJna+986m0+k0G3bOB8Y\r
- 4Pz8ec5LsWEITq9ymQ0yxC1K56kQBoDYARHAfej4m7SB0ZpSIENssALEFyx2VwQ4FqL3wvS47p5PZICf\r
- gwBWi+aL/0fzBHRTNxdeSEAoQwjmvxMBNnsDlJVxXlGhV2FhmMgskiEaLAA5/SLAGS+Aqiox+8jfenvD\r
- AHwmA/ygBYhvG+TN2i0vgAULOB8dNUN0dIQBOCsDXDYBzBIBnvUyn8hAxcWcL1/O+eBgEqS1lfPKSs6z\r
- ssIADCrp1AQwXwR4ORRAAuTKlSRATU0Y46n3KBu9HIIQJjHMvyoClGcQwGQ5ClN0ANIKPD+DAHJlgMd0\r
- ANIGbmaGAAzL5kdMc+AJNQvdCQ0R3Ryg5wQhO97fmWoWstg1sfCFDADYLwMcs63EB0WA7RkAsFIG+MgG\r
- UCsChJ/I0Qyh/2A+TwbAchk/lNbthZ5R5wGthP55PBqAfbL5qw7PA+yECPGuM0BuLufTp8d140ZyIWtq\r
- il8rKPDtiBIZYLsLQJUahVNOEO3t9s0c7ZNoS+EW0d2yefqOs47kOw3bQ32nCDEXN98ObLinxw5Av65d\r
- 6wJwGW3FZICvU81r58D9yYFzPzUK7wUClJdz3tJiVgN28nl5QQC09lDyEHI/PQ9PcwYYo2PscxWCHrSD\r
- DKT7+xLd0KmVzVsjkBKJcypE3QOCoC3DWzrzxuNFh6NFNhsAAyoEHS/2RwjSgbqUjEMwnbqeN64D2jAx\r
- Ng8VDaoQ2WhgR5oQ9LDyoa7X6RodKiPxmt+kBkYgZSi9hMp6VQiaaHQM+DHU5wHThbLroRyT+R/RVr7N\r
- vNMcEHIuegOV0msgU6O4/jxUA+2BjkCnoXboIERvayiTPWe5f6zuPUHGvYaQkrrir1D/toOEen9GEV7m\r
- at47AlI0nkRjO6F/IwC5jjoafYynFQEJ5HE0vg464wkygvJHoVVhjEcGIMHkw9AiaBO0Hzo+DvbT+Nz5\r
- En/roUoolo7xBwIQhSHfOpzTqG/FD6v8PRJO78MpB02PAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACj1JREFUaEPtmQtQ\r
- E3cex9eKr7vO2evUu/Zs72F7147edTrezdmWdmyvnfM8q5718BwRX1WEU4vYIohKtYjhKSQ8E0ICojwl\r
- ikAtiqL4FpQozxACBAiEEBIgLIIC3/vvQtLwTBC8a2eOme8kM1l2P9/v7/vf3WymAKB+0H+MgR+yftDw\r
- bHu+z+lT1PZn58zZ/dbixd5bV22J4qz2yUz+RHjr1ofRd2pmHinY+D83QABnzJ69a76t7WGHVfahh+0O\r
- nT6xQnD96ieJUtmnkqJG+wvlHTultX1u1Rp4qrTgNGvANzTCt1KO6cIq36dugADaTJ/uPG/Roq/sVnwa\r
- dNDOMyVmZfiV3GUnCsv+kfZA9a9zZe1OBcpe18omfFHbAi91M47pmwikekwdliswPabaf8IGCOAzRC8v\r
- XHjwk6V/9/VY82VC1Cruxexlx+8WrUy9X2eXWdq69WZNj4usCS7VOrjXa+Gj0YBLII06pqnHgfzrcE2N\r
- h3uCEPvjwnFYenvQNubbM+89y6sZAwFWGSCAP58/f99fliw5usdul5i3OjA7c5k4X7oiSar89EyJbtO1\r
- qkc7itXYqdDBRanrH3WTBr4E1ChOUxM87t3DzrQUfC7mY19cJHziw8A9GYq4U+G4k58GvT4fNC1lFSvh\r
- Y883GYP2Yb6/PSVKYqAmaOASsP1Hr766992PPvLZZbeNH2h3NEtCFkrBigRp1SpJsXZ9rqJr+/1GOMt1\r
- cFbosVtJRq1qxqGG4XIrKoNTegYco/lwFYbDSxQKX3EIIk9wkXP5JBobr5kgjbCjvebeTIWzKHrE4+x4\r
- UEvWgPIYa+A9x3j+unw1HMtbsEXWiu1yPb6saYE7AR1Ju0tq8FlmDjZECeAUEQa3qBB8LQxGkDAQkkwh\r
- 5PLzVkNaMiFXXIRjkD++lDcOYtlaWM8YCGYN2O7LEDmUtsKlklTAgrbweIhLDkVh4Wm0thZMGuhYRphq\r
- fRHMgePNUhOfQ34DpglrQ/oNeGSI1txvg2Opfkw5RMejsCjriaGb2h/gVrMMSXW1ECsbIarRELUQtcGH\r
- 1NPSNIJiebA/ncsyrrmhxrToWp7JwMqCdmyQto6qtSeykH0lyeJBFPpiXGioRHytCnFKNWKVzRDX6Mlr\r
- O1LraORrOqFtp9HRMVhiYsSSAeZzSXY81vATsfKKBtMEdQMGSIWW3OiA3e32EbUy+RbiJNFjHuCwrA1x\r
- NQZ820CjQtcJwxDAocBPaoAxcfd+FhYHJDIGwkwT+OBKB5bnGYbpb6dl4AhCLKYjJvCWIMf63NoJGAz3\r
- cD4pGPZvvo2tz72kXUtR/2TXwDsXaHx8oWOQPjyrhosfxyI8k8rTNnDzjgQhCQI4bFoPLbl9yyNqIIqg\r
- qPOsgYVZD/FeZqdJtukG2B/0QXv7vadqwGCg0U4kqh6+BhSKHEQkRsErIR5H7skQ2Qa4+fmjj4D3EgmJ\r
- 3CgqlzWwIK0Lf0x9aNIyj0BoNDetgh/vBBhoFpws5rY2Gq1ERgPNzTcRlyaAd4IYB3KustDmCiSL3c1h\r
- HQ7MfQ3v/3n13V9T1M8oW/cM0WsJ3VhwvIvVBx4CVFRetBreWgMmaCN4Kw09kbbFAPfUb+B3Uoh9krPg\r
- abqGgYeoDPBKSwMvOQZXriVhoWs0poU1CPoXMTHwsqgb8/jd+JOnBNfvnB4X/FgGRoPW62nkXS9AQHwy\r
- 3E+mIUChGQYdru/FV+fOIzBJBElWDLlwfnev9OauGNiENkSbDMyJeIzfeN5CSmb8uOGHGjD22rwiTNIM\r
- tI4oIycP++NT8XVB2TBopi7eN+7CJzEW4pRIqFR5I/IscBbChtcYYzLwk2M9eH1b7BPBGw0M7XWrGXSL\r
- jkZLCwN/FQezh3ebU65iF2t4QgSKijMtcsx3JBMIaRSZDMw42ot5m57cgKja0L8gB3rNJK1joIm0BLxZ\r
- SyP928vwzLhoSp3p9b6kdPjFJsPjVLZFaPMr9etbRLA5phabDFAHgV+uOz6unZjvUFhlYOthDq0l0Ay4\r
- ppnGEcld7OSlQXA8FTxxMgLjUiBOTEdVjQ715OrNl1t3K2E85m83xMImUB03eQYUBjZpY9oMNKMmDQ11\r
- E41L8k48e6IPaSUPoWqkWeh6FY06otp6YqBifAZ+t9HcwN6z4olOILrSwAKbQzcS8EY1jQYCzEAfud2N\r
- 2Sf7kFvRyUIzUpIbvJpaGlHjNPD6RrHZBCbBgIAYUA+kzUITMdAqJmkiJuk6AvzXrMd4JbkXBZX94NVK\r
- mtSIRqTM+gkUSM/h+c2XzQ2kiyY6AX6FgYU2pm2CHqgImzSRVEHjxcRe2Gb0oIy8V1TTqCSKJN8Grbmd\r
- ZrZZvpsLag8m10AUMTC01wy0sSJs0gNpSx48xFtne+F67RFkZBIVxEiElQbSshIxa2vx5BuIlBmG9bra\r
- rCIKUhMm6coqGnIibkEX1l7uAb+wC+VyGuFllifQ0VGId7fyWPhJn0B4uYHttHmvGWi2IgPQTNIVJHEm\r
- 9dIKGr753eR50CNkFj9EeKllA4H8CDzjpH5KBkoNpooYe80kLWegiRhoJmlGZQS+VEa+XpbRCJN2Q3C/\r
- G0ElY38n1mpvY8EGvgl+yATOTHgRhxIDTEWGQsuGQDPgJeU0igl8fimNaGknOA86yFlIPeYidvEOALWr\r
- 8ykaKDGYkjamzSY9kPZdApxQRINX1I6IUi2EcjWSa5SoJA8BLJ19Ksmt/SvrEwfBT/oEuMUGUz0KScIM\r
- LJfAMotTUNEPK9eXWIQdycwaF29Qrr2WDdg4N2D5jqPk8d/1cR/IqbAdYeU6ckVVI0lZC5nuyWDNDVRX\r
- X0SEMAjPb7gwDH7QBN7b278G2NPT7h78fkMEzl1KHbcJS1UY7XPmydv1GynghAZjm9cxLHUJwx828vHC\r
- +kxQjg2D4Q/0YYZfV+cs/1bVFH77jv5no+YGBs6xL2y+hP1B3Ek3UVWVg/gUAb44GoQ1e0Px7vZI/Mr+\r
- OKZvkoJyefQd7F5gqvfjxzMDOnQzfVvKqED9Kep4zwHqDGypHMw0/1VpRAPMNKY6NWCpMwf19VfHbYRJ\r
- Ne9aKry5wfjMi4slLpGYv1GI59Zng3LSDE21b4bfQ3qWX2v9NF/tNSqCDqNSsJGAzrXm569RDbCVIovn\r
- DQcBzp5PHtUE8/gjhjyzcT3KxWq3cCzaHo256xIwdVMRqeTj4an6k1Q5LaUk1VSSqieVjncI7AxrYEfa\r
- hnp/hAoZL9fG159uzsNefy4u5aXiUAgPm73C8fHnAjC3tT+2vwjKuWV4qr4kVV993TSONo+kyiWpOhDQ\r
- Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J\r
- 9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l\r
- IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="Hue">\r
- <value>Hue</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABLtJREFUaEPtmWtoVEcUx+/efb9ujGAKtoKk1mekUgkV+1KkSH1QlYjUZ7C2FcUiVTAF\r
- BQWr9V0q0jaIQbSUBFrFKGpFUPCB+EA/aLW11EdbTW1Sq631k6fn3Oy4s3PP7p3s3phdMPBPZvfeu/P/\r
- zTkzZ2bjAwCjpH8IoJT1RMxjhEOdNUidAoCGN6HQs52e9Ku+ZADQ7LiUaTIua1pnQHgaATQcQf2UBaAN\r
- 3+/lNYTXAF9mMS8isbtoAdD4ZNX8K6/61TSi1x95CeFJBNBUd9SvMsCQl/xw92EZvDk6wEEM9QrCK4Dt\r
- 6ujvPxy3Ac7/kIREImMyE9CJogFAMzNV83VLw7Z5oS31US4Kn3oBUVAE0HhPVKsMMGx4e+qomjYzyEGM\r
- KRSiUIAmdfSPnEiwAL+1WtC70lQhfsbn44VA5A2AHX+gml++MsKaF9Fo2h3jotDwxAHQeB/UAxlgxKhA\r
- TvMCYuGiMAdRmy9EXhFA483q6J88x6cONx+qX3bUh/v4eZX5QHQYADtaqJpfs4FPnTv3LSCwU+cT0PbA\r
- ehwhmidMxd7X6QDYaZXa8Vtj+dRZvT4CZWXp9b9qsAm376YhVq6JcBBLOgrRoQig+UMyQCxm2IVKTZNN\r
- m1lzoK5QY8axVXpYRyC0AdB4nTr6n22JOsy3/mtBxTM+x+gGgwZcb0lHgKAvXk1Ct3LHvWc8B0Dj1ar5\r
- iTVBdtU5fobNb5hRy99f38BW6Y26EFoRQPPHZYDy7j64/IszdWhUv93jXOsty4Afr/P30zO174a4+fC2\r
- DoQrABpfoY7+V9ucqSPmwRdbnSNKE5ZbTsV7f9yz4IW+jip9A/std4PICYAf8LpqfuoMPhWEmeWfZE7g\r
- vv1M+POfzNznYHbtZav0zkIBzsoAzz7nc0xE1cz8DzPT4bvmmFaFps9ZXMdW6fdyQWSNABpfq47+9m/c\r
- zdRMSe86x47X217IgzDceYp7iD76ZYNgAfCB0ar52e+HtEbyjZHt24RwmK8RueYCXTt2ml3FvtcGwM79\r
- qEsyQOXzJrT87Z7HZKD/gPbJSOngZjbb9bUb2UK4lINwRAA736yOPm2Ddc3cvGPZ80Te++g+K983YRJ7\r
- AHpNhcgAQOMTVPPzFuilzo7GGNBB3jQN+wy8bEX+ESCQK9eS0KPCUaUvZAVA40nUNRlgUJWpNfKr1vF7\r
- n6s3sxcvnag07GSr9OcyxOMIoPGt6ujvOdD+zUIu0dygTZ36LFVr2k67Pe92fc5ctkrXCAgbAH/eUQ0s\r
- WqKXAr+3WfaKIz8fChlAKeVmTuf6X/9ZMHCQo0rfwv4qUt6NHviiRTYwtJr/ZiFbh427YkDr94tDTJg+\r
- K2gfYnTM6d7TfDDO7ZUaBcDX6ugfOuqeOrqde3Xfx8vYKj2P0scR/mTSABKtJkLxuAFClPNC0agBpEgk\r
- LUopIUonIToTCAUCBgj5/QaQaAUT8vkMEFI9Sq8fOQBy3MyFsevfS+VR1xtRMkF7IEsZwPaeAuiGxGUp\r
- WfhXiIqbUALbQnFsC8WwTYpKov/UCIWxLRTCtlAQ20IBbJNoHyZkYlvIh21bObcSboeHYrzueqQsRtPs\r
- VqLYjWqfB0oN5GkKdXXEnkagqyPwP76kA5sYKmTOAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD6JJREFUaEPVmXdU\r
- VNfaxo/GfBo1GuONuUmMJTHGllhCchV74VOxtxgrKkhVFCkWlEAAEQQB6SoggrRh6EMZemfoAlKkqiBg\r
- A0VABH3uew5CBtCgN/pHZq1nTTtzzvPbb9l7n+kHgPlHP1iAf7L+0ea57HnT0S8tLR1cWFi4Li8v74Iw\r
- WZRgGO5RrRXk0awf4HffIyg+OzQ03Cc4OPiAv7//mDc957s4rk+AysrKcQXFpS7qwX7PJnvK4XOfORgX\r
- NAUTQydhsnAyJgknYYJgGr7ykcTXHqsh6ayF85f5Oa6urmvehcG+zvFagKqqqsGFZcVWOwU27R86zsZI\r
- 388xIWQCZkXMwoKYBZCKk8KK+BVYHr8cS2KXYHbUbEwNn4rRwaPx0dWxGGu/E7oOVhm2trYz+jLxd75/\r
- JQCZH+eeGVU83GktGPdBGBU4ClPCpmB+zHysTVyL7anbIZsuC4UMBchnyEMmTQabkzdzUBKREhgnGIeB\r
- /IFgHMdhkdWhNjMzs23/i8mV50uGTTtwRWLinvN7f1RwsJhxwCVohrpvyiyNwOwZshZJr6wBMj/9ckxR\r
- Qz/b6WB4DD7x/wSTwiZhYcxCziRrWuuaFvSu6+F04WkYFBjgZN5JHMo+hN2i3ZBOkOYg2Ej04/UD4zIU\r
- X+nJw8DA4ORLiH52SbWjNGzD58qe9pBXNPGyUTIPDFGxjkhRsY3KVrGLLlSxj61QtourOWwf/cDQPemJ\r
- e0zBC9GNu7jb2Ib258CLF4CdnV1pLwAy/0V4enXNB7P5YFyHYoDPAIwVjOXSY0PSBihlKkEnXweWNyzh\r
- VOGEqzev4krlFdiX2cOk0AR6+frQTD2Og2GaUA/ShXaQOfQEF2Ho6Q8Lj2Q4ByXfdRKk1TgGJt33jkhr\r
- jM8ueV5eU4/m1uecKXG1tDxFUVExQkPD4OPD7xKPx4eb21U4Ojreovmrf1cKkfkBafm3M4ctuA5mVBwY\r
- q18wzG8YJodNxrK4ZVyaHM89jvMl5+F5yxPCWiES7iUg9m4sknOSkZ6Xhbi0ZCRmiFBYUo6HDY1do9XT\r
- HPu+ra0dFRWViI6OAZ/v2yUfn47XQUEC5Obmo7HxSS849nsvL+8aAhjSBUDdRvHn/WVghoSCmV8JRm8/\r
- RgaMxHThdKxOXM2ljn6BPpwrnBFeE47chlzcarqFksYSxKXG4TmZ6qnqOzVITEqGr58/fH39OPH5Hc8B\r
- AYHIyMjCw4f1vQy+Clj8MxZAIBA8IIDPOAAy/7GFW0kD82EAmO8ywPx/NZgDzvjM7wvMjJjJFa5ypjKX\r
- 866Vroipi+GMt7S3oK6lDsL4CLQ8A4SRsfDhk1nWsF8AUlJSUVtb99YG+wLgUZQiY+IbCWAMB1BSUqL6\r
- 5TwyzviCmX0DzOoaML/exKdXJbkIrEpYxXWbP67/AcdyR4TWhCLrYRZKG0tR+KgQfKEvqu89hqs7j4tC\r
- Xwb+7vee3r6IT8lsI4DvOYCY1OJk5qNgMB/4g1lBo7+hDsy2+xhqK4fvQ7/n+vxO0U6u+5wrPge3SjcI\r
- bicg6nYehOUFuBIqRGJ6Ljx9Bbjf0MRF42kb0Ep61k75Tp2D7R7vCs7T2w8p2UUYMmToLIaWB6MOW914\r
- wY3+iIiO0d9yF8zuB+h/oByjA2bil8hfuDTan7EfJ/JOwPS6GxySWuCc1ArH2Kew8a+Eu28oYkTXkZJV\r
- gPpm4FEL8Pgp0Eh60go0kZoJrAuOwP5XOE+eH9Lyb+KbCROXMrm5uVILD1LasACfRoJZWwtm6z0wex+C\r
- UX6EoQ6a+C70O8yLnof1SeuxL30f1DKNoC3yhm5qIHTSXOm1FRzc3FBQ1QQ3nxDUNgJ1pHtPgPukB03A\r
- QxIL1kBgr4WjiHGRewnHRe1l3xdPOw8CyKR5YeqPMzcxWVlZu6bJFHcAsCm0hiLQCaDyCMyxWnzqs4DW\r
- PhMxJ2oOt3zYkrIFu0S7sDdtL/ak7cG21G0wv2yHG/cAG2cf3KwHbpFuNwBVpOpHQM1joJbEgt3tCUdg\r
- r4PrFrWXKXnVyw85lU8w82fJfYxIJNL8Vr6qA4DVgtKuFGIUCOBwI5g/sjDEYxE3qf0Q/gM3sbEzM1sb\r
- i2MXc9HRtTuN/BrA8pIPB1JCKr0PlD0AykkVD4FKEgdG6gS78zo4ihgXOTG4xxQ9NiWvePgh985zSMxZ\r
- qMYkJSUdmXaUUobx6wCYktVVxMzeejBKLyF0RejvsghDfIdwa6PxgvH4NuRbbt3zeeDnUDE9jKwqwPQC\r
- H3kEwsJcrwUK6oBCUtFdoJjEwREYC8eBkViwm51wYlHrBUfpyKalk7s/sqqBOQuXH2fi4uK2LzaitBmT\r
- 1AEwlCayldSJNlEhb7/fUQvyDR0gahSdS8u4NVJPbTPYhZSK5zjjwEfGbSCTYFigbLpQDunaHSCXoDg4\r
- AuuEKyK4LrDOqPWE65GSF9z8IboJLFy+/ncmMjJyyeZz5WCWi6XRl/EdtcBCsPWw4wHXlRgZgjkSCMbr\r
- o14A8/QWgp9QBn07PpIqgORKIIWUShdiL5Z2C0gnsF5wBNYJ1xU1AuwVNTE4e7cgxJU+x9LVvxkyYWFh\r
- w/WcU9oYFZoQJoj+rIXJlErSd8Cso660keYFFmYziX22XdALYLzhdJg4BsHIMRQhec2IprViLCmuDIgv\r
- BxJIiQTWBUdQHByB9YTrFjUC7JmSl7wjEZzTiOUb95hyE5k3PyBksGorpUo7mJFRHRD9qSamXQMjRZFh\r
- J7eVBMMCsc/aR3sBDNfeApXjlnAQFMIhpBChRUBYMS0vWN0AIklRJUA0KYaFI7BecBQxLnJicOkE2DNq\r
- lwNT4JFUB+mtCuc5AB6PJ7NMn+YCNgq7msAMolm5syt9QpObBLXZRbfBLCYtukV14dQdwJHW/lL+2KWk\r
- B6+MZpyyD4N/PhBwHQgkBRUAwSTi6gAjhb+Ei2DhCIqDI7BecOJRe5mSbmHXcEFYgVU7DtpzAO7u7h9a\r
- XuKVDzz4rANiPeX94JA/IfpRRP6dAGZ6AZj/UL3MzQPj0/9PCDUFMJMKsW7bMXhfA9TN/eCVA+41Lxfw\r
- IfHzAF+SHwv2Ei6I4FgwClpvOAIThxMWtsLcIx4nLXnQOOsOl6RHWCuj4dS1nKYNwsb1+lQDLACr/W00\r
- 8rQ3+IBWqJ3RYJ/7UWp9RHBugzsATKeAGRbEHbd0hQrcsoBDpn64kgG4ZoJ7f5Xkng14kDwJTByOT3Ac\r
- GEk8agF57TDzFEHzHA/qZjxoWgbCNqKWO9elhMc4fJZfM1d6x9lue2Ira1v/qVq0J+iEYJ9lmsFMTO8O\r
- wYJc+pQgBlFEqB5eAv5nriyc0gEVEz9cFNGFSI5p1LdJzvT5ZZILgV0hMHE4Fswj+wWMiezQWR5UTUg0\r
- CKbBt7jfOaW9gK5rZssOTaus5TvUnSf/vESOVqIf99pSWlhYDDEwOZ/z5WFqoeIQnSCr6HNJqpVJmdSJ\r
- vgajKN2xAfqa5pDpufh+/kGYR9RD4Yw/rGjLbUOyTab9K8k+BXBIBS6QOuEMvAuhfMYHikY8KJ7hw4BX\r
- wh3Dyiz8PmT1rt5cK/9HsMTSXw3+9eX4H151Y6DXXQkjI6PRJ/RMiieqFfWGEIdyWUKbHkozsc8+k7aC\r
- mnU0ZE/7wzSOTJDM4wGLBFpikHS8y7Hf0Bf79HmQNfDBiSv5sEoEJ8u4dqhax7cu23uufu46BZdvfpi7\r
- jUZ5UF93M155W0VHR2fY8eMnBPPVwjBAhdprz2iw742ce30+aHMM1imbQf5sOHRDmnGMV41d+tSddH2w\r
- W88HahcycTbmOQfG6pRP1Yv1Rxwf/bz5bP3XSx3ah60sx7AVJe1k/F99Ge/8/rU3trS0tPqr0WPfQe0H\r
- 05SiMED56V9HhKD6y9VDYpUCjnlXY/NxNyhaJcMgog1G0eCkH96KvWdCm1bK6Ves36XRNHqecfvYnS0Y\r
- t7u9S6PXF7QSwIi/DdB5AkVFxWFycnK6O2X2VyyUOYtvZCMxUu46hshXY4DSEwyUv4uP9xVh5M5YjF9j\r
- jMm/SL3QiwA6pepS8mKzhl37DnXjdo0zlgi7lovrDQ1wdA/Esh22mKHU1k2Tfs15SgDD3xmA+Im2bt06\r
- ZdOmTepr1661lZaW9peSkkpdvHixcP78+Zdnz55tICEhsfyriT9VbdHhP910yPSZhukluAqjkPfwIWda\r
- XI5egdiv6YhF6s+6SVIuE0rHjqVLrVun8CYQfd7cfZOTdB4zb+nS1crHtOuSKyt7Ge4J4MQPxCkjV2zQ\r
- ae2mlarpyKypgfDatfZ1v/3mRNH4v7/y8M4A1mzdetArMupJT6Pi7/Pq65F57x5EtbVwFIRCz+gC9ho/\r
- 7abNmimIpQEQ0e2Y1Dt3aHmilPhX3eidANAFPtDUN6h5nflrlEJpdXVIqKpCFJkLLS2DV1YWlFS1oWbV\r
- 0k0yJxIQUFCAsLIyRN+8ifCiIkhISmq+LgrvBEBi3rzd8TduvDJt2BFPrK5GJBkXlJSAT+Y8qJCvEIDa\r
- UX0o66VAz6m5S4q60XDJzIJnbh78CgsRUlKKrfIKtFp69V9h7wRg8Urpq/mUHj0jwJpnR11YXo4AGknW\r
- 1OXMTNinptLElgBDa2fsUbXEea+mLqkZCnE+MREXRCK4EKR3Xj5ktY7R7YD3CDDtx1maTv6B3QByHjxA\r
- MuUwO/KBxcWceeeMDNgkJ8M0Nhb6QiGOWzhAWescrgQ96dKJs2EwjIjEubg42KWkcNHYuGsfbTzfIwDV\r
- wEClI0ebxCPQOfrhlMu+BYVwy87hRtU8Pp4zqB0sgKLxOWjoWCIwurFL2sY8nAoJgVFkFM4nJOLERWq1\r
- S1a6vVcA9uQbN+700je1RjrlOwvSCcAWoziABQGcJoCTAgHkLK2hpK6L8Nga6Fl40sLOGgr2F6ATEooz\r
- UVFQt7SB1knj5jFjJkx97wAjRowYvn27Qujps7bwiopBVwrRfwDiKWRLKWQWG0dRiOBGeo+BMRTMraDp\r
- 74/jQcH4nf7QOOXnB2UdQxiZXLwnJbXmLye0d1LEXQsraqcbNmy3u+wiaDWzcsYZm4vwIsPhVMT+XBHn\r
- ckXsQEXMFioLYhwdzaWLPhlXNjaD1mlzWDt4019SNoWSkguW9DWRvlOAzov99NOc9QoKR9ytrT2qrnoI\r
- YWLhiNMWF6FPRatrYQ9tC1ucOGcNbVMbnDKxwe/GNnTMZfrTI6Xt6NEzotWrfzs9bty4f/dlvteG5k1+\r
- 8DbHsKtKKan1p1RVT/GOHTOK0dW1yDM3d6nm8WKfOjsHNxga2padOmWapqFhELJnz0HHGTN+WvU253/v\r
- AK/cQTHMYAKbSPqC1O9tDfc8/r2k0N819Ta//8cD/Bf1OK6O+/e5egAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="User Colors">\r
- <value>User Colors</value>\r
- </data>\r
- <data name="Sat">\r
- <value>Sat</value>\r
- </data>\r
- <data name="OK">\r
- <value>OK</value>\r
- </data>\r
- <data name="Blue">\r
- <value>Blue</value>\r
- </data>\r
- <data name="Base Colours">\r
- <value>Base Colours</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACTtJREFUaEPVmXls\r
- VUUYxVtrLJFUTZTFJUgQgooouEAxGheM/qMREo0b0aCJ0bA0smihRUE0alwQlQfiAu67uOPCYlUoguKK\r
- Ii4gsgikaGmLRoz1/B73NNPb+15f+4wJvhzv5c52zvd9M/PNtLCxsbFgj/4PAXsy/jPyBXMLOghHCqXC\r
- 2cKFwlUReOcbZdTp8F8ZLS8BInKocI4wVpgpzBYeEh6O8Iiehr9RTl3a0PbQfMS0WYAGLBT6CZMCwpB8\r
- VJgj+PeY3uJwGfWoTzsE0Rd9FrZVTM4CEohjUUjwg+jjwhPCk8JTwtMJ4Dvl1KM+7fjRD/21WUhOAtRx\r
- R2GUQIiExCFhws/o/VnhOeH5CC/oafgb5dSjvgXRTyiEsTrm4o1WBaij7sJtAq62xU0cK0MGchB9UXg5\r
- wjw943AZ9ahPO9rTD4YIhdzO2K2JyCpAHZwipASsTtzicgZiQCwZkn5F/35VeE14XXgjAXynnHrUR5DF\r
- 0J+FMA7jzYJDNhEZBaghS96DAXmsg8tt8Zf0joVNGsJvCvOFtyO8o6fhb5RTj/oWQz/0Z48wDuMhAs+X\r
- ZhKRKEAN+ggsdawS/Jh0odWxHBbEoiYN0XeF94QFwsIE8J1y6lHfYujHHsGr9gbj8mPu9UkS0UKAKh4u\r
- 3C8QNnHyuBtrYTksCAGIQArCi4T3haoIH+hp+Bvl1KM+7SzEHqF/xomLmAG3uIhmAlRhL2FKRB734UZb\r
- nk6xEuSxOiFh4osjwh8WzCio7jm+90/9xh2/Qd+qAyzV+xLhI+HDqD7tLIT+6Jf+GScU4XC6GY6hiLiA\r
- waqAu1htHPNYwuRx9VuR1QgHLIllIbTkoKmdvqmYMblh09baxrLU+Fp9WxHDcv3740gUYiyEfugPb9C/\r
- Q8oiPCfgNThRgApKhHsF4t6rDROWmHTYhOSxHuEBkepjr++/Yd6C+bu2/bazEYxOjduh758H+EzvK4VP\r
- I1GhEPqhv1AEnmBcxocHqx+8CO8Si2jygD5eIjDjCR0mDxsNqwIT1mGDhRiEwbDeUi10y8+dMGT7mrUb\r
- 08SNUalx9SpfFeBrvX8lfBGJspBl6X529xeKcDgxPjzgAy/4XdpMgD4UCaH1cVkYOkwwx7wtv7RwZuEn\r
- l065onZLTX0z8ogYlRrboDbfBVit92+FbwTEIASvfCLgDUTYE8wtxmPccD7Ay14oSp9l0v+bW9BXIPZD\r
- 68dDh6WPWE2HTdEDRZ9eecvVdVu3N7Qgj4CRqbE7Ve+nAD/q/QdhjYAYvPNlTAThSP+Mw3iEbBhKoRf6\r
- hgKGq6KXTWKNmPPEtfUJHZbAj4rvK1454vay+jBk4u8jU2P+UN31wi/R82c910WCvtcT7+ANi2DCE06s\r
- UozDeHEveC6wvF+5+zS5Oz2eLnjy4qYw9rFCk/WLphetGH3H2IZs5CkbkbruT7XbHGCT3llaEbVWwBuI\r
- wBOEExOcVcqhFPeC54LD6IE0d/1vfyFcOnGTw4fljM2KmHxfU3zJBeUX1bZGnvIJqZt2nThpwE7jpMqB\r
- DUK9UCfUDqgs/X1ARen2ARWDagZWDNo2sOLkLaUTT94sbDxsUjdCDC8wLuPDwysS/FjiWVL3RwA7b3z1\r
- iYcPm03VqWWnbd3w6/bEmM9FVK51zrt56BbGExg3HkbhPOiOgH6BgDD+SdJYylg6F/YZ03fd59+u+SdX\r
- EvnUO2/qEAQwmRHA+PCAD4b1PGDB6Y+AMyIBTAwLIDNsEnBI5WFfvb5oQdMmlQ+5XNoGApgHoQB4hRP5\r
- DAScJsRXoFDAu8eW9/sxvlHlQqS9dWICWEDsgbiA0xFwXGseUPmiiyZfVtNeQm1t1wYPHIeAbrnMgX2m\r
- 71M97ckZf7SVTHvqRwI8ibPNgW4IIIlL2oXZwsNNrKr7lB7fvf1B1d+5kNq8bUcjK1Z7cO6U870KxTcz\r
- lvdwFSrxRnaPCpxCk/8n7QPpBK7nxF5r36pa3KqIa+4YuatzeZcdQl305L228w1dfhNqhG1dru/6q7Cp\r
- y/iuvwjru447eK3wQ8nU/chiGS9pH4Af+8B9QqFzoWH6R7gTk8g5C222E+v70iMm9Fz35uKFWUWMSI2J\r
- 78Qb1ZadmJTCO7FzInZistPWdmJ4eSe+PMyFeiesRBlzIdWt7lF+xLqn3ngp49Ia5EKkDsDESerIheIJ\r
- HbkQJ7hcc6HeoQDyobtiYZQpH2JykTUuO+DWA1aX3TW+ISmdjrJRyJKROhN1EkdaHc9GSeTol/4z5UEO\r
- n2mET5OAKKUeEoRRpoyUmAxPYst0d7HyrBvOqfls1epmu3SW8wDEfbAhgeM8YPLZzgPhqWxo0omsOPJC\r
- eJi3F7wrk5f4RObjJIOv6DWx9/o5857+KzhS1uk7BxcD0qTOPsiEJzKfA3wi8wGfcZ2FhtYvbiEg8gKX\r
- WfFdOTzYODcKRRCzxO7HHW8rWXXtnWV1LKHRmZgTFysKT5+JsTjx7jMx7eNnYh8n42di0p1B2W4lmAvl\r
- AksqRzdmvA83PtiHVyq+B0rfSqSFzC5YfvqEwVsurhwWv5XwjQQeQ7BvJXxP5GNkSN7Jm1eeCrVrdgWf\r
- dLHVSZXuFsJQ8vk4LoI8hYwR1zP5sCQWXVI8uQOhwuEkBKRtcerTjvb0E94LMU78XohDV6esF1tNcbU7\r
- veDEk0kEscku7WsWCPieCFLh7RxEDb5T7nsgXzHSD/3RbxJ5rjlb3Mo1W4VaKJtbcJQazQpEOJyYE74b\r
- 5cBtIVjQ14yIAeH9qL/5OpH6Ju7bOPr1PRDjseNy2Dq6TZe7gSeOUWO2bHuCTn1fhIvjQohfSIU31BA1\r
- +E459XwXSs5FP/Tn+x+TJwrStw/tEhCtTAeqk0rBE9s31UxuBrQQXE8IYE3AOTYOlzlUQuL0x1JJ/ywg\r
- NwoH5fUHjsATe6uzywRft+NaNjsGZGAmOa5HDIcOiAFEGf5GOfWoTzsTpz/65Udutndr5LPOgaTG6pTJ\r
- PVLAG/wYEIvhcsQk/Z3MfxvjacLUoz7taG/ioxgjF+KJG1muDSMhI/T0bQYutxgsCbFMoNykaYdXMUqb\r
- iOclIAitfTXwicJwwWcKJrx/EDT8jXKSMdqcJOybq+ESoyKfxglLL5tgT+EE4UxhaATe+UZZi80oHw6t\r
- /pk1n87/j7Z7vIB/AbqI4PWoWfWuAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="Color">\r
- <value>Color</value>\r
- </data>\r
- <data name="Abort">\r
- <value>Abort</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB6pJREFUaEO9mQtQ\r
- lFUUx/+77LJP3o32HMvUIqxMe/hEGlHTMTVSS53M8UFoTWmDItSWGiMWkQgLu6CwmbtLigpJVgrjjFkO\r
- A6mlkZQUmNRMNb2cqWzSbucu7bIL34tlF2eu7Hzf/b57fvece8//nk/FGMNA/1NFq25kl1hnSMblAAPZ\r
- MBGzkIvvMRuFBBDZ37EH1njAiJdwEmfA8Am159GIB/BgfyAGFmABbDhNhnMAb3PjF8zBdvKGLhiQAQPA\r
- BMxALX4PMN4LcZKAMj3emNJXiAEBoNk1wEJB4z/zQr/34Fekoagv3hgYgAUo7RU6YjDcG1lowlikKvFG\r
- 2AEodKajRiR0pDxSTd54FFbyhl4KpM8A9EKtVouhd9+Nh1NSsOKmm3AXXVMLDcIHp9Bplg0dMZBT5I1s\r
- 8sY4TBODEASggQcnJWHGtGlYt3Qp3sjMhPOVV3B42zacdjjQeewY/m5rA+vsBPvwQ1xJTcVTggALaAZ7\r
- 7jpy60Do/n78hnko4Wup5zgegMREjFm5EuUFBThhteLrAwdw6dNPwb77TlnLycG7vV48HlNxgAYOxmD+\r
- DIFrDtDfreig3NGADDiQiPm9xiEqVW4uzis1VqjfoUP49frrMdz7ck/o5AQXOje4wZ6qAMvfDbavBmzY\r
- MKRIroHbb8e9J07gSn8A+LOvvYYTNBHuwkIcnfAcfgaP3yBmf62t2+vffAM2bhxWSAKMHYsVFy4oCxUl\r
- kG9/ABZd62f8cbDBlWBG/2sSYBvKA22ZORPZkgBjxmBea2toAPiMjcwAG0VGpFEYrH8TrKoOjF+3VoFp\r
- 6+W98lxZoC2LF+NVSYARI/DgKXK3ktmV6/Pll2BSkzGlSB4gvQfAqlWw+62tG0aP1syfO1dnWb3aYEtO\r
- 1i6jTR0jjh7t/xqQg+P391J46Q9JQyy2gn1A/RwONaus1LCsLF3Hli2mY0VF5ra6upg/WlvjabKvYR0d\r
- CWzyZG06P1MkVFfjNyUGhKLPJFqkUos7ZZOGNTfHUY5J8Bgq1urrYy/HxqqGcwC13Y7OUBjX8x0tLWB1\r
- tAbeektNTcN27dKxaZYISYDZtkhJw71AxcXm8zwFeBLZ9u1oDRagowOMMjNzu9XM6dRQi2S7d+upGdnB\r
- g9Hs88+7XO5thU4zowwhCjG9VBlAbq6p3nMc5v+9/jqa5QA++wyspkZFhkZQ01LTMZfLyPbsMbPGxlh2\r
- 8aK0y70ALS3xLHaXOEByiVaRB9auNZT7APLycFQI4OxZMLtdz6qqTKy+Poa1tSkzUip2+b17SzSiHrif\r
- 7sk9z++npelyfAAbN+KgEMD+/Sraw0NjtL9RC206UYC7rBGyAGfOxLOkpIipPoDsbLiEAHi4KJmNvvbZ\r
- VGHyiDWh3WhEsVp2TKcz+kdawCYfwJo1sAsDKFtQfQVobIpl+reFAYYoACgoMDf7khv/kZ6OfGEAg+xs\r
- 9NV4b//EIuHtNKlY3usWi7E6AGDhQrzcE4ALvL17TWEDSBZZyJOs8os4PV3v00eebZQU3/M9ARoawE6d\r
- igsbwOyySME1MFsmD1y4kMCmTNGuDPDA+PFY9u23gYKOJ6Zgw0PJc09WCO9ES216yXEbGmIvx8WphgYA\r
- 0JEyle/5/l7gyUqJIcH2yXDoe3uAkuWLFUbJcW22qPP+8toTQqRIbzt+HFcDAXRhBVi6s7cHzHvBmmiH\r
- kpqUrVu7JESAB2hPvaa2NlCRut3SMxHszHufe7y8N4CSLLx+vbFMCCBi585uRcp1z+HD0WH1wBx770W8\r
- rFQ6/jn8Y4/pNvQC4BdKSroVaXW1irW3h15C+HstlURbQCYmRevYFyU5aWfPxrNRozQBBWBfLFE1wadI\r
- XS75vbi/IXQnJSx/gJspA/NTltR73e7on3oWt3wAVBbxKVKXKzwSwmscF4iD7KpuANJFq2S2T/4sHSub\r
- BCtz/CLVdN7x7kIuV/gkBDfk/YYYpnqvWwsNK1UrkuqbN5v2iAJYLHBygPZ2LiHMYV3AWypJjVLp0hNC\r
- jWCWSmU73tNPG/JEAdatg40DHDkCdvp0+CQE98AzOwy+8BldqFF0muMSYvr0yOWiAKtXdylSlyu8EoID\r
- zPs/B0RQoaukWpm3Gxpirl53nfpmUYAnnoClCyC8EoIDTCzvOlJOLlA+Vnm5+QehCp1vF5ozB2s4gNMZ\r
- XgnBAYba1cy0D2z/Eelkee5cPJVlYv4qLY1qz8gwuCQBJk7Esi4AZQsq2DzQ1BTHoqn6tr6ia6fjhQIq\r
- GPxTVhZ1kU5aTRs3mmqefdZQMn++7oUJE7Rpej2ulayNem+OHImH6GuLp/oQrHFiz/EF+NFHsVcdjqgf\r
- snMMX4xaEPE1lUV2LFqk25SSol0yaJDqVrHPVFLG+87E/IfBgDtKS1X/ymVDMSN5KZCXBKuqoi4VFprP\r
- 8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B\r
- bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe\r
- incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAAA1pJREFUaEPtl11oUmEYx/2aigx30ag2XXURYQwTkiBDMaSrugi61CBidhVaKUF4M6Iy\r
- ugga9kHBRqMkKiq6ihYYMYqtj6tiUBch0UAq4oSY0Nbs/4xz4PBybJ4v5wGFP8ej7/ue/+99nvO872tu\r
- NBomQ38IwMgytPnl7DHy7HcBOiF63RQSRwHlOAaN9fb2vnW5XN+dTudvfK95vd5v4XD4/ejo6KNqtZpD\r
- n4PQdsiqNoqaRACmh6E3EC0q/5Xb7ebS6fRYxwDAcADiVjIu/t9sNjcSicQsIE5DATVRUBUBmLJAH+SY\r
- F7fN5XLPYJ6isVcphFqA/UrNUz+8H3WO467wEDuVQKgFuMEC2O32xWQy+XJmZuZmpVK5Vi6XrxeLxfs+\r
- n++rFGyhUHjMA5zHtUcuhFqAV6ypeDz+mjd0Edc9UD/kHBkZGUTbRbZ9KpV6wbenVBpuN8BH1tDU1NRt\r
- 3tA+psT2oO0ftn0mk3kuAoi2G2BWbGhoaOiHyMwgA3BAKoUmJiYeiPqE2w0QHRgYqGDRqvn9/i+lUumW\r
- FACM26E5FqCvr69Wr9cLqwbAz1YWVxLlsKBTzOxfZc1bLJalfD7/hOm3pa0R4B+2GVcSmaZKchRaLxiB\r
- 8ROseZvNtoBtxVPG/Fncy95aqKpCK80WjFPe/xUDYH/E3cOHMX8J97Q3ku1HdodWHwLTG6FfYvMOh+Pn\r
- 9PT0JGOeyu2OVsdl2+kJcJdNHabi0PtyDtqk1Dz10wUAxtdAC2IA2jZI5PxaNeb1BIiysx8MBj+rrThS\r
- sHpFYBsLkM1mS4YBWA6tyXSHIGjvHwqFPtVqtcsiACq3mkyeJoM0M4NqGaQdKTPz9PIeMQQATNJ+SLxC\r
- C99l73maAesaAf6hhxiIw7iXveK2FQC53w8dE4SD/EmPx7MLJpxapY4wjuYRgGk6J7+T2DrTqhwwAoBD\r
- at/P/3a8C8CUXz1SqGkEIpEIHV6i0AatIqEHgBXpMs+mkdVqXRofH3/IV6QLuHq0gNAcgF+Ft+LQMhmL\r
- xeYESZy+dncsAG/M1mQRExazLsBytLUIY5MxLPj9TJMo0BFS9gFe6jl6AtDY66CEhBSdf1cDQO8J0jWF\r
- dDev9zvQBWilwLRllloxorRNF0DpzGnVz/AR+AcOBL1o7Kmu0QAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="Yes">\r
- <value>Yes</value>\r
- </data>\r
- <data name="Bri">\r
- <value>Bri</value>\r
- </data>\r
- <data name="Cancel">\r
- <value>Cancel</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAfNJREFUaEPtmk8o\r
- REEcxxe7J/9WbvawVxcpBzkhpUi5OLg67EWSFAclxcnJHrW5UFw4iDO2uMiKZ6WltSVa689jd7Nr/6j3\r
- NbslntFr9Gqnec3W57avme98f7/vTO9NGQCb0L+CAJEhi49WgiYo4wUBneXlRQGklsTBbi/OeVpcAQ4p\r
- gG+52aUDnBu+4mcTO+uQb2oBRKLGiQ+SQqPFFOrqhXpPdjOR6BvAC5l7jxTAyzVrO3AcPMHG4gJFKHrH\r
- 1CcrCjCyThPOsvXZEeZwiCkdCpZ0Yxs6cLC/C9/kMEXw+opJgGeNbHJDNEqCTcA26rEJu44ddEkBkA7I\r
- EvruIdnERhsY9xS6Sb2hkPm/uc1lmWJ0KwzM79FEcmwxeoZlnMKn4wLb7DHK63jwn3GtfZT4z0rw+q90\r
- gNfKf41rcQfSaTzEYhT3uRxTjJbCHUMHEl7vny99VL+fScDE7AJc7laK8yeV6fnGlya4VLeO/uQg+z5g\r
- VoBnbIa8Z22gUGKPTAKqn2phe7TpaHvtkALAWkLSAVlCJlOIewm9rq4i39xM8RwIMKUIdwFmN6LIewah\r
- eJIiqmlMC3CpJRDS4jrC2ht7jJoVUIrnLX4WEuBVu3SgFHVuNIalHGh3OJCprEJKJMics+QTU7fQFz2K\r
- N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACKZJREFUaEPVmg1M\r
- lPcdx//3fs9z99yBEJt1WzqTrc2SZmk6a+K2LpvGtGE1jd1qRnWmXRpaK77WicU5GOCqgnIg4AsHihYq\r
- xyFUsWoEkbM4DirH+/sd9waKAqIyqw3+f/s9d0B5u+OgGK4kv+S457k/38/v/3v7P4cAAMgP+ocH+CHb\r
- vIqvWK3+HZrYmwPxuszb9XkFMIaqMyvXqT//+u8q4VQiq95VLTKuVRv9FuBGmKrUtIGjNVu4zNqPOcFY\r
- oTVbuT+ZNnJ91R+qHvktQO02zlq/U0kbditpY7QihRfaFKMQNv1bEdf4L+WT+kglrfsHN+iXAHURSgmK\r
- HGreo6Ct+xW07SBL2zRscruGvdyWyNLWBJa2fKqgCDPglwDo6Z/zwtuTWGo+zFBLOkM7M4dNy1DzUYZ2\r
- pCDUAbZ3XgGwivwULaTqPdUKUzj3BwyZ36L4JejhDzpSUXAGQ22fyan9tJw68mTUqZdRhw5/z5FT6wk5\r
- D9Iz5wDY+KRoCl/6B4pXGNeoG258qKK12zmMdSVtjWdpRxrjEujIldOuQhm9+aWU3rrktpsXpLT7nBuG\r
- h7McY+5jeNViuBXWf6I8iMm9CR2yEtdWT1lGUZyYZcnzS5eSNaGhZOeWLUQTHU1yEhJIyeHDpCE7m/To\r
- dKR/82ZyDe8dVz2mLIfvqX5p2sTd55OyGeO6/RDrChdePC+0p1hK71yT0DvXJbT3upj2lkvo7VI3iPMM\r
- QpzCnTjCuPKCdwBWLIoV7DMsw2IXwEsvkRe3bSOavXvJ+eRkUnn8OLEbDOSxzUagq8uzNTcT+tpr5C++\r
- 7ARWnNDGKCVticfYPiJHz6KHv5DCrWIJ3Lkuhv5qEQzUozUI4W6tmPZXiumdMolrZ/jQ4oHbk1nKJz2G\r
- obZ6A+fqHYRhyMKsLNLrTai3a1FRJGcsAL97zz5LfrFiBQl9/32yIzKSaPbvJ7kpKaSsNEE60JbEgCVT\r
- Do48Kdy8iOK/QvE1IrjfJoRBmwAG7QJ4YBbRe40i2meU0J4SKe36YngXMOxa9ilSGv6pHN11EhJC3p3O\r
- 094AjEZyf98+cjotjZzHnTPl5pJbFRXkid0+eeec+J75lBysWTJwFri932sUw71mIfzPIYBHfQQe3yXw\r
- 8KaQPugQ0bsm3AWDhHYXyaj9c1dCx0/cbbJmDYmYrfdn+jmbSQgdRxiwnpRBVyECXJFAX5UI7rUK4WG3\r
- AL4dJDD0LYFHvQI62CmkAxhKfG7wYYRV6gkm8/JJAKtWkc0zFTKb+61GETTvY6HjEAJMuwMCTzvQgxXs\r
- x+NCdvlyEjYbQTP5jOWaCOoiFdAUy0K7hoHO4RzonioHMJQemIWYzCLaWyGht4ql4CyU4a7JoSNVDpgD\r
- XzXsUkpGIMjLL5O3LBbv1WYmYife21EshhvrOajdpoTGKAW0JjBgPioHezbmwbgqJMYqhNYggrs1YujD\r
- 3LhdJoHuL6WY8DKEZqAtiYXhKpQ4CrBwIfl1dfXTA2i+IoKyoxK4+KkMru5loPIACw0pfCViwJ4rh65z\r
- MkxmKdw2YEX677CVS6CnVArdF9D7Z2SAfQCwDwBfgvlSPNwHVo+cJn9SXEwefh8vO50EsBrB6dMCyMoS\r
- o0nhJG75iRMs6HQcVFUtAKczGHvKd2a9ogLsxIDNDBNaBt3nsaxechsvnAfDTgy2IhYcTYHQVhkIcX+T\r
- R2An/j124mXYiZeOALBY+np8AWhqIlBUJEBhIhQpQZPhawbFKqCkJAAslqBxIscKnvi686IaYxrzIYMB\r
- HBcAq4wrVHjROAsBzkIuQOslzrVmQYG6H3tM4KQqxL+Rnk7MUwHk5YlQoBSN96YCF1FBXd0Cn0V6AzCf\r
- VQNOo4DTKOA0ChZ0hL1cDZ0nEUrL5wkDOI2CtUTt+nupqarqqTq+a5RITSU1UwMo5kTsVCBtOjXgeYBP\r
- SmjXKsHR6naMvQ7D5RCLyc4CngfAWh7oej8uTnnGI4BGQ65NBGhpIXARt9mbF7/PtZasAKxMHLSdUoPT\r
- Pj70bF8HQmOMEnD4A5vJDbZxI3PAIwDOKhcmApw7J4TOTt9jeqYwzRmB0H7e7d2prLN8AZi2cOAwB7kK\r
- QEiIbINHgNhYopsIkJ8veWre5wU7bdM7x2Jwe7+8PHDomWfIix4Bdu0iGRMB9FgNZurVp3W/VqvqxAo0\r
- 5aMXVxLzZ4HJAKzfAMTHK0s9nTlcAGFhJHYsgMNBID/fXX/9wSIj2eNeAfDYuGMsgMEggOrquan3c+GA\r
- devkUV4B8Fi4fixAfr7ILzzPw7e0BMGSJdJVXgFeeYX8deypLA+Pe3PhublYIz8/YAATOMArwHPPkd/U\r
- 1X03ker1OGD5SfwnJ3O13h4auJIYf35WVkYej4SRXv/0RoiZOiYmRlnoC4AqP9/9ZKKxkcDlywF+swPh\r
- 4QrNtAD8DVotsfIAZ88KwWr1j/LpcATDypWyTT4B4GOReh4gL0/sN943GAKfLFok/ZVPAElJ5DoPoNP5\r
- zwiRmqrs8zRCjJ6JR17gc89LPIBe7z8jRGwsa/HmfVcBGrlhzx6i55+mFRT4zwixc6f8rM8Au3eTE1ev\r
- CqCmZn5GCJstGAyGgG+ys1Xm9HTu6sGD3Km33/bcgSeF0Pbt5BB/Bp5pnZ7J/XxVMRoXDOXkqJzHjnEV\r
- Go1SHxWlSAwLYz5etky6Ch/p/2g6j0+8PhpC69eT/+j1czNCmPAYqNer+rVarjYxkSuKjlYe/ugj+a7X\r
- X5euDQ4mz2NiimYq1OsowV9cu5Z8otMxPu9AY2MQ9gz1NxkZnCUpSVkSE6M4Hh7Oxr35puyDF16QLEaR\r
- Xr+gnnOAN94g4Xl540eI9vYg/mA/lJmpuJ2WpjBhVdBt3apIWL2a2bp4sWwFilTPlZDZrjMaQvgtzR8j\r
- IpjOhATWsGMHk/7OO/LIV1+V/nk2cTlbMbP53Lz+q8FsBHtM4rlYbD7W+D9MzRR6eEGuxwAAAABJRU5E\r
- rkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA\r
- AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////\r
- //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP\r
- +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
- +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/\r
- //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP\r
- +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA\r
- AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
- +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg\r
- /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP\r
- +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP\r
- +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX\r
- +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////\r
- //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA\r
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\r
-</value>\r
- </data>\r
-</root>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<root>\r
- <!-- \r
- Microsoft ResX Schema \r
- \r
- Version 1.3\r
- \r
- The primary goals of this format is to allow a simple XML format \r
- that is mostly human readable. The generation and parsing of the \r
- various data types are done through the TypeConverter classes \r
- associated with the data types.\r
- \r
- Example:\r
- \r
- ... ado.net/XML headers & schema ...\r
- <resheader name="resmimetype">text/microsoft-resx</resheader>\r
- <resheader name="version">1.3</resheader>\r
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
- <data name="Name1">this is my long string</data>\r
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
- [base64 mime encoded serialized .NET Framework object]\r
- </data>\r
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
- [base64 mime encoded string representing a byte array form of the .NET Framework object]\r
- </data>\r
- \r
- There are any number of "resheader" rows that contain simple \r
- name/value pairs.\r
- \r
- Each data row contains a name, and value. The row also contains a \r
- type or mimetype. Type corresponds to a .NET class that support \r
- text/value conversion through the TypeConverter architecture. \r
- Classes that don't support this are serialized and stored with the \r
- mimetype set.\r
- \r
- The mimetype is used forserialized objects, and tells the \r
- ResXResourceReader how to depersist the object. This is currently not \r
- extensible. For a given mimetype the value must be set accordingly:\r
- \r
- Note - application/x-microsoft.net.object.binary.base64 is the format \r
- that the ResXResourceWriter will generate, however the reader can \r
- read any of the formats listed below.\r
- \r
- mimetype: application/x-microsoft.net.object.binary.base64\r
- value : The object must be serialized with \r
- : System.Serialization.Formatters.Binary.BinaryFormatter\r
- : and then encoded with base64 encoding.\r
- \r
- mimetype: application/x-microsoft.net.object.soap.base64\r
- value : The object must be serialized with \r
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
- : and then encoded with base64 encoding.\r
-\r
- mimetype: application/x-microsoft.net.object.bytearray.base64\r
- value : The object must be serialized into a byte array \r
- : using a System.ComponentModel.TypeConverter\r
- : and then encoded with base64 encoding.\r
- -->\r
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
- <xsd:element name="root" msdata:IsDataSet="true">\r
- <xsd:complexType>\r
- <xsd:choice maxOccurs="unbounded">\r
- <xsd:element name="data">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />\r
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
- </xsd:complexType>\r
- </xsd:element>\r
- <xsd:element name="resheader">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:string" use="required" />\r
- </xsd:complexType>\r
- </xsd:element>\r
- </xsd:choice>\r
- </xsd:complexType>\r
- </xsd:element>\r
- </xsd:schema>\r
- <resheader name="resmimetype">\r
- <value>text/microsoft-resx</value>\r
- </resheader>\r
- <resheader name="version">\r
- <value>1.3</value>\r
- </resheader>\r
- <resheader name="reader">\r
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
- </resheader>\r
- <resheader name="writer">\r
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
- </resheader>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD6JJREFUaEPVmXdU\r
- VNfaxo/GfBo1GuONuUmMJTHGllhCchV74VOxtxgrKkhVFCkWlEAAEQQB6SoggrRh6EMZemfoAlKkqiBg\r
- A0VABH3uew5CBtCgN/pHZq1nTTtzzvPbb9l7n+kHgPlHP1iAf7L+0ea57HnT0S8tLR1cWFi4Li8v74Iw\r
- WZRgGO5RrRXk0awf4HffIyg+OzQ03Cc4OPiAv7//mDc957s4rk+AysrKcQXFpS7qwX7PJnvK4XOfORgX\r
- NAUTQydhsnAyJgknYYJgGr7ykcTXHqsh6ayF85f5Oa6urmvehcG+zvFagKqqqsGFZcVWOwU27R86zsZI\r
- 388xIWQCZkXMwoKYBZCKk8KK+BVYHr8cS2KXYHbUbEwNn4rRwaPx0dWxGGu/E7oOVhm2trYz+jLxd75/\r
- JQCZH+eeGVU83GktGPdBGBU4ClPCpmB+zHysTVyL7anbIZsuC4UMBchnyEMmTQabkzdzUBKREhgnGIeB\r
- /IFgHMdhkdWhNjMzs23/i8mV50uGTTtwRWLinvN7f1RwsJhxwCVohrpvyiyNwOwZshZJr6wBMj/9ckxR\r
- Qz/b6WB4DD7x/wSTwiZhYcxCziRrWuuaFvSu6+F04WkYFBjgZN5JHMo+hN2i3ZBOkOYg2Ej04/UD4zIU\r
- X+nJw8DA4ORLiH52SbWjNGzD58qe9pBXNPGyUTIPDFGxjkhRsY3KVrGLLlSxj61QtourOWwf/cDQPemJ\r
- e0zBC9GNu7jb2Ib258CLF4CdnV1pLwAy/0V4enXNB7P5YFyHYoDPAIwVjOXSY0PSBihlKkEnXweWNyzh\r
- VOGEqzev4krlFdiX2cOk0AR6+frQTD2Og2GaUA/ShXaQOfQEF2Ho6Q8Lj2Q4ByXfdRKk1TgGJt33jkhr\r
- jM8ueV5eU4/m1uecKXG1tDxFUVExQkPD4OPD7xKPx4eb21U4Ojreovmrf1cKkfkBafm3M4ctuA5mVBwY\r
- q18wzG8YJodNxrK4ZVyaHM89jvMl5+F5yxPCWiES7iUg9m4sknOSkZ6Xhbi0ZCRmiFBYUo6HDY1do9XT\r
- HPu+ra0dFRWViI6OAZ/v2yUfn47XQUEC5Obmo7HxSS849nsvL+8aAhjSBUDdRvHn/WVghoSCmV8JRm8/\r
- RgaMxHThdKxOXM2ljn6BPpwrnBFeE47chlzcarqFksYSxKXG4TmZ6qnqOzVITEqGr58/fH39OPH5Hc8B\r
- AYHIyMjCw4f1vQy+Clj8MxZAIBA8IIDPOAAy/7GFW0kD82EAmO8ywPx/NZgDzvjM7wvMjJjJFa5ypjKX\r
- 866Vroipi+GMt7S3oK6lDsL4CLQ8A4SRsfDhk1nWsF8AUlJSUVtb99YG+wLgUZQiY+IbCWAMB1BSUqL6\r
- 5TwyzviCmX0DzOoaML/exKdXJbkIrEpYxXWbP67/AcdyR4TWhCLrYRZKG0tR+KgQfKEvqu89hqs7j4tC\r
- Xwb+7vee3r6IT8lsI4DvOYCY1OJk5qNgMB/4g1lBo7+hDsy2+xhqK4fvQ7/n+vxO0U6u+5wrPge3SjcI\r
- bicg6nYehOUFuBIqRGJ6Ljx9Bbjf0MRF42kb0Ep61k75Tp2D7R7vCs7T2w8p2UUYMmToLIaWB6MOW914\r
- wY3+iIiO0d9yF8zuB+h/oByjA2bil8hfuDTan7EfJ/JOwPS6GxySWuCc1ArH2Kew8a+Eu28oYkTXkZJV\r
- gPpm4FEL8Pgp0Eh60go0kZoJrAuOwP5XOE+eH9Lyb+KbCROXMrm5uVILD1LasACfRoJZWwtm6z0wex+C\r
- UX6EoQ6a+C70O8yLnof1SeuxL30f1DKNoC3yhm5qIHTSXOm1FRzc3FBQ1QQ3nxDUNgJ1pHtPgPukB03A\r
- QxIL1kBgr4WjiHGRewnHRe1l3xdPOw8CyKR5YeqPMzcxWVlZu6bJFHcAsCm0hiLQCaDyCMyxWnzqs4DW\r
- PhMxJ2oOt3zYkrIFu0S7sDdtL/ak7cG21G0wv2yHG/cAG2cf3KwHbpFuNwBVpOpHQM1joJbEgt3tCUdg\r
- r4PrFrWXKXnVyw85lU8w82fJfYxIJNL8Vr6qA4DVgtKuFGIUCOBwI5g/sjDEYxE3qf0Q/gM3sbEzM1sb\r
- i2MXc9HRtTuN/BrA8pIPB1JCKr0PlD0AykkVD4FKEgdG6gS78zo4ihgXOTG4xxQ9NiWvePgh985zSMxZ\r
- qMYkJSUdmXaUUobx6wCYktVVxMzeejBKLyF0RejvsghDfIdwa6PxgvH4NuRbbt3zeeDnUDE9jKwqwPQC\r
- H3kEwsJcrwUK6oBCUtFdoJjEwREYC8eBkViwm51wYlHrBUfpyKalk7s/sqqBOQuXH2fi4uK2LzaitBmT\r
- 1AEwlCayldSJNlEhb7/fUQvyDR0gahSdS8u4NVJPbTPYhZSK5zjjwEfGbSCTYFigbLpQDunaHSCXoDg4\r
- AuuEKyK4LrDOqPWE65GSF9z8IboJLFy+/ncmMjJyyeZz5WCWi6XRl/EdtcBCsPWw4wHXlRgZgjkSCMbr\r
- o14A8/QWgp9QBn07PpIqgORKIIWUShdiL5Z2C0gnsF5wBNYJ1xU1AuwVNTE4e7cgxJU+x9LVvxkyYWFh\r
- w/WcU9oYFZoQJoj+rIXJlErSd8Cso660keYFFmYziX22XdALYLzhdJg4BsHIMRQhec2IprViLCmuDIgv\r
- BxJIiQTWBUdQHByB9YTrFjUC7JmSl7wjEZzTiOUb95hyE5k3PyBksGorpUo7mJFRHRD9qSamXQMjRZFh\r
- J7eVBMMCsc/aR3sBDNfeApXjlnAQFMIhpBChRUBYMS0vWN0AIklRJUA0KYaFI7BecBQxLnJicOkE2DNq\r
- lwNT4JFUB+mtCuc5AB6PJ7NMn+YCNgq7msAMolm5syt9QpObBLXZRbfBLCYtukV14dQdwJHW/lL+2KWk\r
- B6+MZpyyD4N/PhBwHQgkBRUAwSTi6gAjhb+Ei2DhCIqDI7BecOJRe5mSbmHXcEFYgVU7DtpzAO7u7h9a\r
- XuKVDzz4rANiPeX94JA/IfpRRP6dAGZ6AZj/UL3MzQPj0/9PCDUFMJMKsW7bMXhfA9TN/eCVA+41Lxfw\r
- IfHzAF+SHwv2Ei6I4FgwClpvOAIThxMWtsLcIx4nLXnQOOsOl6RHWCuj4dS1nKYNwsb1+lQDLACr/W00\r
- 8rQ3+IBWqJ3RYJ/7UWp9RHBugzsATKeAGRbEHbd0hQrcsoBDpn64kgG4ZoJ7f5Xkng14kDwJTByOT3Ac\r
- GEk8agF57TDzFEHzHA/qZjxoWgbCNqKWO9elhMc4fJZfM1d6x9lue2Ira1v/qVq0J+iEYJ9lmsFMTO8O\r
- wYJc+pQgBlFEqB5eAv5nriyc0gEVEz9cFNGFSI5p1LdJzvT5ZZILgV0hMHE4Fswj+wWMiezQWR5UTUg0\r
- CKbBt7jfOaW9gK5rZssOTaus5TvUnSf/vESOVqIf99pSWlhYDDEwOZ/z5WFqoeIQnSCr6HNJqpVJmdSJ\r
- vgajKN2xAfqa5pDpufh+/kGYR9RD4Yw/rGjLbUOyTab9K8k+BXBIBS6QOuEMvAuhfMYHikY8KJ7hw4BX\r
- wh3Dyiz8PmT1rt5cK/9HsMTSXw3+9eX4H151Y6DXXQkjI6PRJ/RMiieqFfWGEIdyWUKbHkozsc8+k7aC\r
- mnU0ZE/7wzSOTJDM4wGLBFpikHS8y7Hf0Bf79HmQNfDBiSv5sEoEJ8u4dqhax7cu23uufu46BZdvfpi7\r
- jUZ5UF93M155W0VHR2fY8eMnBPPVwjBAhdprz2iw742ce30+aHMM1imbQf5sOHRDmnGMV41d+tSddH2w\r
- W88HahcycTbmOQfG6pRP1Yv1Rxwf/bz5bP3XSx3ah60sx7AVJe1k/F99Ge/8/rU3trS0tPqr0WPfQe0H\r
- 05SiMED56V9HhKD6y9VDYpUCjnlXY/NxNyhaJcMgog1G0eCkH96KvWdCm1bK6Ves36XRNHqecfvYnS0Y\r
- t7u9S6PXF7QSwIi/DdB5AkVFxWFycnK6O2X2VyyUOYtvZCMxUu46hshXY4DSEwyUv4uP9xVh5M5YjF9j\r
- jMm/SL3QiwA6pepS8mKzhl37DnXjdo0zlgi7lovrDQ1wdA/Esh22mKHU1k2Tfs15SgDD3xmA+Im2bt06\r
- ZdOmTepr1661lZaW9peSkkpdvHixcP78+Zdnz55tICEhsfyriT9VbdHhP910yPSZhukluAqjkPfwIWda\r
- XI5egdiv6YhF6s+6SVIuE0rHjqVLrVun8CYQfd7cfZOTdB4zb+nS1crHtOuSKyt7Ge4J4MQPxCkjV2zQ\r
- ae2mlarpyKypgfDatfZ1v/3mRNH4v7/y8M4A1mzdetArMupJT6Pi7/Pq65F57x5EtbVwFIRCz+gC9ho/\r
- 7abNmimIpQEQ0e2Y1Dt3aHmilPhX3eidANAFPtDUN6h5nflrlEJpdXVIqKpCFJkLLS2DV1YWlFS1oWbV\r
- 0k0yJxIQUFCAsLIyRN+8ifCiIkhISmq+LgrvBEBi3rzd8TduvDJt2BFPrK5GJBkXlJSAT+Y8qJCvEIDa\r
- UX0o66VAz6m5S4q60XDJzIJnbh78CgsRUlKKrfIKtFp69V9h7wRg8Urpq/mUHj0jwJpnR11YXo4AGknW\r
- 1OXMTNinptLElgBDa2fsUbXEea+mLqkZCnE+MREXRCK4EKR3Xj5ktY7R7YD3CDDtx1maTv6B3QByHjxA\r
- MuUwO/KBxcWceeeMDNgkJ8M0Nhb6QiGOWzhAWescrgQ96dKJs2EwjIjEubg42KWkcNHYuGsfbTzfIwDV\r
- wEClI0ebxCPQOfrhlMu+BYVwy87hRtU8Pp4zqB0sgKLxOWjoWCIwurFL2sY8nAoJgVFkFM4nJOLERWq1\r
- S1a6vVcA9uQbN+700je1RjrlOwvSCcAWoziABQGcJoCTAgHkLK2hpK6L8Nga6Fl40sLOGgr2F6ATEooz\r
- UVFQt7SB1knj5jFjJkx97wAjRowYvn27Qujps7bwiopBVwrRfwDiKWRLKWQWG0dRiOBGeo+BMRTMraDp\r
- 74/jQcH4nf7QOOXnB2UdQxiZXLwnJbXmLye0d1LEXQsraqcbNmy3u+wiaDWzcsYZm4vwIsPhVMT+XBHn\r
- ckXsQEXMFioLYhwdzaWLPhlXNjaD1mlzWDt4019SNoWSkguW9DWRvlOAzov99NOc9QoKR9ytrT2qrnoI\r
- YWLhiNMWF6FPRatrYQ9tC1ucOGcNbVMbnDKxwe/GNnTMZfrTI6Xt6NEzotWrfzs9bty4f/dlvteG5k1+\r
- 8DbHsKtKKan1p1RVT/GOHTOK0dW1yDM3d6nm8WKfOjsHNxga2padOmWapqFhELJnz0HHGTN+WvU253/v\r
- AK/cQTHMYAKbSPqC1O9tDfc8/r2k0N819Ta//8cD/Bf1OK6O+/e5egAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB6pJREFUaEO9mQtQ\r
- lFUUx/+77LJP3o32HMvUIqxMe/hEGlHTMTVSS53M8UFoTWmDItSWGiMWkQgLu6CwmbtLigpJVgrjjFkO\r
- A6mlkZQUmNRMNb2cqWzSbucu7bIL34tlF2eu7Hzf/b57fvece8//nk/FGMNA/1NFq25kl1hnSMblAAPZ\r
- MBGzkIvvMRuFBBDZ37EH1njAiJdwEmfA8Am159GIB/BgfyAGFmABbDhNhnMAb3PjF8zBdvKGLhiQAQPA\r
- BMxALX4PMN4LcZKAMj3emNJXiAEBoNk1wEJB4z/zQr/34Fekoagv3hgYgAUo7RU6YjDcG1lowlikKvFG\r
- 2AEodKajRiR0pDxSTd54FFbyhl4KpM8A9EKtVouhd9+Nh1NSsOKmm3AXXVMLDcIHp9Bplg0dMZBT5I1s\r
- 8sY4TBODEASggQcnJWHGtGlYt3Qp3sjMhPOVV3B42zacdjjQeewY/m5rA+vsBPvwQ1xJTcVTggALaAZ7\r
- 7jpy60Do/n78hnko4Wup5zgegMREjFm5EuUFBThhteLrAwdw6dNPwb77TlnLycG7vV48HlNxgAYOxmD+\r
- DIFrDtDfreig3NGADDiQiPm9xiEqVW4uzis1VqjfoUP49frrMdz7ck/o5AQXOje4wZ6qAMvfDbavBmzY\r
- MKRIroHbb8e9J07gSn8A+LOvvYYTNBHuwkIcnfAcfgaP3yBmf62t2+vffAM2bhxWSAKMHYsVFy4oCxUl\r
- kG9/ABZd62f8cbDBlWBG/2sSYBvKA22ZORPZkgBjxmBea2toAPiMjcwAG0VGpFEYrH8TrKoOjF+3VoFp\r
- 6+W98lxZoC2LF+NVSYARI/DgKXK3ktmV6/Pll2BSkzGlSB4gvQfAqlWw+62tG0aP1syfO1dnWb3aYEtO\r
- 1i6jTR0jjh7t/xqQg+P391J46Q9JQyy2gn1A/RwONaus1LCsLF3Hli2mY0VF5ra6upg/WlvjabKvYR0d\r
- CWzyZG06P1MkVFfjNyUGhKLPJFqkUos7ZZOGNTfHUY5J8Bgq1urrYy/HxqqGcwC13Y7OUBjX8x0tLWB1\r
- tAbeektNTcN27dKxaZYISYDZtkhJw71AxcXm8zwFeBLZ9u1oDRagowOMMjNzu9XM6dRQi2S7d+upGdnB\r
- g9Hs88+7XO5thU4zowwhCjG9VBlAbq6p3nMc5v+9/jqa5QA++wyspkZFhkZQ01LTMZfLyPbsMbPGxlh2\r
- 8aK0y70ALS3xLHaXOEByiVaRB9auNZT7APLycFQI4OxZMLtdz6qqTKy+Poa1tSkzUip2+b17SzSiHrif\r
- 7sk9z++npelyfAAbN+KgEMD+/Sraw0NjtL9RC206UYC7rBGyAGfOxLOkpIipPoDsbLiEAHi4KJmNvvbZ\r
- VGHyiDWh3WhEsVp2TKcz+kdawCYfwJo1sAsDKFtQfQVobIpl+reFAYYoACgoMDf7khv/kZ6OfGEAg+xs\r
- 9NV4b//EIuHtNKlY3usWi7E6AGDhQrzcE4ALvL17TWEDSBZZyJOs8os4PV3v00eebZQU3/M9ARoawE6d\r
- igsbwOyySME1MFsmD1y4kMCmTNGuDPDA+PFY9u23gYKOJ6Zgw0PJc09WCO9ES216yXEbGmIvx8WphgYA\r
- 0JEyle/5/l7gyUqJIcH2yXDoe3uAkuWLFUbJcW22qPP+8toTQqRIbzt+HFcDAXRhBVi6s7cHzHvBmmiH\r
- kpqUrVu7JESAB2hPvaa2NlCRut3SMxHszHufe7y8N4CSLLx+vbFMCCBi585uRcp1z+HD0WH1wBx770W8\r
- rFQ6/jn8Y4/pNvQC4BdKSroVaXW1irW3h15C+HstlURbQCYmRevYFyU5aWfPxrNRozQBBWBfLFE1wadI\r
- XS75vbi/IXQnJSx/gJspA/NTltR73e7on3oWt3wAVBbxKVKXKzwSwmscF4iD7KpuANJFq2S2T/4sHSub\r
- BCtz/CLVdN7x7kIuV/gkBDfk/YYYpnqvWwsNK1UrkuqbN5v2iAJYLHBygPZ2LiHMYV3AWypJjVLp0hNC\r
- jWCWSmU73tNPG/JEAdatg40DHDkCdvp0+CQE98AzOwy+8BldqFF0muMSYvr0yOWiAKtXdylSlyu8EoID\r
- zPs/B0RQoaukWpm3Gxpirl53nfpmUYAnnoClCyC8EoIDTCzvOlJOLlA+Vnm5+QehCp1vF5ozB2s4gNMZ\r
- XgnBAYba1cy0D2z/Eelkee5cPJVlYv4qLY1qz8gwuCQBJk7Esi4AZQsq2DzQ1BTHoqn6tr6ia6fjhQIq\r
- GPxTVhZ1kU5aTRs3mmqefdZQMn++7oUJE7Rpej2ulayNem+OHImH6GuLp/oQrHFiz/EF+NFHsVcdjqgf\r
- snMMX4xaEPE1lUV2LFqk25SSol0yaJDqVrHPVFLG+87E/IfBgDtKS1X/ymVDMSN5KZCXBKuqoi4VFprP\r
- 8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B\r
- bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe\r
- incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAIZJREFUOE+tUgkO\r
- wCAI237ma3inP2NCwlIRdIuaEA+waQt3rZVLKVe2Wj7NaUIA2say+8jesW4AwE/+LHcLA+kAfMExBkTE\r
- Uaj8Yx4g/UirZ9B5gK5KYdSR7E0lbANk9LELUwlSGK1fbTQABDOAT20UAJRi95Wh7xzMGNisTEd524PV\r
- IGVSHnpbhD8B8EhyAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="Yes">\r
- <value>Yes</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA\r
- CxMBAJqcGAAAD0tJREFUaEPFmQlUVFeaxx/IUguKRo12MkmnuxM98cwkJmPapMdsRpOMY5bOMn1cMsak\r
- R4OmoygtoJSC7IqyFzsoigIqKEsha0GxF1XUvldRFEUJKGuxC9Q330NRcAFcMqlz/tz77rvvvf/vu+t7\r
- WBG/wu8/N26k4m3fHhgYeHkQ/3R3d6vUSqUSywZQll/hkU/vlv9w3kdlHPVezoxP2Oty0DN0j6v3cXdv\r
- 5h6v46f/6h92/hM3r7B1+9x93nFjeP7p6T31Kd1pv5u7raev3wpmXPwhoVLVfIlVdvNMZhWcyuRbQhIK\r
- bgZEZpo9/KKvM3xOcv1PhHh5+vrORVk/pcc/+W0Q4K3UjMwglaHJ1Dk4NNLc2WPJ4aggIEkKgam9lqPx\r
- 6rGUXPEoX6kfUjUZFYHBwQzUs0/+5KdwBzcG44M8NjsSjWk6BgZHe8csYB4dA1VzJ5wv0MAvx4VwmqWB\r
- InUraMwD0D4wOCDV6eSJKSm/eAcG/uEpWHi8W7gxjtA9vLw/YBWXxqsajbqO/qGx3lGACXUOjoBY3wGJ\r
- uUpIl5sg63oPcPuH4drwKHQMDI/WiiRV6Veydx4+6vv7x3Pw+FdZMY74zA9jxr2fkp55Xtfc1tbZP2Ix\r
- DwNMVjcetwyOgbjvJpxp74OEG2bI6OwHXu8wtA9ZoLVnYLSaLy48nZK+3fXgkUWPb+cRrlyyZCmx5bvt\r
- 9n6BJ9cnp1zMacUwd/VboHsApqgLj1uwvBYpIlt7IPl6H5y+3gtxbWZIwbzSPAo38Hzzjd6RGr6s2NM7\r
- 4Nt9LgdtUFaPYOfRqyKAfcDx0E2sgnKWsaXX3NFjsXSaATp7p8rYMwbF7UOQ1NoLZ1Hx18zjSmwxw6lW\r
- TFHKrhFo6x61NDZ3d1VzZUVo/hOU46O7msUVb7+9Zg7KISw88Uc2R8DSNnS0t3cBdJDqvqsbeKzvGANW\r
- 6wCcudYLSaZeSEDFN99OTWaIQ53Gc+ev9YGo/Sa03BgZ0zV23Shm87Ijmac+ddrl/MwsLM2+yrp1G2wP\r
- HvR9MSrq7LaiYj5bo+3sutEOcK9a2i2guj4KLNMgJDaZIRaVaETz9yjBaIYkLIvB85dN/SBqG4GWtpEx\r
- taa972p+bWJsXOrH27btfHot8e033z3j7x/x+eXMUpFe3zfQ1gZA6vokmdosIGtB88ZBCNX3QGIj9ncU\r
- sxG7jAEHcBMaNmArYD4JFYnlZ5v6IBrTi8Z+ULWOjt9PIr7WyWJVM48FRq/55uutFNTsI/2wmruc/rk8\r
- MiKFIRG3DRubRiwt13CAolonSdI8Chca+8FP1wXp+j4Ib+iB6AbsKo1oVo/9H9NkVKweobA8HeuebOiG\r
- U3icSJ5HTdxPwG++fjmDE4PmX0HNfrX+5BNiqZMT8QGDQfzv8ePEfiaT8E5KIiLOnLG9dO7cH4QX0reP\r
- iOqlFkPDMJiMANdui9c4Aucb+oGpw2jr+iBI0wNxWow4HkfoeiAey2IbeiFKh90JlYD5EG03JDcgHNaJ\r
- QqVgPhHPKZrGoKnh5oiAZ9KmnStkbvvO6aVPP/7Cbtpm2LaNsEGtuHKF8CgvJ7K5XIJbV0eIeDxCzecT\r
- xvp6op3Pt+2rrfndWGnJARDV88GgG4UGvQXKdMNwVtsHcRo0qDFDuNoM0epeiMSUicfRWM5ERWM+BtNx\r
- IVw8ppHj52+JzCdq+uCKbhBE+lHQqQaH6qqNmqT4bD9fb+aK/3hn7cMhXFwIKmpzZSVRo9MRoyYTAQ9T\r
- Tc3LUMnxBBFPChLNKISpelAYRRUCKDGyyh6IwTRCiQBYHo3lEXhM5mPIOigyH4dpONaNwjx5HIb141UY\r
- CBRLMwRi7RjoFMPDZUXqhuTEq64+R5ivvvynV+c8sCUCAwkHlLtIRCinMz9xrqryVSgp8IIqQTN4yzsh\r
- TtEHEYpeCJbj7IL5QFk3xOBxFCpUgbMRppGYhiMIWRaNOibvHq8bosAA4LlEzAfgdXFyHOSKfriqHAaD\r
- CsaVny2WJ0RlO//ixHj+gQBBQYQDioEA6tkANDVZQ13tCsi8cBSUkiE4I+uHBBlGD+WLJpKlfXBSisZk\r
- GGk0dFLWAxEy7Dp4PhzTECkObrzGH+vGShEKy/wwf07aD0EkPB4Xy4dBL8c1BaWTjY3lZYqE/l4x+xHg\r
- /lYICCDoKFcEUMwGgKyj01GBx30NcjPDoKLWCGniAQgXo2FJHxwX90Ak5iMkZghFg0wsC8d8CIpMmeLe\r
- 8ToxYoS7XR4jQQhxNyRg3WLJTRALb4KophtKcmWQlV4yFnwsUPb37WujN2yw+2bVKhs6gtzdcnh5EXTU\r
- XgSQzhaguRkhtFSoKFsFZQVxkF+hg1TBAIQK0bQAzQp6IITMC7EbiTDqIiybEFle3wP+FQbwKhTD0bwa\r
- 8L9aDgFXi+BsfiHk518FTkEWcApToTSfOZqdccCYmrKxICT495G7d1NdNm+2nzsF4MABgobaIRQSotkC\r
- kPVIiIYGKygrXg+c/NNQWN4Msbw+YPIxwrUdEFBhggC2DnzZcvAvlUBQqRCOlfLgWFkNRJVWgm/BZQjK\r
- TYbg7CgIzwmGizlBcDXXD4pyD0Nx3gFLWeHu4drKLSZuzepCheLF2MrKBf5eXnRnFNkCd3+7dhFU1FYE\r
- 4M8WwGgkoLGRBCBALLaFwrz/grxL53GGaoPAKgOcLFGAT1YpuKWmgVdKPHifDwOf1AA4lnYYQtP/CSGZ\r
- P8MFzl7IER8AjuoQSJWHQa88Mq4GBQOUov0j/JqtbTVV/5qj1T4XYTItOlZRseCoiwvtRxT54eDub+tW\r
- goL6CgFqZwPQ1ESATEZAaSkBOTkEZGVZQ1rqXEiKXwlxkT/B6WQGxFx2hXNl7sASMiBX4gEsySHIxzRP\r
- ehBYUjcolbpDjtwVKuUHQSY/DDo5Gr8tuWAv1Fb+tZNd8kqVXr80tLl58XESoLx8AeOHHyj/jaJMAfjs\r
- M8Ie9TEuWJVkt5gMoVAQUFNjBWy2NWrOuEpLbaCqyhYEAjsEsUdRQCKhAp+3CMpLXwdO8fdQXrUP2EI3\r
- KJS7Q7HiIJSgilAT+XyFO1TLMfIyBmhkR3CmuSUpfzeI69fjvV5pq65aVGA0LgoizZPicBa44iD+FGU/\r
- BWDNGsIW9RauwCV6/VQALtdq3DCXa39HdXUU7DZU7D40hL0rY5MDaLWLQCxYDZL67cAXu0IFmiRNTxYb\r
- o16F5TLZYdBI0ThKI0YY3i40vxaU8pdALndsraubdwdAq10YlJ8/3/nNN23eQNlOAVi2jJiDegm3Ebkq\r
- FWGZ3ALl5dZQWWk3xehk0/fmjUY6qFXPgETwHpr5O9RjVylTkBDuwEaQUhQZeTWa194x7w6y+p0gqPsQ\r
- lIrnwGCYi4Gg3+Dx5rGxBU6Q0edynzmZmjpv1+LFVktQ923wyDnVsaCAuCAWEyNTAeZgd7GfNcAEkFKx\r
- GFvhfYTYDQKZB3ButwJX7nEn6mTktTgupPwdUM99FzRqRyADQN4DAToQoGICgMWaHxQc7LBtyvR5z7Js\r
- k5VFJOEmrn8qANnfKY8MYDQ6gAqjKeS9B1LBfuDJDoEE+7v6dtRJ86RE3O9BxP8zGl6I0/It87cBuuvr\r
- 53InALKzHX18fenfTLcrtbp0iYiqqSG6JuZ4jYYYH6w83qMDkCYMhnkI8SJG9yOQCJ1BLWGMm74VeQYI\r
- a7eAVPjvoNU8eyfykwDMCCAwGheOd6HLlx0PubnRNky7rU5LI4Krq4m2CYDaWgLN24JKRX3kFpgwYmic\r
- B3LpC7h73QhK4R40fhjUOPeLeVtxsK9E84vR/NTJ4HYL9AsEDjIEOEkCXLzouH/nTsr70wKkpBABVVWE\r
- kQQgFyocEyAS2WHT3v+A6Qby/QPbAUTCF0HC/xLk9U4grd8C9bwVoNfPf+i9dTraoFDooCYBmpsXHcMB\r
- 7PTFF3arpgVITiY88Z1ANwGQn2+NAI8+gB8GJxL8EaorXkPzy2YMCgLcRAA9CaDXLzyekjJv2+uv2yyb\r
- FiAxkXBHgPEdKdkCTxuAHBONGHWDwXHGLolrzKhE4mBC82FFRfNDExLmfrZ0qTW5iXv4LyaGcMa1YHxD\r
- dwvABlvg8Qbwo3SxB9VtbKRZlEr6Dbl8QWxa2rwT4eEOax/4LjAZJzyccOJwiDoSwGAgoLDQFlfc3waA\r
- HNg6Hb2Lz5+fgtH3DQx0eGfa6JMnT5wgfigrIyrJzRquyMDh2OGS/vgz0JO2gsFA76mtdcxkMh08PDzo\r
- b8wI4OdHbMEdJlurvbXTlErtccv8ZDPQk0AggBkBWCEhdOeff6aumBEAvwd9zWYT+WT08/KsQKOhzDhb\r
- PInBma5FgF4ud16Rvz9t51df2f9xRoD9+4mNJSVEllJpBbm51uPvvTM95Nc8j63fX1bmUOHjQ/129Wqb\r
- JTMC7NhBrCsqIi6qVCSAzW8OgGvBQGYmrS4wkLL2hResaTMC/O1vxJrCQuIcCcBi2f5WAGPYqjdRQ2o1\r
- rTMujlIdFUWZeQCTdOvWEatw+5B0C8DutwDAdxG6GdVsMjnI1GoHTlQUNSksjLp8xuiTFVauJJZlZBDh\r
- PJ41VFRQcK/yq8xAGF16D8qEJlUGg0O9WOxQVVhIL7l0iZ6Zmko/lZxMD4uLo/kGB9Ncdu+2/+qnn+xn\r
- 9/+zpUuJJfHxhH9hofWYUkl94C5xFoMWo0h2AXoP7u/b9Hq6QSSiaaqqaGIOh1bJZtPyioroqVev0mNz\r
- cuhBGRl0j3Pn6D/FxNC/PnGCvu7oUfq7rq60Pzs5Ud/YtIny6kcf2T734Ye203+dntQ8DiEhVocyMuaQ\r
- fXC6GWi8n6LBPtyzdMvltHaJhGYSi2laNCsWCulV9fX0vLo6emp5OT36yhWaX2IizQUj+qOnJ+1bZ2fa\r
- BvyysPbLL+3e+ctfbF5bvnzOv6CHqS/qs+oz91eyCQ21dk5Pt+lDgxbcRo8aDLQR7EpDqAGUGdWFplsa\r
- Guga7KO8mhp68eXL1EunTlFjw8OpPp6e1J9x0dmyeTPli/Xr7T7CHeTKBQusFqIe/GX5MY0+9LKwMJt/\r
- pKbadWMXGNJo6NcrKmgNWVlUQVoapeDUKUpyWBgFv45R9u7ZY/8/339v9/mmTbZvenjY/y4+nuqIAHMR\r
- gIYAVASgIIAdAtiieWvU07b64Pvt22fzHoNh63v6NNUjIYGy48wZyufnz1PeTU6mvMVkUv7N25vy8q5d\r
- 9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="propertygrid_categorized">\r
- <value>Categorized</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABLtJREFUaEPtmWtoVEcUx+/efb9ujGAKtoKk1mekUgkV+1KkSH1QlYjUZ7C2FcUiVTAF\r
- BQWr9V0q0jaIQbSUBFrFKGpFUPCB+EA/aLW11EdbTW1Sq631k6fn3Oy4s3PP7p3s3phdMPBPZvfeu/P/\r
- zTkzZ2bjAwCjpH8IoJT1RMxjhEOdNUidAoCGN6HQs52e9Ku+ZADQ7LiUaTIua1pnQHgaATQcQf2UBaAN\r
- 3+/lNYTXAF9mMS8isbtoAdD4ZNX8K6/61TSi1x95CeFJBNBUd9SvMsCQl/xw92EZvDk6wEEM9QrCK4Dt\r
- 6ujvPxy3Ac7/kIREImMyE9CJogFAMzNV83VLw7Z5oS31US4Kn3oBUVAE0HhPVKsMMGx4e+qomjYzyEGM\r
- KRSiUIAmdfSPnEiwAL+1WtC70lQhfsbn44VA5A2AHX+gml++MsKaF9Fo2h3jotDwxAHQeB/UAxlgxKhA\r
- TvMCYuGiMAdRmy9EXhFA483q6J88x6cONx+qX3bUh/v4eZX5QHQYADtaqJpfs4FPnTv3LSCwU+cT0PbA\r
- ehwhmidMxd7X6QDYaZXa8Vtj+dRZvT4CZWXp9b9qsAm376YhVq6JcBBLOgrRoQig+UMyQCxm2IVKTZNN\r
- m1lzoK5QY8axVXpYRyC0AdB4nTr6n22JOsy3/mtBxTM+x+gGgwZcb0lHgKAvXk1Ct3LHvWc8B0Dj1ar5\r
- iTVBdtU5fobNb5hRy99f38BW6Y26EFoRQPPHZYDy7j64/IszdWhUv93jXOsty4Afr/P30zO174a4+fC2\r
- DoQrABpfoY7+V9ucqSPmwRdbnSNKE5ZbTsV7f9yz4IW+jip9A/std4PICYAf8LpqfuoMPhWEmeWfZE7g\r
- vv1M+POfzNznYHbtZav0zkIBzsoAzz7nc0xE1cz8DzPT4bvmmFaFps9ZXMdW6fdyQWSNABpfq47+9m/c\r
- zdRMSe86x47X217IgzDceYp7iD76ZYNgAfCB0ar52e+HtEbyjZHt24RwmK8RueYCXTt2ml3FvtcGwM79\r
- qEsyQOXzJrT87Z7HZKD/gPbJSOngZjbb9bUb2UK4lINwRAA736yOPm2Ddc3cvGPZ80Te++g+K983YRJ7\r
- AHpNhcgAQOMTVPPzFuilzo7GGNBB3jQN+wy8bEX+ESCQK9eS0KPCUaUvZAVA40nUNRlgUJWpNfKr1vF7\r
- n6s3sxcvnag07GSr9OcyxOMIoPGt6ujvOdD+zUIu0dygTZ36LFVr2k67Pe92fc5ctkrXCAgbAH/eUQ0s\r
- WqKXAr+3WfaKIz8fChlAKeVmTuf6X/9ZMHCQo0rfwv4qUt6NHviiRTYwtJr/ZiFbh427YkDr94tDTJg+\r
- K2gfYnTM6d7TfDDO7ZUaBcDX6ugfOuqeOrqde3Xfx8vYKj2P0scR/mTSABKtJkLxuAFClPNC0agBpEgk\r
- LUopIUonIToTCAUCBgj5/QaQaAUT8vkMEFI9Sq8fOQBy3MyFsevfS+VR1xtRMkF7IEsZwPaeAuiGxGUp\r
- WfhXiIqbUALbQnFsC8WwTYpKov/UCIWxLRTCtlAQ20IBbJNoHyZkYlvIh21bObcSboeHYrzueqQsRtPs\r
- VqLYjWqfB0oN5GkKdXXEnkagqyPwP76kA5sYKmTOAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABChJREFUaEPVmVuITVEYx5fLmXGdaTSa3Br3mDAeCIlxeRAiRBE6pWQy5dJMETURDZHL\r
- FHIrzYuEGCK5ZR4kxIMm5VqIcnkh0ZAs/2/sc2adddl77bP32efMqX9n5uy91/r/1rfWty67A+ectesP\r
- AbRntWvzrb0n7NZHd+wHzYaqoO3QPmgvVAuthqZDRWHVGwoADE2BDnZk7Dm+aVDZ6KEDOCoITCAAGIh3\r
- YuyRpWE3qGsUtXRA0gJAZTM7M0YtaNPSfu65gDLL/ID4BkAFu7yMTwTYKgidnqPz8z3QFmgFVG4HXWUL\r
- YQ0A0z3zGKNQa1t0MX4/D/2gvOChT7h+AprhDnPYBsIKAKZ75zP2WGc+DhNPLUyboJrw7CwzyGkvCE8A\r
- mI51YeyBbH4gKr0SwLgMdAxlYVzpotvgBuEJEGPsnGyeWuxziOYTMAgxH6GH2GGCcAWA8RrZ/MIMGBej\r
- 8d480OfpIIwAMD5SNl+RYfMJkFeop68aiRe+ANB1kFTa+mQB/n4dEQCBIN3pxkOtDKGNAIxPklv/ZITm\r
- E5GoViG+UzoXIbQAWNM0iABRdR05M9GcUqxCVLsCECH0VwRozELrJ2B2qgBPvACWi+aHZ9E8QXzUj4Ux\r
- CQilC8H8KRFgc5YBCGKOCrHBCID1zksR4HYOAOxXAc5oAWjZIGcfDPu2xVkRNlLxeDQqKUnWe1cFaDYB\r
- DBUBBsitX16O5yL6VFQkAb5o0qkJYIIIMC5HAGgcaBZ6ecqmHuanigDY6Kau7bMUAQJAbpdn5gIdQMoM\r
- jHDkDACW9DJAVx1AygJuSI4AfFPNt5jGQA85C/0RIWIxzktLo1F+fjL6tE+QfCVXpspEhnXQW/Hm+zkw\r
- DxxXARrdZuKzIkBdDgAsVQG2ugFUigDKQI4Y6Bfq66YCTHYD6C+PA5oJvY5KMnX9qGr+jed+AACXRYgl\r
- WQQoUwHqbADmy1G4mgUIHGvrtpWDPQFaJwjGmkQITBD8d4QQzagLGVEGOGK1J3YAcPKXWsDKiABo7qHk\r
- IdVP++E+1gAOxAEZgjbamRqwiXIX6LtOpWxeWUpob2DsngyBVy8ZgaAlw1y9eePxoufRIswPgz7IEHS8\r
- iK1baCB3UJYm41A3atI1rHEeMERhPArCviK1X2L7xncHhKDNykZ9q5N5OlQuDgzgjIexKOyZDEH/0zHg\r
- NggvyKwjAmd8HYQ9uC5V0m/XoUI381ZjICXnojVQKL0GMlXKR+PaGqgewo38FnQDwgKr9W0NZbJBLs87\r
- Zdd7GffVhZTU9f8V6lc3kDSvUYQX2Zr3HQEpGr1QGV5/sZ9pmhWj+A5l1PgxHigCEkh3VL4WwhGSr7eW\r
- Lbj/IrQsHeOhAUgwhTCEgzS2CcI+hF1ywG46Y+cQvtdD06COQYxnBCAMQ37L8JzI/BYY9f3/AJQMVypF\r
- n/EwAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABMNJREFUaEPtmW1o\r
- U1cYx5+mSZPcvHax6GTIGBNfPlUp6FBERIeonTCoyHBWOuyLVKE207UYCY3isszg2iTFpJ2hXW1ybReb\r
- tkq0nQhN04rECSW0VavWFtlg3YeBjK3b2TkdnV1y09x7d+dtsIHny3055/87z8t9zkkGQgjS+kcA0tnS\r
- WvxM9KTz6i8CLATvvT4hhEutdNkyWLtzJxw4ehQ+PXsWvnS5oKWhAXouXYLwsWPgEMMjjB7AYlWFhVBh\r
- s4H74kUINDXBYHs7TEaj8MfEBKDJyUQbHIQXGzfCerYQeA5q1SrIy8+HT8rK4JTJBE4837f19dBfWQmj\r
- +L6CzViMABYLhJ49YxbKJH72WnU12GcnxQIyly6Fd7Ztg4JDh+B4VRXYrFb4xuGA3sZGiAUCMHXvHvMc\r
- fX0wrdfD27wA8MRZHR3wfD6hye4NDMBPdXVwDYfV3dZWmAyHYfrpU+4LMTwMaMMGeJ8vgD4Ugl/4AAj5\r
- zu7dUMQXQNrWBj8KKYbPWCTs5gKQyFi5Upa7ejUY/nWdiRIn7WM+kwrxDsmLQECCSktlvSYTVXf+vCbg\r
- dmvv+v26511d+t9WrMhamxIAl8X7QohJNsaDB4Bu3MhAPl8mNhk2OfL7KWxqdOuWHj15sgRXukRratI9\r
- xp7ISAngdkPffwUgVSwSAXTligQLlM6I9PmU2FQoGNSioSEDo0gm4bPXnE5tT3zEMJZRpxOusQWIxQB1\r
- dUlQa6sUWxY2BTYK0bQG9fdno/Fx5tWcT2iyexaL2s0KwG4HPxOAz0eEyrDJsSmxqdH16zo0MsJ9NfkA\r
- FBcrP2MFcO4ceOIB7twBdPu2nrPb+QhleufhQwPavFmezwrg9GmwxwP4/RJBw4ErWDCo+xknsJYVgNEI\r
- 5niAy5dloq0+gfV4tFGmks+YxMXFUJkIoBAVwGZTt7EG2LcPDicCUKICGI2qL1gDkA5ybjdKPjwdHVpR\r
- AfbulZewBli3Dt4j9X3WC93dEjQ8/GpKJVNyRyLZ0/EtxD9tOyMVwFukJ58FIB8prlVDyOe93sQWIhUA\r
- FQzC1EsAuagAtbXq3mStddJNfUsLjL8EUIoKYDarGjgDeL0wRADIHph0iUKGBNexiooU1ZwBPB6IEADS\r
- UZKmjOukQj0/OsrcQsybA+QmPjIJEQCazsReEK6j5Ap29SpzC5ES4MIFaCMAZMPBdVIhn3e5NPfn2xsn\r
- TWJ8BPI1AfD7xW0hampUIV4AZjN89TeASlQPlJUpfbwATp4Ey8gIoO5ucVqIsTEDunlT/+uuXcwtRMoc\r
- OHIETnR2ShDZSAgZ03PHItvNcDh7urlZN4FjfcBqVbdXVVG1hYXKE1u2ZH1IUfBmqrOhpDmwfz+U0rQw\r
- LUQ0+safNK2bcrs139vtmk6TSV1fUqI4tWOH7OOcHHgXb1QkqYRy/g5s3w4f0TT7FiIWM+DTBt0Lr1c7\r
- 5nBoe86cUTWWl1M1e/YoDq9ZI1uPRcr5iuSVA3l5sJWcLsx1+aNHM3H5e3Oz5gePRx21WlV+o1H5eUGB\r
- vDw3V7oVi9T8HyJ5ASxfDksqKuSjTqfqO7OZch08qDy+aZP8Aywy51WL5AWwkEQuAixkb7w+f/ItVC8s\r
- ekBsz6S9B/4C+eG8h3vJrfkAAAAASUVORK5CYII=\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAABL5JREFUaEPVmX1olVUcx0+3ba6VDmP7w15w+TJ0rJc/EhuytuqP0Gz4UqhoDoLYcOAW\r
- TpQFW2KaKFZihbMg/CdCxTeU0VK2P0SdzD9CGlsrfGtg7Y81pFjiPH5/u7vee16fc577aHcXvmz3uec5\r
- 5/s5v3N+5zzneYRzzib0hwAmsia0+bHRE3XvYzg+DS2E6qAt0G5oF9QMfQC9Bk2Nqt1IAGCoHPqCsVgf\r
- /tKkctHFccDSdGDSAoCBasYe7XY0bINqo6iFAQkFgMbeYCyLetClp33KHEGdJT4g3gBo4NNg46/A9PtQ\r
- M7QL2gk1QWugF12A6lwhnAFgejJjORRqg4F3cP0w9M9YarDrT/z+DfS6DeYrFwgnAJguZGzSJb35apj4\r
- xcG0CaoT975pAvk+CCIQAKazGcvtUs0XodGTaRiXgVpRV5YO5IANwgEg+5Bqnnrsr0DzM2ZwvnEj5ytW\r
- BA2pxO+XUOccHcRWE4QVAMYbVfNLA43T+C8q4nx4GM2Of/budYX4wzTR39ZBGAFgfK5qvsLJPAHU1yfN\r
- 039DQ64AVO436Ck5Er96AmQfFgGmoMLfnQEWLxYBurt9AKhsm24oNcsQ2gjAeJna+986m0+k0G3bOB8Y\r
- 4Pz8ec5LsWEITq9ymQ0yxC1K56kQBoDYARHAfej4m7SB0ZpSIENssALEFyx2VwQ4FqL3wvS47p5PZICf\r
- gwBWi+aL/0fzBHRTNxdeSEAoQwjmvxMBNnsDlJVxXlGhV2FhmMgskiEaLAA5/SLAGS+Aqiox+8jfenvD\r
- AHwmA/ygBYhvG+TN2i0vgAULOB8dNUN0dIQBOCsDXDYBzBIBnvUyn8hAxcWcL1/O+eBgEqS1lfPKSs6z\r
- ssIADCrp1AQwXwR4ORRAAuTKlSRATU0Y46n3KBu9HIIQJjHMvyoClGcQwGQ5ClN0ANIKPD+DAHJlgMd0\r
- ANIGbmaGAAzL5kdMc+AJNQvdCQ0R3Ryg5wQhO97fmWoWstg1sfCFDADYLwMcs63EB0WA7RkAsFIG+MgG\r
- UCsChJ/I0Qyh/2A+TwbAchk/lNbthZ5R5wGthP55PBqAfbL5qw7PA+yECPGuM0BuLufTp8d140ZyIWtq\r
- il8rKPDtiBIZYLsLQJUahVNOEO3t9s0c7ZNoS+EW0d2yefqOs47kOw3bQ32nCDEXN98ObLinxw5Av65d\r
- 6wJwGW3FZICvU81r58D9yYFzPzUK7wUClJdz3tJiVgN28nl5QQC09lDyEHI/PQ9PcwYYo2PscxWCHrSD\r
- DKT7+xLd0KmVzVsjkBKJcypE3QOCoC3DWzrzxuNFh6NFNhsAAyoEHS/2RwjSgbqUjEMwnbqeN64D2jAx\r
- Ng8VDaoQ2WhgR5oQ9LDyoa7X6RodKiPxmt+kBkYgZSi9hMp6VQiaaHQM+DHU5wHThbLroRyT+R/RVr7N\r
- vNMcEHIuegOV0msgU6O4/jxUA+2BjkCnoXboIERvayiTPWe5f6zuPUHGvYaQkrrir1D/toOEen9GEV7m\r
- at47AlI0nkRjO6F/IwC5jjoafYynFQEJ5HE0vg464wkygvJHoVVhjEcGIMHkw9AiaBO0Hzo+DvbT+Nz5\r
- En/roUoolo7xBwIQhSHfOpzTqG/FD6v8PRJO78MpB02PAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="Cancel">\r
- <value>Cancel</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAGVJREFUOE9jPHDg\r
- wH8GIoCjoyMjsrL9+/dD9IEMoATDDQCaBTKRaAyzFMUAYl0CsginATBXQMMGw0Uw8VEXIAUiIyMjOCaQ\r
- Q5ZQbKDEAroBJMcCVV1AVkqEuYCQv3HJUy8zkesCAKyXZMNS2ukhAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAADftJREFUaEPVmntY\r
- 1FUax0efbbtaarr12D5bu6WbopZ5SVs1a3fV2rQsUcu8FJqlKCZkF9t1H7VUFBQVCXVFzTIIROU+DJoK\r
- iCggKgjC3JgZ5sZlbiAzot993zMMgjLjpT/W5Xk+npnf5Zz3e8573vOeM3YaGG0ddv89nX7fWSLpJKG/\r
- zuJf91+nTq3XWq/SffdntHtOfGm91/bdlnrb1t2J/q4CpvT3usiu1XKHn+YkNRwuNV2GN0qMLvjivNEJ\r
- X5wzONERX2VZry5IdWwCIPk1SIIyGjKuXr0Kb1y5cgU3o7m5Gd64fPkyOiK+xAGZvOkKiVj1fyuAheVr\r
- m5oDUx1L71TE/3QEWICLKDU2XZmb5PjoTkTcVAC71q9xIXYtby7kEWBpdOKIvKF59kGH/+2KuGsElOjt\r
- iCu2Xp6e6Bh3OyLuCgHWRop0JEBWVoetefUu/3j78FsVcXcIuORCqYEElNfh+1NGfHu4pum1H+39bkXE\r
- XSUgq0VAaFYVlqaaGl+KsT15MxF3rYCQAwp8ctBo/9Nma09fIv5nAgp1jQjKuCxYlOHCwnQXAltYQOWC\r
- NDcTfrLuvSsFcAiVKZoFmfLLXnk3wb7zjgV44r+vVMFbnG8b+10uF3zhdDrREY2XmvDefvsOnwIWptmk\r
- 3vIVz/U7NcBjVFNTE3xx6dIlNDY23oC9oRHT99u3+xaQapV664HbMcCbEWxYQ0ODTxwOBzrCYm/AjET7\r
- Np8CApPrpdw4s7vYgJAs1TVkSoTcAsGZCtyMT9MrMG1DHEbODsbgie/Db9RYPP3cMPiNHIshE6Zj1Owl\r
- eC98H/YUqGGz2QS1FjtmHrBH+xQw/1BNpsPRQD3gHbvdAV/YbHZqsGNyc09gypSpeLT7oxj8wmAsXvwp\r
- wsPC8eOP+5CeniHK8PANWLIkGEOGDEX3bt0xebI/jh49BlOdDbNuKuBgTaYvA/ie1WrzicViRX19ewoK\r
- ivDOO5Px5B+exLrQdSgpKYXRaLoppaUXhKCnnvojJkx8C6+vztzncwQ+OWDOtFhsYOKKqxF6XIV1zDEF\r
- wo4rEZ5NcHlcgQ1UbqTvETkqQolNxOZcFSJPEFRupTKK+GD5BvTo+RhWrFyFqiqNMFqvNyA5OQVBixbj\r
- r6/+Fc8/9zx69+6N5wY+h1fGvIp5H32M+PgE6HTV4nmtVofVq9egW/eernt/e6/XVFvy8X6jrLbWAqZS\r
- V4PzVTU4pzbjLFGsMhFmFClNKFQaUaAw4jRxisiXG3CSyKs0ILfCgJyLBhy9oMXUmXPRt28/nDyZ39rb\r
- UVFR8OvXHwEfBiAxMREqlUpEnK+//lpEJ7VajaSkJMz/ZD4G9B+AVatWCcEs5PTpAvR+prf9kYcf2UXb\r
- 8d9cPxqSefH6LLO5Hr4wmergC4OhBsycOXMxbux4KJUq0fiZM8UYP+41zJo5i9433bAW8ES9PkTztc9C\r
- luKlES8hOztH1KNWV2Hs2HENJOL7GwR89LM+y2isowfroNbVQqGtcaMxQ0WlmkZFrTNDrTWjikptdQ10\r
- AjOqqdTra6g0Y+WKbzBo0AvUu2rRaHh4uHCTtLQ0n4tYR2vMkSNHkJCQgBHDR4hRqq7WC1ccOGCg/YH7\r
- H1jWVoRkbmx1FhvCbCP//jylDEuJz5LLEJx0AcHJF7DkUCmW0OdPqVx86AKCDpZiEbHwQCkCiSnr4/G7\r
- x5/A+XPnhfHr1q2HP0WS+vr62zbeYrHgiSeeQGlpqQjtn1LUWrp0qaiXJ3iPR3vYyZVGeERI5v6kO6yl\r
- 3vWFRmOCL14cNgJRUd+JRjhsDnp+EAUFy20bz6MREBCAwMDA1nd5joweNRqpqWmi/pidMXi4y8PnSUQn\r
- FiGZs093WK1mP/OOSmUk1+iY6O9iyOAXaA4YRQQZNnQY8vLy7sj42NhY9O/fXyxibV3r4sWLwh0VCqUQ\r
- QZHLSgLeFQICftAeVlKEYWRnNEg6VYVk5nQVUgsILok0+pxOZBDSwipkFmqQWaTBsBGjsWf3HlFxMC1G\r
- Kyl03ix34vtOpwd3IieXy9GrVy8UFRWJe9fXsWPHDsx4f4ZoJzY2Dt26disSAj78XnNELjdSBUbspTi/\r
- RVaJzbIKbCIiiI2ZFQiXXkRYRjnCqFyfXo7QtHKsTS3Hv2Lz0KVLVzHBuHe4l3jIfWeeLnrGiaZLTvJx\r
- Ll2UJ7ndZEP4xpZrdJ2euV7Iy6NfRn7+KTHSDz34UCONQk/JB3s0Ry5SDPdFebkeHbF69Ua89eYk0Svb\r
- tm3HV19+5dV4NoaNYqMvkdGNtJFvaCAcLiz/1wqMH/+6+MzX+B4/wyKdbYRERkZixYoVor23J73d0LlT\r
- 5zmS2bs0v5SVGeCLCxf06Ig5AQsofK4UFU6bOs2r77caT+c/wnAy1G5zwmZxIkuWTVHn96is0MJa777G\r
- 9/gZIYTeYeE8qlqtFjwK3N7ataHo+kjXbZJZMZpfSksNFKIM+OGoEttlcuyQKbAzy02MQI5dVO6mUnBY\r
- jj3EqL9NxE6KClzh8BeHdxg2Pca7XcVtuJWMLDmvwI7teymdeBY/x6agxuRCrdmFuloXLPUuIcRhJ8H0\r
- DovwuFN/v/6iPZ53PXv0lEpm7tQcPXdOD+bHI0r8J5MEENuJbVI5ojPk+C69kpBja1olIoktqRXYQuWz\r
- A4aKjJIrpEWmQ/cRbsM932K8hXq5WmfDM0/3xqwZs/GP197CsV/O4vTJSpSc1UEpp1Xf0IR6EsIjwoL5\r
- XY8Azp24Pak0kzPcEsmMHVVHi4v18MWZM3pKC25k8ODhrQIoX0FISIjIcTyTWPQ++zy5AvcmG1RX40JB\r
- fjlG/WW0iDh+/QYiInw31nwTheX/DMMXS1ciaOEXFO9j3SLESNC5ES1iXD/nSpwnZWRIeVE7L5mxXXOs\r
- qMhAlXmnsFAPpqCgug16vDZ+EnbF7BI9MmTwELHrahuBeAJy77M/26xO1Ne5YKbfG/QaJ+bPC4Zf34GI\r
- 2Z6M8nNOQUWpE8oK8nWlCwatEzX0rIXesdO7TU3u0Opxod27dqMHu9D70Zpjp08bKOsz4D/pKmxJkiMy\r
- WYGodpAb0ffoZHKrFAW2p7p53X8evv12tRAw4Y0JYvlv1/tCAPe+2x3Yx43VTuhULigvuoTRJYUunD1J\r
- 5NPxYoETF887oWIRaidMeveI8SjwaPLqzh3F7a1ZsxaU3G2TTP9Oeyw/30Dx1YCYNMrpk5SIJLYwhyjf\r
- P6hAxAE5ocDGRDk2EOGJlYQc7y5ahzcmvCUq5Nw9LCysQwF2ch9LHfUoTVQ99WyVwoVK6m02uDDXhbwj\r
- Tpz8xYkzeeQqZ2hRK3NBw6Ogc4vmCc0dExcXJ3Ijbm/SpLcdtA58IHlvq/Z4Xp6RQqB3TpwwgMnNbU96\r
- ehn1QleR7p49ew5jXh7TsQCaiK0CyH2q5C5UlLh7/3S2C9lSJ3JlbjGlhSTggrOdgAaHW8BU2ppy0ODN\r
- zoMPPMgLWQ/Ju5Ha4zk5RvgiO9tAuXnHDH9xjEiwuFfenPim2LB4UgV3BHJPYI4+3Jvs29y78jKn6G12\r
- nwISUZBDbnTKhbKzTijKXcLN2N34Pa4vOzsbI/8yUrTD++hu3boXilRi2hZd9vHjJjBrYpVYG6tCKJXr\r
- 4mhbSaz/maAyLI62lfQ5PF6FDS1EUBnwWTT6USThZI4jBe+8eMHhRt0rr3vhYjdgf2a/1pF/qytpFMiN\r
- yordrlRCPc/Gc+/zCFVXkWByOfZ9Tss5TeE0ggX49fOztSZz0zZXZx89aqZTADMiE6oQuV+DzVRuiid+\r
- dpcbqQyPVSOshfVUrv9JjdCfSCyVffxeRETEptbeGT9ufMsouFOHa2sALVZklJF8myepmgxV0GTm0WB4\r
- YvP8YIFGEtpIEUyk2LQV9dQfHb3tapeHulxLp6dG6HMOHzbDTU2HZGWZ4YuoKBkef6yX2EJyD334QQBC\r
- Q0NF710/ChwWeTKze1TTfNCpKeKQu7DLsOEcYuvI1Xjk2HhOsSdOmCjq5Q0TLV7tNzRTNhpyZLJa+CIz\r
- swa+kErNCApaR0M7QGSlvK2cTEcqDGeOIoHjHIjCKbsSpwrsThznTfQ7sonEsGvxd54vbDi7TeCCQIz9\r
- +1jK08pFnXRYYL/vvvuD220p/cONOVJpHS3N7cnIqKPVzk16eq1P0tJqae9bC3//QIpEr1JqrhA9tnfv\r
- D2Ll5MXOSQsRC2mbD/EEFSutjefJtXyHTyjY5z1uw4cEY8a84qCd2A3npJLJYabctLR6MsA7qan1tKXz\r
- TkpKHZikpBpM8Q/C00/3oaiWK0RUVsoxc8ZMcRa0Z8+e1tMJdi+ZTNYadmtra4W7vPP2O3jjH2+IsMzv\r
- 5+WdxFNPPmUn46No4na+4VRi8vqa3JQUKxngneRkCx1KeScpqZ6Mt7Ty+ecxlCk+jmXL/tl6SnHs2HH6\r
- vkycNLxApxejRo5C32f7ivSY99BD6VgxJDhEJGmeo5Tly/+Nrt0edd7zm3tmeDudk0z9wbpsXrwt8eN4\r
- 2wHi4CdMgu0QMz/BlsQsSLAlB+63pbSQunC/LXVhoi2NyvRFTKItPchNxuJEm3TxAZv0/Y0nsvsMHWvq\r
- 0fPx5pUrv7laXHxWGOZBoVCIw6+Kisp218/RRF397Rr87rFeV/487O9107+MmOnzaPFmP6L92vs07ANp\r
- 47GPVk4LZazWBQsCmzmP4cXv4MFDYn7w98DAhc19+vzZQuc+Vno+lt4bdCtt/6r/KXIrDXie4WMQYght\r
- A0Mojm+lcJhC5NNpdCp9j6Lrn9H9YZ7jklut+7/JKVwBwotNkwAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="Abort">\r
- <value>Abort</value>\r
- </data>\r
- <data name="OK">\r
- <value>OK</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAChxJREFUWEfNmPl3\r
- lPUVxmvX32p/6p/gsdqqgCxCIlpwqxU3IgWDtaBAlYTsxEjAEFBCksmiEEDBgBANmx7coIh7gklm35dk\r
- 9n3L7DOJTZ4+b0LSOTXIkNPT05zznPedmTfJJ/fe5977zQ0AfvJ/+SWA/afmzll4+4svVB4sKqruKC6m\r
- tlR3bCmhSqs7SgSVUeXVHaWCKqo7yiqpquqO8q1X14MPP9w40++62ns/gBIeXLggf63FnIbXA/h8gD8A\r
- BIJAMAyEIkA4SsWB4SQQSQHRDBAbBeLfA4kxavyH2lxRO7Z02f3HcoW7Kph5MA2PC/+G82fBDRNwCi6R\r
- BTdydbiG/Wewq+3s94uX/nF3LnAzgi2Yn7/WbEzD7cR/Da626TSOXgLKtu9PL1qc//y14K4KNqRPw2UH\r
- 3I4sOC/TOhW5EFN7jcjFs9JaVHcKO44DnZ8B6za/Eps3f/6yH4ObEWz+nXmFJm0KLityh4ux5qbSmmbN\r
- XUlr/J+T9VZYcRIFTGLtUeDIhXE88XRR6Kabb77puop//ry8QqMmBacZcF4DLpAduRngYjSEALemrBs3\r
- M4ErdwE1nUDHxyN4YMUz7l/feONvZoKbOWICmCoFxyDgmIKzZaXVTbdOpVVw7BSc4NgpODo2eiVygmMr\r
- 6jvxl9JurC47iU21p1G15wyqXz2Ce5c9NJA72Ny8QoMiBbuJYDnATbSTH4GLMq0T7eRKWrPbyR5RS2/O\r
- YHfOWbJGJ03CZgB+KzdgpdqNzboAKg0h1BjCqDYGUWrwY73Rhwe0dtyvc+BBnR3PDvlQbg2h1h5GvSOM\r
- bfYgSmx+rDa78SeTfUIFFhc8349N97oGUcvl6wLTipOw6oDfKczYoglgpz6CRkMELcYIRINR7DEN42UC\r
- bjB48Te9B88ZPaixhLDXFkG7PYIDzihed0XQ4BpGlT2AjVYv/m7zotThh390fLoR721p/S5nsHmMmGYg\r
- CYsGaFVHcVAbxzFDEu9QXaYkTlDHTQm8bY6jfZCw5gjaqKP2BN5zJXHKncJZ6pSbr718zhNDhzuCDm8E\r
- b/miCIyMT6aV7aSxra0vd7A7lqxR9yVhVgF5SjueVHvxoiaIrbphbNOFUaMLoVwfxLN6H5ZrHLhbY8cy\r
- ar3Jj/KhEHZYwqizMpVMa7E5gKdMbtxncGC50Y7Hh9xwpsama66xtf36wFSXkxhSAu8rUzivGsHn2lF8\r
- rhM0gi/0GXxp4pU6P5TGec7VC5Y0vnaM4FvnKHpcGVx2p3HZw6tvFF9507joT+FiIIUvQmkEBcdema8E\r
- y92Vc29fslrRk8CgHJgns+BhpQvrlH4Uq4MoZ+TKtUFsZt2tUnsYURsWKC3IU1mxlvX2gokmGQyhajDI\r
- awAbhvxYYXAiX2tFnsaCh4wO2GJj08O/sfX16wOTf5OASQpskvtQIw+hURVFuzqGfaoY3tDE0K6L4lWm\r
- tlzjR5HOhzKdH3tpiPYh1qQ5hkOWGA5aaQAbn2Nqq5nSlyx+1NmC8MTGp6dEU+sb4pxrbO5tS1bLvkrA\r
- yG+ploWwW04nKqOEiuOgJoH9BNyvjaFZG8UObYh1F0SdPox2YxQdQ3G8SVMcpo5Y4uiw8jnLMF6xBFFP\r
- 1zbah+GKjE+uTRxhTa37JDmDzSGY9MsEDP0sfpkNTyo82KQIoko5jBpVGC+pQqig1tIUy2iOfJUN96kc\r
- WMeolbHXbTOFUUttM4VQxNQWGNw0iA33am0ooBGsobHJtYlToqllH/Pyw2V1xpE05w+LV4kvxaGnX84O\r
- pPGxOIML0lF8Jh+Z0CXVKC5qRvCJOo0PtEl8oEvhnJ7FbcrgkmAK8yi+NGfwjYWFb+V79gw+cdBEjiQ+\r
- d2fgyZqvzS0dspzB7vj94lUDF+PQsSffKbXiEbkbz8rZCuRhlCtCKFMGsZFmeIqRvFthxwKFFUsZuUIN\r
- 2wrTWsW0VhnYXhi9DWwpj+pcWKRm8VOPGVww+8amR1iz6DrB+i/Eoe0BqgZYGwOsMTGLWprAQUkch2QJ\r
- dMhiaFNEUa8MYwfTuksdxj7W3WF9nI04ManBBA6ZomgzRVDPtL7K9Lax3py+8cl1nZFrFh1QXFfE+s/H\r
- ofkGeF7sQ8VACHUEa5LG0CiJYq+UQLIItjOCRYzkJqUPxaoAdmjC2KPlJKBjRVQrR9geA0cXo/eiwYdS\r
- ox/b2EosboJx4RTgmppnA/Y1cJfYisclLH4JUyMdxkvUVmkYm2UBFMo8WCazI09uw3KFA39V8Zezz9Wy\r
- jWzXsvg5JV6gIQo0LtwtGERtx0qmdcg1NrE2CQedZtEhtvEci/+OW+8q6D8fg4Zgx3s4+3oz+KB3BB9d\r
- HsWHfWl81D+CczTFOUkGp6UpdMuTOM016WP1CD6lLtAYF7UZXOSEOG9g4ZvSeJ/z9dxgCv/ghHByXfdy\r
- p/MSrrn5EAffLMAWSGz4s8SN9eIASsVhlFGlYha1JIDVMi/yGbGFjNhSRmwNI1aiDqGS9VapYUth9Naz\r
- pazQuHEXI3YPI/ao1gWjbQweHnQEuOamN9WzAnutl2tML5tmbxKdvQkc4ww99l0CR/oTeKs/PmGKvRKa\r
- g3X3pjyBE5ytXYoE3lUn8S6bcaeGZqEpWnURvKHnM4YYLNZxuHnQEeBEzW9xh5lFxFb1e7BxIICqfrqv\r
- LzKh7f0RbOXrUjr2abEHq6QePCP1oljO+lJG8IpiGDtV3ETo1irO1w1qHwpUbqymNmp9MJjH4BJWdcKJ\r
- mg5rcwa7/dZFK/s+jU7U2HKxA0+JvdhMZ1b1sfivqJhQ6+jY+/n5vVIHHpG5sJFgNYTaTtVxSrzMVlKi\r
- pElUXjygdOAhpRNPc/DrB8fgtPAExoOOqPEw19EcI5YN1sniP9GTwkka4HRPBmd7RnCG15NUd28anZe5\r
- CDKt7/TTJBIaQkpjSDP4UJHBOUGqDE6pUzjBtHZpEzjDKWE2jsMxxBMY4USNb88OLF/iwAqm6jm2iy0D\r
- YVT0D6OkP4Tn+7n2MJJLxDYskthxj8yJQva0LRz6lexvldxIShjBDQo/HlO6sZgTQtBjTKfGMDZ50CEc\r
- wXiymEXEDnIv62Thd/WyLfSk0f1tGu99ywjw/hijeaAnjgOM2iHqeB+fYRs5Q52WcL2W8cp2cpzt5LAy\r
- MaEummJQNz5x0BHgRHs7cwe77ZaFT3z3SWSixnKVllNCGGHCfNXzeCFsJsLaZOJSM8gxPcTBI2zEZjYH\r
- C8tdOOgIcKKGTmPOEZsN2MQfcA24wRngRA1HGbccUzlrsFnAifYc45H6fwGWDccz9nRaudkLaTUxrcJZ\r
- YiqtBKMFcgS75aZ5jzbUHve1737fK6ht11lPtlrrz3im1LLzlHtKorqT7mnt5P3ObpeovtvVsovX3e+5\r
- WgS9JqjLKai1ocu56snn9DmD8Z/FN1C/ytIveZ+tX/D1lH7O+yn9jPfZ+ilfT0n4mRO61j/thM//BR1x\r
- NCLR9Yu7AAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD31JREFUaEPVmQdY\r
- VHe6xvFe9+59dJPsJttMTNas2WQfs4nuborGGzVmLdHYwIKiG0VAI6BIH5A6dJDelCkgRXrvvXcQaYJU\r
- UXoRLAgMzHu/cxRkaJZr7j7L87xMOTPnvL//+/2/859zFgGQ+rf+YwD+nfWTm9/p2fTWWk7c5x+f4v+w\r
- +ke+7V9VfGLWnA8t/VQrtv5TrbiWT7TiOz7WiO1b/flXx15mIF8KQFDQ958eOb3L9P2KvlKyDVdQtA11\r
- UrwYmXDaJaVcyS2jTskts1nBNevOSdesHiWX1AHNS6n3nMKLxyILGlB9ewiDw+MQizGlkZFRrF+/Xuf/\r
- DNBzX/Tft++OrsipaNzkF5PxozA81Z0fkZFyJb7omjC+pJYXV9J0Obb0tkdUcbdbWE6fV2TOvcjMClFx\r
- zS103h3GqEgsYWzS5NiYCM3NLUhLS4e3tw94PP6UzM0t2O9s3LjR5KUACgoKLlbV3Gi6VlnbVlRe1ZWe\r
- W9SbllM4VFJRI2pu68TDR2OYmJjb2KRBZntHRyfy8vLh7x8APl/AijHq5cWHUOiD1NR0FkIkkhx9Hk/A\r
- Amzbts3ypQDS09O9Ozq7MD6BBdXXfxclpeUICQkDjzHHGnxsVCAQIi4uAbW1NzA8/GjOFKaXzPTnzPeJ\r
- H7t377Z7KYDExESlkrKKMRpoVNc2ICIqjsx5w4svpEcSTwg+GQwLi0B5eQUGB4deyOB8xiffZwZiRATI\r
- 7D/o8lIA1dXVq5NS0gfvjQBGxlx0dnW/UoPPArjsJQBz7O+OHLvxmzV/k6Nz0pIXAZFqbGxcmpSS1tP/\r
- EHD14OERjQYzIqPjwBhJ9KS0mJifZeZltntRGTLHPukpEKs0d4p3efBavlbXjl2143vz1377u0+eBcO2\r
- 0dj4xDud9wB7Vx6GHoEdkfukB6PAQ9IwlRejnwLOi0q0i4592kMg5g5DbENTyInkPjwu1s/Mvy9rZlm6\r
- 5aSS4MPPPj9O6bw2E4gFCA4Nb2i7C9g689D7AKz6aFSYkRkYBqhDYpDA5oNj5g+bGolJ7UWS8/bxQ3Pv\r
- GFQJwJ6Mu5F4IxD7koJHIY4iJY5BHN3dLzb09m2T5+jH/2PvPsvfv7P8M3YZxPzzueJX1dQH2Ln5oJV2\r
- 1j4EdJCYVJjR6b4P9JBYMBILRmLAXhSOuijb7SZITMkFh4SjomUQ590F4ktk2pt0lUyHk+LIeCopRwRx\r
- CamSOnCdaEJsLfAZfvvbPb3/9dcNoSyAg5NzakXrfVyJyEBmWRNa+oHWAeAWiUnmNunOINDOaCG450iN\r
- LctpJRkVm4jsqg6cd/SEP5kOJcWQksl4FqmQjF8jCVLSRWsOnej6hZx6h5RDygOpbDGkpJUDWABTrplN\r
- bNZ1JBa3QBiahvoe4GbvYzVQMo2kJoJqJrUQFAtHUCwcQbFwc4CxyT2jJBNSsxFf2IRT5/RH9x0+cWeX\r
- vFIPr7xyPI9Mh1bfEK//56neX8qe7ZAyCRqUyhiDVA4ZnpS0ylUWwMjIaO8l34jholYRuI4+qOwEqkjV\r
- XUANqbYbuEGqI7BJuAaCY8FIDNiLwk2WZEp2KYJTq2Bq40UnwiHk5DSAo2fTu2H73p5FWp79Ukn3JU1P\r
- B5BRDWQBeDzeO9aOngOFtwADWz5KbwNld4By0rV2oIJ0vQOoJLFgLwg3V0lOJpdZXAthdBGMbXgswKTO\r
- apr1SIw2Y5zK5meuWfilggmkMkSQ2n82iAVwdnZexLWy785pBjhWfOS3AgUkBqiIURtQTCohsOeBY1Mj\r
- sak9I7ncila4BWXCcAGA/whsxFu6Xlil54UDYfVYa34VUqmPGIDgqeW0nqHZrfRGQMuSjwx6zGwCskjZ\r
- BMWA5bYAeaSZcCwYaRKMTY4SY5OjxNjkFijJfKpPa3489KzmTuC36i7Y4p4KxZIJHM8ahEzAtacAB849\r
- BVDT1K1PqgfULQRgHpNvAimk1AYgjcTAzQRj4QiKhaPEWDhKjE3uOVJj4Aob78PIJRS6NHBzldAHF4Q4\r
- FHETGwx42GTsjb/p8/A7NSdIZU1A6oBayFQCCqeVy6KqxqBh44eI66OIrQXibgDxpIQ6IJERgT0v3Fyp\r
- zQVXfGsCWja+0LKYAaDBZefASiqbb1wS8D7nMpaahUAq5eHTSX1Q7fF5gNEB2aMhvKRGmPlkwy22AWFV\r
- QDgpohqIJEXVANGkGAKbC44FI7GpPSO5mXDqlj7QsPBGTc3g00n8BODnNnFYFH5n7k508HzYFMD273Zo\r
- GLpFit2TboPjmYKr14DACiCIFHwdCCGFVgJhJBaMxIK9BBxTkil1IriFFEDTSggDzyRo2wWirKxzFsCs\r
- TkSpLAppfdyFDqmHPwXYvn2dgob5/SulE1A09oFPKXCF5FsG+JH8y4EAEgM2C46gWLgFUoupnoBTWDnO\r
- 0Ugrc4VQNveFXXgdu19GGrYhyM9vmQJQfZLAFED8XbxuFICVVEqrFAwhFdnJAERMAUhLSy/d/88z/cIS\r
- 4LiBEF5FAI9RMcAnCeh9Zps3QbFwBMXCPTFAzWEWmH1ELc6YXcEpEyGUTHxgGlABQbGY3Q+/aAKGgnyo\r
- Gl2GtoknHFyuSpTQJMDP3fOwXOcS1loEQT73AZTomN/SnGABZDWfAjDzYIe0XOelQuAYzXzXPMAtH3An\r
- eRQAniRm22XSJBwLRmLBSLZRzVDi+kPeQIATNAgcfiE888bZ7zCyiW2Hipk/1IwuwcDsMqKjiyU6z/Qu\r
- pKph2suM/grywpjeH1zFdqKdHin4VO0i/Qbog9ThGQCbtu1pYYwf4Qhhnw04kBxpJ04k51zAhcSCkRgw\r
- y+h2KJgG4Zi+AMf0BFBzzYRT5ii7nZEzrcY0XNNwxuAytIw94e4ZTj9Lu+Y1PR/AkdhWbKCy/ojK51cc\r
- PhaFtT2e1Ee0oiSuC32xfnMNY/qQjhBW6YB1Bo0ayTbzsUxj+nDCLByyOgLI6gpwyi4JVkkPWNBJ6QU2\r
- YI+KGz7ba4Jz2jZITq58LsPTzTPPVdUfJ/CWih1+T2fhxbzS2Z3oiLYkwKrVn2ebRPXh8IWrMIgfgX7U\r
- EI6ZxUJaS4D92gL8YB4Nk5i7sCGYSZknDUPOOHx4vazF+AdbbPHG5gy8tncUr22rh7IyR5yUVCGeae55\r
- Xk8CzNWFpt47oh0tkcCKlX/2ULRLwVl+DXaqukHWMBSc0G6Yp0FCZ/lVY9sUrdp2HdMe+Pjrkw+XSbdj\r
- udyEpPbWIDGxgq4LRcLIyAFcrut4UdHt507juQDkdGIkAN588025bQoWY0bJgPE06UYM4aCe39j3ikYj\r
- MkoaY2ZuHhMZdXVw9vKH3Gl78SrFcczUhwcr6EpczZThkpJ22NsLoa9vI3Zx8RdVVfUvCKNy3rRvwdFn\r
- 5oCMSpIEwOuvv/7Hv2yQGeLEi3HCsXBit+rFcWVzD1gLA2id04qawUEJCcNioMflY91Z0SytOVIk3rJz\r
- d5uRseNAVdWAhFkGzNzcDZqapqLg4MzxuUpqXgD/OqzYp9j3P1v39Ur9+p2tEgDL3n33vZWfrh06Z+GM\r
- 0Ny8WYZnAvhEx8HK3hfbdMZmadOpYmTdvAknX9/732zbkX327IXy1NQq0UyzQUEZTCrQ0bEYSU+vm5ov\r
- yudNniaQOY5fnLa4t+nQqQ6uhcdARUUPXRGMekBXKVZMAXy2fv1WjpVVw0yT872uHBhAbPk1uhjmCBmD\r
- IRwwGZXQTpU8pNfXg/1cSen49n37rnz44SdHDx9WCLe39+6cWUKVlf3w8AjBuXOGYzRfHskraT+UulQ4\r
- /mdphW75M5wu6mZP4W+PSAKsWr16h1tg4N1nma/o70dJTw/yOzqQfecO0qisuBau2HkqGidtRiQkcz4L\r
- 0ZWV7OcKOjuR1dyMnQcOxDEnzCVLlizbuPE7a+pSxQkJ5aMzUymk9biCsh6+3ys3UF19d9ZcqWoephJ0\r
- 76cE3mUTkFNSKlnIPGO8uLsbOazpW0hsakJM/U1E3LgBF14IpOVtoO76SEJHtVPhX1KCGCoj5vPpt27B\r
- LzNzfM3atbKTK2AysOijj1btOXhQPsjGxquNKY3pMPLyZ9unvy4t7YCJiXODtPRRwYoVH6xnrwvR36/t\r
- +ILR+QDKenvZEWcMJDQ2IZK6T3B1NfwqKuBdVgbry/5QVLeHMX9YQif1E3ApNxf+FdcRQp+PqqtnQbbJ\r
- 7E+c63Ih+Xjr66+3mP74o25uTEzRI8b4JEBgYPo9JSWNtC+/3KBJn1s6/ftSixcv/ktAcop4LgDGfB6Z\r
- Z0olroF+I9TUsoYEpaW0PiqkJUYu9Fy8oGHoAvurDyV0xjgGF9PS4FlYCGFpGQKuX0d4bS2kj5+gXw0L\r
- 35d7//0/bdm//wffr77a3Lxnz2H+8uUrvpjvO0wCSzmW1qKZANepbAqpdjNutSG+sZE9OGOeT2XhSjcy\r
- LmZmwjwlFWdsHWFkdQn8yAcSOm8aDm5iIuyzsmjdlE+r2VL4XbuGb7/fS78gXt2NRXYOyMge6ynv6pJo\r
- m8zo57a3I6WlBdHUTYKqqtiS8SgoIFPZrHmDuHgouLmDY2SP4MQhhNA1nElpmwfDIDYOlqlpcMzOoZVs\r
- IdRt7PHl2k0vdR9g3gSYDevWfeOoY2hOl1KenqxKqdswkzaZukcU1X1gZRVbCu75BTT6WTBLToE+GTwX\r
- HEILLyO4C/ORlHMPkcmd0LW6gh/0LVlABpQBVrvoCMUzmv3Llr373itPgLmpICsrn2ls7ojI3Hw2iXKm\r
- /imB1JZWtpMwE9envJwdSWZErai+jalEODExOKFvin2yilA2dcRRrjXUQ8OgFxsLk0RaraakQIFjBDsH\r
- 7webN+/Qe5Xm2S40raUtoQkT4uDkPcF1cEVUYRGKqKwy29rY7sG0zKvU15kUPNkJnAOb9Aw2CQZENyIC\r
- F2jEDeMTWOPGlI6SuRVU9c1ga8vvXLt246lXbV4C4ElPXbR1624HX9+EQf+AZJhau8LUyR3BBBNPXSjy\r
- Rh07F67QGZhXXMLOB2dqlQ5UIkxZWSYlQcXBGWcucGFq5Y709Fpa73Br1qz54tufwvwsgMmDvP32u2t2\r
- 7TroyeFYVZMJscA7GlZ2l8G1caeO4wyOpQM0zW2hybWFDvci9Kn0jCxcYEcXhpOTr9O94Nh7Cgrn09at\r
- 26Qz112VVwkjsZibuWM6+OK//33diePHVYPV1AwzdXUtq8zM3O54e8cNM0YjIwvErq5XBy5csGvS0uKW\r
- qKhwEnfuPOD13nt/XP0qTS60rwUB5jlj/ozA3v/DH1Z+98Ybv/qSnv/m/8vsnH7+lQd/Fcf+X104LlAR\r
- 5z/iAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAfNJREFUaEPtmk8o\r
- REEcxxe7J/9WbvawVxcpBzkhpUi5OLg67EWSFAclxcnJHrW5UFw4iDO2uMiKZ6WltSVa689jd7Nr/6j3\r
- NbslntFr9Gqnec3W57avme98f7/vTO9NGQCb0L+CAJEhi49WgiYo4wUBneXlRQGklsTBbi/OeVpcAQ4p\r
- gG+52aUDnBu+4mcTO+uQb2oBRKLGiQ+SQqPFFOrqhXpPdjOR6BvAC5l7jxTAyzVrO3AcPMHG4gJFKHrH\r
- 1CcrCjCyThPOsvXZEeZwiCkdCpZ0Yxs6cLC/C9/kMEXw+opJgGeNbHJDNEqCTcA26rEJu44ddEkBkA7I\r
- EvruIdnERhsY9xS6Sb2hkPm/uc1lmWJ0KwzM79FEcmwxeoZlnMKn4wLb7DHK63jwn3GtfZT4z0rw+q90\r
- gNfKf41rcQfSaTzEYhT3uRxTjJbCHUMHEl7vny99VL+fScDE7AJc7laK8yeV6fnGlya4VLeO/uQg+z5g\r
- VoBnbIa8Z22gUGKPTAKqn2phe7TpaHvtkALAWkLSAVlCJlOIewm9rq4i39xM8RwIMKUIdwFmN6LIewah\r
- eJIiqmlMC3CpJRDS4jrC2ht7jJoVUIrnLX4WEuBVu3SgFHVuNIalHGh3OJCprEJKJMics+QTU7fQFz2K\r
- N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAI5JREFUOE+tklEO\r
- gCAMQ/XfK3j/E/gNN1NLLCljRoeaLGZQXrfBnHPepy8fACmlGieryS8DmHRR9hSgIkKtAdehdQEQaBUe\r
- gPsNgO4EqOiuxQ7gCW2LmrsV2DnwAHtWk8cKIOAteLOoAOuq+atrpNPIv7yDSKzL1ujDAJgppACwMBJ1\r
- iJEW3AoigF9moIYHlA+UIAsfXwEAAAAASUVORK5CYII=\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA\r
- AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////\r
- //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP\r
- +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
- +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/\r
- //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP\r
- +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA\r
- AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP\r
- +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg\r
- /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP\r
- +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP\r
- +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX\r
- +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////\r
- //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA\r
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\r
-</value>\r
- </data>\r
- <data name="propertygrid_alphabetic">\r
- <value>Alphabetic</value>\r
- </data>\r
- <data name="Ignore">\r
- <value>Ignore</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACKZJREFUaEPVmg1M\r
- lPcdx//3fs9z99yBEJt1WzqTrc2SZmk6a+K2LpvGtGE1jd1qRnWmXRpaK77WicU5GOCqgnIg4AsHihYq\r
- xyFUsWoEkbM4DirH+/sd9waKAqIyqw3+f/s9d0B5u+OgGK4kv+S457k/38/v/3v7P4cAAMgP+ocH+CHb\r
- vIqvWK3+HZrYmwPxuszb9XkFMIaqMyvXqT//+u8q4VQiq95VLTKuVRv9FuBGmKrUtIGjNVu4zNqPOcFY\r
- oTVbuT+ZNnJ91R+qHvktQO02zlq/U0kbditpY7QihRfaFKMQNv1bEdf4L+WT+kglrfsHN+iXAHURSgmK\r
- HGreo6Ct+xW07SBL2zRscruGvdyWyNLWBJa2fKqgCDPglwDo6Z/zwtuTWGo+zFBLOkM7M4dNy1DzUYZ2\r
- pCDUAbZ3XgGwivwULaTqPdUKUzj3BwyZ36L4JejhDzpSUXAGQ22fyan9tJw68mTUqZdRhw5/z5FT6wk5\r
- D9Iz5wDY+KRoCl/6B4pXGNeoG258qKK12zmMdSVtjWdpRxrjEujIldOuQhm9+aWU3rrktpsXpLT7nBuG\r
- h7McY+5jeNViuBXWf6I8iMm9CR2yEtdWT1lGUZyYZcnzS5eSNaGhZOeWLUQTHU1yEhJIyeHDpCE7m/To\r
- dKR/82ZyDe8dVz2mLIfvqX5p2sTd55OyGeO6/RDrChdePC+0p1hK71yT0DvXJbT3upj2lkvo7VI3iPMM\r
- QpzCnTjCuPKCdwBWLIoV7DMsw2IXwEsvkRe3bSOavXvJ+eRkUnn8OLEbDOSxzUagq8uzNTcT+tpr5C++\r
- 7ARWnNDGKCVticfYPiJHz6KHv5DCrWIJ3Lkuhv5qEQzUozUI4W6tmPZXiumdMolrZ/jQ4oHbk1nKJz2G\r
- obZ6A+fqHYRhyMKsLNLrTai3a1FRJGcsAL97zz5LfrFiBQl9/32yIzKSaPbvJ7kpKaSsNEE60JbEgCVT\r
- Do48Kdy8iOK/QvE1IrjfJoRBmwAG7QJ4YBbRe40i2meU0J4SKe36YngXMOxa9ilSGv6pHN11EhJC3p3O\r
- 094AjEZyf98+cjotjZzHnTPl5pJbFRXkid0+eeec+J75lBysWTJwFri932sUw71mIfzPIYBHfQQe3yXw\r
- 8KaQPugQ0bsm3AWDhHYXyaj9c1dCx0/cbbJmDYmYrfdn+jmbSQgdRxiwnpRBVyECXJFAX5UI7rUK4WG3\r
- AL4dJDD0LYFHvQI62CmkAxhKfG7wYYRV6gkm8/JJAKtWkc0zFTKb+61GETTvY6HjEAJMuwMCTzvQgxXs\r
- x+NCdvlyEjYbQTP5jOWaCOoiFdAUy0K7hoHO4RzonioHMJQemIWYzCLaWyGht4ql4CyU4a7JoSNVDpgD\r
- XzXsUkpGIMjLL5O3LBbv1WYmYife21EshhvrOajdpoTGKAW0JjBgPioHezbmwbgqJMYqhNYggrs1YujD\r
- 3LhdJoHuL6WY8DKEZqAtiYXhKpQ4CrBwIfl1dfXTA2i+IoKyoxK4+KkMru5loPIACw0pfCViwJ4rh65z\r
- MkxmKdw2YEX677CVS6CnVArdF9D7Z2SAfQCwDwBfgvlSPNwHVo+cJn9SXEwefh8vO50EsBrB6dMCyMoS\r
- o0nhJG75iRMs6HQcVFUtAKczGHvKd2a9ogLsxIDNDBNaBt3nsaxechsvnAfDTgy2IhYcTYHQVhkIcX+T\r
- R2An/j124mXYiZeOALBY+np8AWhqIlBUJEBhIhQpQZPhawbFKqCkJAAslqBxIscKnvi686IaYxrzIYMB\r
- HBcAq4wrVHjROAsBzkIuQOslzrVmQYG6H3tM4KQqxL+Rnk7MUwHk5YlQoBSN96YCF1FBXd0Cn0V6AzCf\r
- VQNOo4DTKOA0ChZ0hL1cDZ0nEUrL5wkDOI2CtUTt+nupqarqqTq+a5RITSU1UwMo5kTsVCBtOjXgeYBP\r
- SmjXKsHR6naMvQ7D5RCLyc4CngfAWh7oej8uTnnGI4BGQ65NBGhpIXARt9mbF7/PtZasAKxMHLSdUoPT\r
- Pj70bF8HQmOMEnD4A5vJDbZxI3PAIwDOKhcmApw7J4TOTt9jeqYwzRmB0H7e7d2prLN8AZi2cOAwB7kK\r
- QEiIbINHgNhYopsIkJ8veWre5wU7bdM7x2Jwe7+8PHDomWfIix4Bdu0iGRMB9FgNZurVp3W/VqvqxAo0\r
- 5aMXVxLzZ4HJAKzfAMTHK0s9nTlcAGFhJHYsgMNBID/fXX/9wSIj2eNeAfDYuGMsgMEggOrquan3c+GA\r
- devkUV4B8Fi4fixAfr7ILzzPw7e0BMGSJdJVXgFeeYX8deypLA+Pe3PhublYIz8/YAATOMArwHPPkd/U\r
- 1X03ker1OGD5SfwnJ3O13h4auJIYf35WVkYej4SRXv/0RoiZOiYmRlnoC4AqP9/9ZKKxkcDlywF+swPh\r
- 4QrNtAD8DVotsfIAZ88KwWr1j/LpcATDypWyTT4B4GOReh4gL0/sN943GAKfLFok/ZVPAElJ5DoPoNP5\r
- zwiRmqrs8zRCjJ6JR17gc89LPIBe7z8jRGwsa/HmfVcBGrlhzx6i55+mFRT4zwixc6f8rM8Au3eTE1ev\r
- CqCmZn5GCJstGAyGgG+ys1Xm9HTu6sGD3Km33/bcgSeF0Pbt5BB/Bp5pnZ7J/XxVMRoXDOXkqJzHjnEV\r
- Go1SHxWlSAwLYz5etky6Ch/p/2g6j0+8PhpC69eT/+j1czNCmPAYqNer+rVarjYxkSuKjlYe/ugj+a7X\r
- X5euDQ4mz2NiimYq1OsowV9cu5Z8otMxPu9AY2MQ9gz1NxkZnCUpSVkSE6M4Hh7Oxr35puyDF16QLEaR\r
- Xr+gnnOAN94g4Xl540eI9vYg/mA/lJmpuJ2WpjBhVdBt3apIWL2a2bp4sWwFilTPlZDZrjMaQvgtzR8j\r
- IpjOhATWsGMHk/7OO/LIV1+V/nk2cTlbMbP53Lz+q8FsBHtM4rlYbD7W+D9MzRR6eEGuxwAAAABJRU5E\r
- rkJggg==\r
-</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACTtJREFUaEPVmXls\r
- VUUYxVtrLJFUTZTFJUgQgooouEAxGheM/qMREo0b0aCJ0bA0smihRUE0alwQlQfiAu67uOPCYlUoguKK\r
- Ii4gsgikaGmLRoz1/B73NNPb+15f+4wJvhzv5c52zvd9M/PNtLCxsbFgj/4PAXsy/jPyBXMLOghHCqXC\r
- 2cKFwlUReOcbZdTp8F8ZLS8BInKocI4wVpgpzBYeEh6O8Iiehr9RTl3a0PbQfMS0WYAGLBT6CZMCwpB8\r
- VJgj+PeY3uJwGfWoTzsE0Rd9FrZVTM4CEohjUUjwg+jjwhPCk8JTwtMJ4Dvl1KM+7fjRD/21WUhOAtRx\r
- R2GUQIiExCFhws/o/VnhOeH5CC/oafgb5dSjvgXRTyiEsTrm4o1WBaij7sJtAq62xU0cK0MGchB9UXg5\r
- wjw943AZ9ahPO9rTD4YIhdzO2K2JyCpAHZwipASsTtzicgZiQCwZkn5F/35VeE14XXgjAXynnHrUR5DF\r
- 0J+FMA7jzYJDNhEZBaghS96DAXmsg8tt8Zf0joVNGsJvCvOFtyO8o6fhb5RTj/oWQz/0Z48wDuMhAs+X\r
- ZhKRKEAN+ggsdawS/Jh0odWxHBbEoiYN0XeF94QFwsIE8J1y6lHfYujHHsGr9gbj8mPu9UkS0UKAKh4u\r
- 3C8QNnHyuBtrYTksCAGIQArCi4T3haoIH+hp+Bvl1KM+7SzEHqF/xomLmAG3uIhmAlRhL2FKRB734UZb\r
- nk6xEuSxOiFh4osjwh8WzCio7jm+90/9xh2/Qd+qAyzV+xLhI+HDqD7tLIT+6Jf+GScU4XC6GY6hiLiA\r
- waqAu1htHPNYwuRx9VuR1QgHLIllIbTkoKmdvqmYMblh09baxrLU+Fp9WxHDcv3740gUYiyEfugPb9C/\r
- Q8oiPCfgNThRgApKhHsF4t6rDROWmHTYhOSxHuEBkepjr++/Yd6C+bu2/bazEYxOjduh758H+EzvK4VP\r
- I1GhEPqhv1AEnmBcxocHqx+8CO8Si2jygD5eIjDjCR0mDxsNqwIT1mGDhRiEwbDeUi10y8+dMGT7mrUb\r
- 08SNUalx9SpfFeBrvX8lfBGJspBl6X529xeKcDgxPjzgAy/4XdpMgD4UCaH1cVkYOkwwx7wtv7RwZuEn\r
- l065onZLTX0z8ogYlRrboDbfBVit92+FbwTEIASvfCLgDUTYE8wtxmPccD7Ay14oSp9l0v+bW9BXIPZD\r
- 68dDh6WPWE2HTdEDRZ9eecvVdVu3N7Qgj4CRqbE7Ve+nAD/q/QdhjYAYvPNlTAThSP+Mw3iEbBhKoRf6\r
- hgKGq6KXTWKNmPPEtfUJHZbAj4rvK1454vay+jBk4u8jU2P+UN31wi/R82c910WCvtcT7+ANi2DCE06s\r
- UozDeHEveC6wvF+5+zS5Oz2eLnjy4qYw9rFCk/WLphetGH3H2IZs5CkbkbruT7XbHGCT3llaEbVWwBuI\r
- wBOEExOcVcqhFPeC54LD6IE0d/1vfyFcOnGTw4fljM2KmHxfU3zJBeUX1bZGnvIJqZt2nThpwE7jpMqB\r
- DUK9UCfUDqgs/X1ARen2ARWDagZWDNo2sOLkLaUTT94sbDxsUjdCDC8wLuPDwysS/FjiWVL3RwA7b3z1\r
- iYcPm03VqWWnbd3w6/bEmM9FVK51zrt56BbGExg3HkbhPOiOgH6BgDD+SdJYylg6F/YZ03fd59+u+SdX\r
- EvnUO2/qEAQwmRHA+PCAD4b1PGDB6Y+AMyIBTAwLIDNsEnBI5WFfvb5oQdMmlQ+5XNoGApgHoQB4hRP5\r
- DAScJsRXoFDAu8eW9/sxvlHlQqS9dWICWEDsgbiA0xFwXGseUPmiiyZfVtNeQm1t1wYPHIeAbrnMgX2m\r
- 71M97ckZf7SVTHvqRwI8ibPNgW4IIIlL2oXZwsNNrKr7lB7fvf1B1d+5kNq8bUcjK1Z7cO6U870KxTcz\r
- lvdwFSrxRnaPCpxCk/8n7QPpBK7nxF5r36pa3KqIa+4YuatzeZcdQl305L228w1dfhNqhG1dru/6q7Cp\r
- y/iuvwjru447eK3wQ8nU/chiGS9pH4Af+8B9QqFzoWH6R7gTk8g5C222E+v70iMm9Fz35uKFWUWMSI2J\r
- 78Qb1ZadmJTCO7FzInZistPWdmJ4eSe+PMyFeiesRBlzIdWt7lF+xLqn3ngp49Ia5EKkDsDESerIheIJ\r
- HbkQJ7hcc6HeoQDyobtiYZQpH2JykTUuO+DWA1aX3TW+ISmdjrJRyJKROhN1EkdaHc9GSeTol/4z5UEO\r
- n2mET5OAKKUeEoRRpoyUmAxPYst0d7HyrBvOqfls1epmu3SW8wDEfbAhgeM8YPLZzgPhqWxo0omsOPJC\r
- eJi3F7wrk5f4RObjJIOv6DWx9/o5857+KzhS1uk7BxcD0qTOPsiEJzKfA3wi8wGfcZ2FhtYvbiEg8gKX\r
- WfFdOTzYODcKRRCzxO7HHW8rWXXtnWV1LKHRmZgTFysKT5+JsTjx7jMx7eNnYh8n42di0p1B2W4lmAvl\r
- AksqRzdmvA83PtiHVyq+B0rfSqSFzC5YfvqEwVsurhwWv5XwjQQeQ7BvJXxP5GNkSN7Jm1eeCrVrdgWf\r
- dLHVSZXuFsJQ8vk4LoI8hYwR1zP5sCQWXVI8uQOhwuEkBKRtcerTjvb0E94LMU78XohDV6esF1tNcbU7\r
- veDEk0kEscku7WsWCPieCFLh7RxEDb5T7nsgXzHSD/3RbxJ5rjlb3Mo1W4VaKJtbcJQazQpEOJyYE74b\r
- 5cBtIVjQ14yIAeH9qL/5OpH6Ju7bOPr1PRDjseNy2Dq6TZe7gSeOUWO2bHuCTn1fhIvjQohfSIU31BA1\r
- +E459XwXSs5FP/Tn+x+TJwrStw/tEhCtTAeqk0rBE9s31UxuBrQQXE8IYE3AOTYOlzlUQuL0x1JJ/ywg\r
- NwoH5fUHjsATe6uzywRft+NaNjsGZGAmOa5HDIcOiAFEGf5GOfWoTzsTpz/65Udutndr5LPOgaTG6pTJ\r
- PVLAG/wYEIvhcsQk/Z3MfxvjacLUoz7taG/ioxgjF+KJG1muDSMhI/T0bQYutxgsCbFMoNykaYdXMUqb\r
- iOclIAitfTXwicJwwWcKJrx/EDT8jXKSMdqcJOybq+ESoyKfxglLL5tgT+EE4UxhaATe+UZZi80oHw6t\r
- /pk1n87/j7Z7vIB/AbqI4PWoWfWuAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
- <data name="No">\r
- <value>No</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA\r
- XEMBOS4mtwAAA1pJREFUaEPtl11oUmEYx/2aigx30ag2XXURYQwTkiBDMaSrugi61CBidhVaKUF4M6Iy\r
- ugga9kHBRqMkKiq6ihYYMYqtj6tiUBch0UAq4oSY0Nbs/4xz4PBybJ4v5wGFP8ej7/ue/+99nvO872tu\r
- NBomQ38IwMgytPnl7DHy7HcBOiF63RQSRwHlOAaN9fb2vnW5XN+dTudvfK95vd5v4XD4/ejo6KNqtZpD\r
- n4PQdsiqNoqaRACmh6E3EC0q/5Xb7ebS6fRYxwDAcADiVjIu/t9sNjcSicQsIE5DATVRUBUBmLJAH+SY\r
- F7fN5XLPYJ6isVcphFqA/UrNUz+8H3WO467wEDuVQKgFuMEC2O32xWQy+XJmZuZmpVK5Vi6XrxeLxfs+\r
- n++rFGyhUHjMA5zHtUcuhFqAV6ypeDz+mjd0Edc9UD/kHBkZGUTbRbZ9KpV6wbenVBpuN8BH1tDU1NRt\r
- 3tA+psT2oO0ftn0mk3kuAoi2G2BWbGhoaOiHyMwgA3BAKoUmJiYeiPqE2w0QHRgYqGDRqvn9/i+lUumW\r
- FACM26E5FqCvr69Wr9cLqwbAz1YWVxLlsKBTzOxfZc1bLJalfD7/hOm3pa0R4B+2GVcSmaZKchRaLxiB\r
- 8ROseZvNtoBtxVPG/Fncy95aqKpCK80WjFPe/xUDYH/E3cOHMX8J97Q3ku1HdodWHwLTG6FfYvMOh+Pn\r
- 9PT0JGOeyu2OVsdl2+kJcJdNHabi0PtyDtqk1Dz10wUAxtdAC2IA2jZI5PxaNeb1BIiysx8MBj+rrThS\r
- sHpFYBsLkM1mS4YBWA6tyXSHIGjvHwqFPtVqtcsiACq3mkyeJoM0M4NqGaQdKTPz9PIeMQQATNJ+SLxC\r
- C99l73maAesaAf6hhxiIw7iXveK2FQC53w8dE4SD/EmPx7MLJpxapY4wjuYRgGk6J7+T2DrTqhwwAoBD\r
- at/P/3a8C8CUXz1SqGkEIpEIHV6i0AatIqEHgBXpMs+mkdVqXRofH3/IV6QLuHq0gNAcgF+Ft+LQMhmL\r
- xeYESZy+dncsAG/M1mQRExazLsBytLUIY5MxLPj9TJMo0BFS9gFe6jl6AtDY66CEhBSdf1cDQO8J0jWF\r
- dDev9zvQBWilwLRllloxorRNF0DpzGnVz/AR+AcOBL1o7Kmu0QAAAABJRU5ErkJggg==\r
-</value>\r
- </data>\r
- <data name="Retry">\r
- <value>Retry</value>\r
- </data>\r
- <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">\r
- <value>\r
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8\r
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACj1JREFUaEPtmQtQ\r
- E3cex9eKr7vO2evUu/Zs72F7147edTrezdmWdmyvnfM8q5718BwRX1WEU4vYIohKtYjhKSQ8E0ICojwl\r
- ikAtiqL4FpQozxACBAiEEBIgLIIC3/vvQtLwTBC8a2eOme8kM1l2P9/v7/vf3WymAKB+0H+MgR+yftDw\r
- bHu+z+lT1PZn58zZ/dbixd5bV22J4qz2yUz+RHjr1ofRd2pmHinY+D83QABnzJ69a76t7WGHVfahh+0O\r
- nT6xQnD96ieJUtmnkqJG+wvlHTultX1u1Rp4qrTgNGvANzTCt1KO6cIq36dugADaTJ/uPG/Roq/sVnwa\r
- dNDOMyVmZfiV3GUnCsv+kfZA9a9zZe1OBcpe18omfFHbAi91M47pmwikekwdliswPabaf8IGCOAzRC8v\r
- XHjwk6V/9/VY82VC1Cruxexlx+8WrUy9X2eXWdq69WZNj4usCS7VOrjXa+Gj0YBLII06pqnHgfzrcE2N\r
- h3uCEPvjwnFYenvQNubbM+89y6sZAwFWGSCAP58/f99fliw5usdul5i3OjA7c5k4X7oiSar89EyJbtO1\r
- qkc7itXYqdDBRanrH3WTBr4E1ChOUxM87t3DzrQUfC7mY19cJHziw8A9GYq4U+G4k58GvT4fNC1lFSvh\r
- Y883GYP2Yb6/PSVKYqAmaOASsP1Hr766992PPvLZZbeNH2h3NEtCFkrBigRp1SpJsXZ9rqJr+/1GOMt1\r
- cFbosVtJRq1qxqGG4XIrKoNTegYco/lwFYbDSxQKX3EIIk9wkXP5JBobr5kgjbCjvebeTIWzKHrE4+x4\r
- UEvWgPIYa+A9x3j+unw1HMtbsEXWiu1yPb6saYE7AR1Ju0tq8FlmDjZECeAUEQa3qBB8LQxGkDAQkkwh\r
- 5PLzVkNaMiFXXIRjkD++lDcOYtlaWM8YCGYN2O7LEDmUtsKlklTAgrbweIhLDkVh4Wm0thZMGuhYRphq\r
- fRHMgePNUhOfQ34DpglrQ/oNeGSI1txvg2Opfkw5RMejsCjriaGb2h/gVrMMSXW1ECsbIarRELUQtcGH\r
- 1NPSNIJiebA/ncsyrrmhxrToWp7JwMqCdmyQto6qtSeykH0lyeJBFPpiXGioRHytCnFKNWKVzRDX6Mlr\r
- O1LraORrOqFtp9HRMVhiYsSSAeZzSXY81vATsfKKBtMEdQMGSIWW3OiA3e32EbUy+RbiJNFjHuCwrA1x\r
- NQZ820CjQtcJwxDAocBPaoAxcfd+FhYHJDIGwkwT+OBKB5bnGYbpb6dl4AhCLKYjJvCWIMf63NoJGAz3\r
- cD4pGPZvvo2tz72kXUtR/2TXwDsXaHx8oWOQPjyrhosfxyI8k8rTNnDzjgQhCQI4bFoPLbl9yyNqIIqg\r
- qPOsgYVZD/FeZqdJtukG2B/0QXv7vadqwGCg0U4kqh6+BhSKHEQkRsErIR5H7skQ2Qa4+fmjj4D3EgmJ\r
- 3CgqlzWwIK0Lf0x9aNIyj0BoNDetgh/vBBhoFpws5rY2Gq1ERgPNzTcRlyaAd4IYB3KustDmCiSL3c1h\r
- HQ7MfQ3v/3n13V9T1M8oW/cM0WsJ3VhwvIvVBx4CVFRetBreWgMmaCN4Kw09kbbFAPfUb+B3Uoh9krPg\r
- abqGgYeoDPBKSwMvOQZXriVhoWs0poU1CPoXMTHwsqgb8/jd+JOnBNfvnB4X/FgGRoPW62nkXS9AQHwy\r
- 3E+mIUChGQYdru/FV+fOIzBJBElWDLlwfnev9OauGNiENkSbDMyJeIzfeN5CSmb8uOGHGjD22rwiTNIM\r
- tI4oIycP++NT8XVB2TBopi7eN+7CJzEW4pRIqFR5I/IscBbChtcYYzLwk2M9eH1b7BPBGw0M7XWrGXSL\r
- jkZLCwN/FQezh3ebU65iF2t4QgSKijMtcsx3JBMIaRSZDMw42ot5m57cgKja0L8gB3rNJK1joIm0BLxZ\r
- SyP928vwzLhoSp3p9b6kdPjFJsPjVLZFaPMr9etbRLA5phabDFAHgV+uOz6unZjvUFhlYOthDq0l0Ay4\r
- ppnGEcld7OSlQXA8FTxxMgLjUiBOTEdVjQ715OrNl1t3K2E85m83xMImUB03eQYUBjZpY9oMNKMmDQ11\r
- E41L8k48e6IPaSUPoWqkWeh6FY06otp6YqBifAZ+t9HcwN6z4olOILrSwAKbQzcS8EY1jQYCzEAfud2N\r
- 2Sf7kFvRyUIzUpIbvJpaGlHjNPD6RrHZBCbBgIAYUA+kzUITMdAqJmkiJuk6AvzXrMd4JbkXBZX94NVK\r
- mtSIRqTM+gkUSM/h+c2XzQ2kiyY6AX6FgYU2pm2CHqgImzSRVEHjxcRe2Gb0oIy8V1TTqCSKJN8Grbmd\r
- ZrZZvpsLag8m10AUMTC01wy0sSJs0gNpSx48xFtne+F67RFkZBIVxEiElQbSshIxa2vx5BuIlBmG9bra\r
- rCIKUhMm6coqGnIibkEX1l7uAb+wC+VyGuFllifQ0VGId7fyWPhJn0B4uYHttHmvGWi2IgPQTNIVJHEm\r
- 9dIKGr753eR50CNkFj9EeKllA4H8CDzjpH5KBkoNpooYe80kLWegiRhoJmlGZQS+VEa+XpbRCJN2Q3C/\r
- G0ElY38n1mpvY8EGvgl+yATOTHgRhxIDTEWGQsuGQDPgJeU0igl8fimNaGknOA86yFlIPeYidvEOALWr\r
- 8ykaKDGYkjamzSY9kPZdApxQRINX1I6IUi2EcjWSa5SoJA8BLJ19Ksmt/SvrEwfBT/oEuMUGUz0KScIM\r
- LJfAMotTUNEPK9eXWIQdycwaF29Qrr2WDdg4N2D5jqPk8d/1cR/IqbAdYeU6ckVVI0lZC5nuyWDNDVRX\r
- X0SEMAjPb7gwDH7QBN7b278G2NPT7h78fkMEzl1KHbcJS1UY7XPmydv1GynghAZjm9cxLHUJwx828vHC\r
- +kxQjg2D4Q/0YYZfV+cs/1bVFH77jv5no+YGBs6xL2y+hP1B3Ek3UVWVg/gUAb44GoQ1e0Px7vZI/Mr+\r
- OKZvkoJyefQd7F5gqvfjxzMDOnQzfVvKqED9Kep4zwHqDGypHMw0/1VpRAPMNKY6NWCpMwf19VfHbYRJ\r
- Ne9aKry5wfjMi4slLpGYv1GI59Zng3LSDE21b4bfQ3qWX2v9NF/tNSqCDqNSsJGAzrXm569RDbCVIovn\r
- DQcBzp5PHtUE8/gjhjyzcT3KxWq3cCzaHo256xIwdVMRqeTj4an6k1Q5LaUk1VSSqieVjncI7AxrYEfa\r
- hnp/hAoZL9fG159uzsNefy4u5aXiUAgPm73C8fHnAjC3tT+2vwjKuWV4qr4kVV993TSONo+kyiWpOhDQ\r
- Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J\r
- 9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l\r
- IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC\r
-</value>\r
- </data>\r
-</root>
\ No newline at end of file