Author: pbartok
Date: 2005-05-10 15:05:12 -0400 (Tue, 10 May 2005)
New Revision: 44343

Added:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs
Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
2005-05-10  Peter Bartok  <[EMAIL PROTECTED]>

        * 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



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-05-10 18:36:09 UTC (rev 44342)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-05-10 19:05:12 UTC (rev 44343)
@@ -1,3 +1,11 @@
+2005-05-10  Peter Bartok  <[EMAIL PROTECTED]>
+
+       * 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 <[EMAIL PROTECTED]>
 
        * CheckBox.cs: call base method to allow to fire OnClick event

Added: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs   
2005-05-10 18:36:09 UTC (rev 44342)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs   
2005-05-10 19:05:12 UTC (rev 44343)
@@ -0,0 +1,178 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 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    ([EMAIL PROTECTED])
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace System.Windows.Forms {
+       public class DataFormats {
+               #region DataFormats.Format Subclass
+               public class Format {
+                       #region Local Variables
+                       private string  name;
+                       private int     id;
+                       private Format  next;
+                       #endregion Local Variables
+
+                       #region Public Constructors
+                       public Format(string name, int ID) {
+                               this.name = name;
+                               this.id = ID;
+                       }
+
+                       internal Format(string name, int ID, Format after) : 
this(name, ID) {
+                               after.next = this;
+                       }
+                       #endregion      // Public Constructors
+
+                       #region Public Instance Properties
+                       public int Id {
+                               get {
+                                       return this.id;
+                               }
+                       }
+
+                       public string Name {
+                               get {
+                                       return this.name;
+                               }
+                       }
+                       #endregion      // Public Instance Properties
+
+                       #region Private Methods
+                       internal static Format Find(Format f, int id) {
+                               while ((f != null) && (f.Id != id)) {
+                                       f = f.next;
+                               }
+                               return f;
+                       }
+
+                       internal static Format Find(Format f, string name) {
+                               while ((f != null) && (!f.Name.Equals(name))) {
+                                       f = f.next;
+                               }
+                               return f;
+                       }
+                       #endregion      // Private Methods
+
+               }
+               #endregion      // DataFormats.Format Subclass
+
+               #region Local Variables
+               private static bool     initialized = false;
+               private static Format   formats;
+               #endregion      // Local Variables
+
+               #region Constructors
+               private DataFormats() {
+               }
+               #endregion      // Constructors
+
+               #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
+
+               #region Public Static Methods
+               public static Format GetFormat(int ID) {
+                       if (!initialized) {
+                               Initialize();
+                       }
+
+                       return Format.Find(formats, ID);
+               }
+
+               public static Format GetFormat(string format) {
+                       if (!initialized) {
+                               Initialize();
+                       }
+
+                       return Format.Find(formats, format);
+               }
+               #endregion      // Public Static Methods
+
+               #region Private Methods
+               private static void Initialize() {
+                       lock (typeof(DataFormats.Format)) {
+                               if (!initialized) {
+                                       Format  f;
+                                       IntPtr  cliphandle;
+
+                                       cliphandle = XplatUI.ClipboardOpen();
+                                       formats = new DataFormats.Format(Text, 
1);
+                                       f = new Format(Bitmap, 2, formats);
+                                       f = new Format(MetafilePict, 3, f);
+                                       f = new Format(SymbolicLink, 4, f);
+                                       f = new Format(Dif, 5, f);
+                                       f = new Format(Tiff, 6, f);
+                                       f = new Format(OemText, 7, f);
+                                       f = new Format(Dib, 8, f);
+                                       f = new Format(Palette, 9, f);
+                                       f = new Format(PenData, 10, f);
+                                       f = new Format(Riff, 11, f);
+                                       f = new Format(WaveAudio, 12, f);
+                                       f = new Format(UnicodeText, 13, f);
+                                       f = new Format(EnhancedMetafile, 14, f);
+                                       f = new Format(FileDrop, 15, f);
+                                       f = new Format(Locale, 16, f);
+
+                                       f = new Format(CommaSeparatedValue, 
XplatUI.ClipboardGetID(cliphandle, CommaSeparatedValue), f);
+                                       f = new Format(Html, 
XplatUI.ClipboardGetID(cliphandle, Html), f);
+                                       f = new Format(Rtf, 
XplatUI.ClipboardGetID(cliphandle, Rtf), f);
+                                       f = new Format(Serializable, 
XplatUI.ClipboardGetID(cliphandle, Serializable), f);
+                                       f = new Format(StringFormat, 
XplatUI.ClipboardGetID(cliphandle, StringFormat), f);
+
+                                       XplatUI.ClipboardClose(cliphandle);
+                                       
+                               }
+                               initialized = true;
+                       }
+               }
+               #endregion      // Private Methods
+       }
+}

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
   2005-05-10 18:36:09 UTC (rev 44342)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
   2005-05-10 19:05:12 UTC (rev 44343)
@@ -40,8 +40,12 @@
 
 namespace System.Windows.Forms
 {
-       public class FolderBrowserDialog : CommonDialog
+       [DefaultEvent("HelpRequest")]
+       [DefaultProperty("SelectedPath")]
+       [Designer("System.Windows.Forms.Design.FolderBrowserDialogDesigner, " + 
Consts.AssemblySystem_Design)]
+       public sealed class FolderBrowserDialog : CommonDialog
        {
+               #region Local Variables
                private string description = "";
                private Environment.SpecialFolder rootFolder = 
Environment.SpecialFolder.Desktop;
                private string selectedPath = "";
@@ -50,6 +54,7 @@
                private FolderBrowserDialogPanel folderBrowserDialogPanel;
                
                private bool treeViewFull = false;
+               #endregion      // Local Variables
                
                #region Public Constructors
                public FolderBrowserDialog( )
@@ -67,6 +72,9 @@
                #endregion      // Public Constructors
                
                #region Public Instance Properties
+               [Browsable(true)]
+               [DefaultValue("")]
+               [Localizable(true)]
                public string Description
                {
                        set
@@ -81,6 +89,9 @@
                        }
                }
                
+               [Browsable(true)]
+               [DefaultValue(Environment.SpecialFolder.Desktop)]
+               [Localizable(false)]
                public Environment.SpecialFolder RootFolder
                {
                        set
@@ -95,6 +106,10 @@
                        }
                }
                
+               [Browsable(true)]
+               [DefaultValue("")]
+               [Editor("System.Windows.Forms.Design.SelectedPathEditor, " + 
Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+               [Localizable(true)]
                public string SelectedPath
                {
                        set
@@ -108,7 +123,10 @@
                                return selectedPath;
                        }
                }
-               
+
+               [Browsable(true)]
+               [DefaultValue(true)]
+               [Localizable(false)]
                public bool ShowNewFolderButton
                {
                        set
@@ -158,7 +176,8 @@
                        return true;
                }
                #endregion      // Public Instance Methods
-               
+
+               #region Internal Methods
                internal class FolderBrowserDialogForm : DialogForm
                {
                        internal FolderBrowserDialogForm( CommonDialog owner )
@@ -586,5 +605,12 @@
                                }
                        }
                }
+               #endregion      // Internal Methods
+
+               #region Events
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public event EventHandler HelpRequest;
+               #endregion
        }
 }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2005-05-10 18:36:09 UTC (rev 44342)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2005-05-10 19:05:12 UTC (rev 44343)
@@ -77,7 +77,7 @@
 
                #region Constructor & Destructor
                static XplatUI() {
-                       Console.WriteLine("Mono System.Windows.Forms Assembly 
[Revision: 44101; built: 2005/5/5 21:38:0]");
+                       Console.WriteLine("Mono System.Windows.Forms Assembly 
[Revision: 44278; built: 2005/4/9 9:44:53]");
 
                        // Don't forget to throw the mac in here somewhere, too
                        default_class_name="SWFClass";
@@ -277,6 +277,41 @@
                        driver.ClientToScreen(handle, ref x, ref y);
                }
 
+               internal static void ClipboardClose(IntPtr handle) {
+                       #if DriverDebug
+                               Console.WriteLine("ClipboardClose({0:X}): 
Called", handle.ToInt32());
+                       #endif
+                       driver.ClipboardOpen();
+               }
+
+               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) {
+                       #if DriverDebug
+                               Console.WriteLine("ClipboardStore({0:X}, {1}, 
{2}): Called", handle.ToInt32(), obj, type);
+                       #endif
+                       driver.ClipboardStore(handle, obj, type);
+               }
+
+               internal static bool ClipboardRetrieve(IntPtr handle, out 
object obj, out int type) {
+                       #if DriverDebug
+                               Console.WriteLine("ClipboardRetrieve({0:X}, 
obj, type): Called", handle.ToInt32());
+                       #endif
+                       return driver.ClipboardRetrieve(handle, out obj, out 
type);
+               }
+
                internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, 
Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
                        #if DriverDebug
                                Console.WriteLine("DefineCursor(...): Called");

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2005-05-10 18:36:09 UTC (rev 44342)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2005-05-10 19:05:12 UTC (rev 44343)
@@ -198,6 +198,12 @@
 
                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);
+               internal abstract bool ClipboardRetrieve(IntPtr handle, out 
object obj, out int id);
+
                // System information
                internal abstract int KeyboardSpeed { get; } 
                internal abstract int KeyboardDelay { get; } 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs    
2005-05-10 18:36:09 UTC (rev 44342)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs    
2005-05-10 19:05:12 UTC (rev 44343)
@@ -852,6 +852,32 @@
                        x = (int)(pt.x+wBounds.left);
                        y = (int)(pt.y+wBounds.top);
                }
+
+               internal override void ClipboardClose(IntPtr handle) {
+                       throw new NotImplementedException();
+               }
+
+               internal override int ClipboardGetID(IntPtr handle, string 
format) {
+                       return 0;
+               }
+
+               internal override IntPtr ClipboardOpen() {
+                       throw new NotImplementedException();
+
+                       return new IntPtr ();
+               }
+
+               internal override bool ClipboardRetrieve(IntPtr handle, out 
object obj, out int type) {
+
+                       obj = null;
+                       type = 0;
+                       throw new NotImplementedException();
+                       return false;
+               }
+
+               internal override void ClipboardStore(IntPtr handle, object 
obj, int type) {
+                       throw new NotImplementedException();
+               }
                
                internal override void CreateCaret (IntPtr hwnd, int width, int 
height) {
                        if (Caret.Hwnd != IntPtr.Zero)

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2005-05-10 18:36:09 UTC (rev 44342)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2005-05-10 19:05:12 UTC (rev 44343)
@@ -1603,6 +1603,30 @@
                        Win32DeleteObject(hbr);
                }
 
+               internal override void ClipboardClose(IntPtr handle) {
+                       Win32CloseClipboard();
+               }
+
+               internal override int ClipboardGetID(IntPtr handle, string 
format) {
+                       return (int)Win32RegisterClipboardFormat(format);
+               }
+
+               internal override IntPtr ClipboardOpen() {
+                       return new IntPtr(27051977);
+               }
+
+               internal override bool ClipboardRetrieve(IntPtr handle, out 
object obj, out int type) {
+
+                       obj = null;
+                       type = 0;
+                       throw new NotImplementedException();
+                       return false;
+               }
+
+               internal override void ClipboardStore(IntPtr handle, object 
obj, int type) {
+                       throw new NotImplementedException();
+               }
+               
                internal override int KeyboardSpeed {
                        get {
                                Console.WriteLine ("KeyboardSpeed: need to 
query Windows");
@@ -1871,6 +1895,18 @@
 
                [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();
                #endregion
        }
 }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2005-05-10 18:36:09 UTC (rev 44342)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2005-05-10 19:05:12 UTC (rev 44343)
@@ -1323,6 +1323,32 @@
                        y = dest_y_return;
                }
 
+               internal override void ClipboardClose(IntPtr handle) {
+                       throw new NotImplementedException();
+               }
+
+               internal override int ClipboardGetID(IntPtr handle, string 
format) {
+                       return 0;
+               }
+
+               internal override IntPtr ClipboardOpen() {
+                       throw new NotImplementedException();
+
+                       return new IntPtr ();
+               }
+
+               internal override bool ClipboardRetrieve(IntPtr handle, out 
object obj, out int type) {
+
+                       obj = null;
+                       type = 0;
+                       throw new NotImplementedException();
+                       return false;
+               }
+
+               internal override void ClipboardStore(IntPtr handle, object 
obj, int type) {
+                       throw new NotImplementedException();
+               }
+               
                internal override void CreateCaret(IntPtr handle, int width, 
int height) {
                        XGCValues       gc_values;
                        Hwnd            hwnd;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to