2008-12-08 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / XplatUI.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2004-2006 Novell, Inc.
21 //
22 // Authors:
23 //      Peter Bartok    pbartok@novell.com
24
25 // NOT COMPLETE
26
27 // define to log API calls to stdout
28 #undef DriverDebug
29 #undef DriverDebugPaint
30 #undef DriverDebugCreate
31 #undef DriverDebugDestroy
32 #undef DriverDebugState
33
34 using System;
35 using System.Drawing;
36 using System.ComponentModel;
37 using System.Collections;
38 using System.Diagnostics;
39 using System.Runtime.InteropServices;
40 using System.Threading;
41
42 namespace System.Windows.Forms {
43         internal class XplatUI {
44                 #region Local Variables
45                 static XplatUIDriver            driver;
46                 static String                   default_class_name;
47                 internal static ArrayList key_filters = new ArrayList ();
48                 #endregion      // Local Variables
49
50                 #region Private Methods
51                 internal static string Window(IntPtr handle) {
52                         return String.Format("'{0}' ({1:X})", Control.FromHandle(handle), handle.ToInt32());
53                 }
54                 #endregion      // Private Methods
55
56                 #region Subclasses
57                 public class State {
58                         static public Keys ModifierKeys {
59                                 get {
60                                         return driver.ModifierKeys;
61                                 }
62                         }
63
64                         static public MouseButtons MouseButtons {
65                                 get {
66                                         return driver.MouseButtons;
67                                 }
68                         }
69
70                         static public Point MousePosition {
71                                 get {
72                                         return driver.MousePosition;
73                                 }
74                         }
75
76                 }
77                 #endregion      // Subclasses
78
79                 #region Constructor & Destructor
80                 static XplatUI() {
81                         // Compose name with current domain id because on Win32 we register class name
82                         // and name must be unique to process. If we load MWF into multiple appdomains
83                         // and try to register same class name we fail.
84                         default_class_name = "SWFClass" + System.Threading.Thread.GetDomainID().ToString();
85
86                         if (RunningOnUnix) {
87                                 //if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null) {
88                                 //        driver=XplatUIX11_new.GetInstance ();
89                                 //} else 
90                                 if (Environment.GetEnvironmentVariable ("MONO_MWF_MAC_FORCE_X11") != null) {
91                                         driver = XplatUIX11.GetInstance ();
92                                 } else {
93                                         IntPtr buf = Marshal.AllocHGlobal (8192);
94                                         // This is a hacktastic way of getting sysname from uname ()
95                                         if (uname (buf) != 0) {
96                                                 // WTF: We cannot run uname
97                                                 driver=XplatUIX11.GetInstance ();
98                                         } else {
99                                                 string os = Marshal.PtrToStringAnsi (buf);
100                                                 if (os == "Darwin")
101                                                         driver=XplatUICarbon.GetInstance ();
102                                                 else
103                                                         driver=XplatUIX11.GetInstance ();
104                                         }
105                                         Marshal.FreeHGlobal (buf);
106                                 }
107                         } else {
108                                 driver=XplatUIWin32.GetInstance();
109                         }
110
111                         driver.InitializeDriver();
112
113                         // Initialize things that need to be done after the driver is ready
114                         DataFormats.GetFormat(0);
115                 }
116                 #endregion      // Constructor & Destructor
117
118                 #region Public Static Properties
119
120                 public static bool RunningOnUnix {
121                         get {
122 #if NET_2_0 && !MWF_ON_MSRUNTIME
123                                 return (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX);
124 #else
125                                 int platform = (int) Environment.OSVersion.Platform;
126                                 return (platform == 128);
127 #endif
128                         }
129                 }
130
131                 public static int ActiveWindowTrackingDelay {
132                         get { return driver.ActiveWindowTrackingDelay; }
133                 }
134
135                 internal static string DefaultClassName {
136                         get {
137                                 return default_class_name;
138                         }
139
140                         set {
141                                 default_class_name=value;
142                         }
143                 }
144
145                 static public Size Border3DSize {
146                         get {
147                                 return driver.Border3DSize;
148                         }
149                 }
150
151                 static public Size BorderSize {
152                         get {
153                                 return driver.BorderSize;
154                         }
155                 }
156
157                 static public Size CaptionButtonSize {
158                         get {
159                                 return driver.CaptionButtonSize;
160                         }
161                 }
162
163                 static public int CaptionHeight {
164                         get {
165                                 return driver.CaptionHeight;
166                         }
167                 }
168
169                 public static int CaretBlinkTime { get { return driver.CaretBlinkTime; } }
170                 public static int CaretWidth { get { return driver.CaretWidth; } }
171                 
172                 static public Size CursorSize {
173                         get {
174                                 return driver.CursorSize;
175                         }
176                 }
177
178                 static public Size DoubleClickSize {
179                         get {
180                                 return driver.DoubleClickSize;
181                         }
182                 }
183
184                 static public int DoubleClickTime {
185                         get {
186                                 return driver.DoubleClickTime;
187                         }
188                 }
189
190                 static public bool DragFullWindows {
191                         get {
192                                 return driver.DragFullWindows;
193                         }
194                 }
195
196                 static public Size DragSize {
197                         get {
198                                 return driver.DragSize;
199                         }
200                 }
201
202                 static public Size FixedFrameBorderSize {
203                         get {
204                                 return driver.FixedFrameBorderSize;
205                         }
206                 }
207
208                 public static int FontSmoothingContrast { get { return driver.FontSmoothingContrast; } }
209                 public static int FontSmoothingType { get { return driver.FontSmoothingType; } }
210
211                 public static Size FrameBorderSize {
212                         get {
213                                 return driver.FrameBorderSize;
214                         }
215                 }
216
217                 public static int HorizontalResizeBorderThickness { get { return driver.HorizontalResizeBorderThickness; } }
218                 
219                 static public int HorizontalScrollBarHeight {
220                         get {
221                                 return driver.HorizontalScrollBarHeight;
222                         }
223                 }
224
225                 static public Size IconSize {
226                         get {
227                                 return driver.IconSize;
228                         }
229                 }
230
231                 public static bool IsActiveWindowTrackingEnabled { get { return driver.IsActiveWindowTrackingEnabled; } }
232                 public static bool IsComboBoxAnimationEnabled { get { return driver.IsComboBoxAnimationEnabled; } }
233                 public static bool IsDropShadowEnabled { get { return driver.IsDropShadowEnabled; } }
234                 public static bool IsFontSmoothingEnabled { get { return driver.IsFontSmoothingEnabled; } }
235                 public static bool IsHotTrackingEnabled { get { return driver.IsHotTrackingEnabled; } }
236                 public static bool IsIconTitleWrappingEnabled { get { return driver.IsIconTitleWrappingEnabled; } }
237                 public static bool IsKeyboardPreferred { get { return driver.IsKeyboardPreferred; } }
238                 public static bool IsListBoxSmoothScrollingEnabled { get { return driver.IsListBoxSmoothScrollingEnabled; } }
239                 public static bool IsMenuAnimationEnabled { get { return driver.IsMenuAnimationEnabled; } }
240                 public static bool IsMenuFadeEnabled { get { return driver.IsMenuFadeEnabled; } }
241                 public static bool IsMinimizeRestoreAnimationEnabled { get { return driver.IsMinimizeRestoreAnimationEnabled; } }
242                 public static bool IsSelectionFadeEnabled { get { return driver.IsSelectionFadeEnabled; } }
243                 public static bool IsSnapToDefaultEnabled { get { return driver.IsSnapToDefaultEnabled; } }
244                 public static bool IsTitleBarGradientEnabled { get { return driver.IsTitleBarGradientEnabled; } }
245                 public static bool IsToolTipAnimationEnabled { get { return driver.IsToolTipAnimationEnabled; } }
246                 
247                 static public int KeyboardSpeed {
248                         get {
249                                 return driver.KeyboardSpeed;
250                         }
251                 }
252
253                 static public int KeyboardDelay {
254                         get {
255                                 return driver.KeyboardDelay;
256                         }
257                 }
258
259                 static public Size MaxWindowTrackSize {
260                         get {
261                                 return driver.MaxWindowTrackSize;
262                         }
263                 }
264
265                 static public bool MenuAccessKeysUnderlined {
266                         get {
267                                 return driver.MenuAccessKeysUnderlined;
268                         }
269                 }
270
271                 static public Size MenuBarButtonSize { get { return driver.MenuBarButtonSize; } }
272
273                 public static Size MenuButtonSize {
274                         get {
275                                 return driver.MenuButtonSize;
276                         }
277                 }
278
279                 static public int MenuShowDelay { get { return driver.MenuShowDelay; } }
280                 
281                 static public Size MinimizedWindowSize {
282                         get {
283                                 return driver.MinimizedWindowSize;
284                         }
285                 }
286
287                 static public Size MinimizedWindowSpacingSize {
288                         get {
289                                 return driver.MinimizedWindowSpacingSize;
290                         }
291                 }
292
293                 static public Size MinimumWindowSize {
294                         get {
295                                 return driver.MinimumWindowSize;
296                         }
297                 }
298
299                 static public Size MinimumFixedToolWindowSize {
300                         get { return driver.MinimumFixedToolWindowSize; }
301                 }
302
303                 static public Size MinimumSizeableToolWindowSize {
304                         get { return driver.MinimumSizeableToolWindowSize; }
305                 }
306
307                 static public Size MinimumNoBorderWindowSize {
308                         get { return driver.MinimumNoBorderWindowSize; }
309                 }
310
311                 static public Size MinWindowTrackSize {
312                         get {
313                                 return driver.MinWindowTrackSize;
314                         }
315                 }
316
317                 public static int MouseSpeed {
318                         get { return driver.MouseSpeed; }
319                 }
320                 
321                 static public Size SmallIconSize {
322                         get {
323                                 return driver.SmallIconSize;
324                         }
325                 }
326
327                 static public int MenuHeight {
328                         get {
329                                 return driver.MenuHeight;
330                         }
331                 }
332
333                 static public int MouseButtonCount {
334                         get {
335                                 return driver.MouseButtonCount;
336                         }
337                 }
338
339                 static public bool MouseButtonsSwapped {
340                         get {
341                                 return driver.MouseButtonsSwapped;
342                         }
343                 }
344
345                 static public Size MouseHoverSize {
346                         get {
347                                 return driver.MouseHoverSize;
348                         }
349                 }
350
351                 static public int MouseHoverTime {
352                         get {
353                                 return driver.MouseHoverTime;
354                         }
355                 }
356
357                 static public int MouseWheelScrollDelta {
358                         get {
359                                 return driver.MouseWheelScrollDelta;
360                         }
361                 }
362                 
363                 static public bool MouseWheelPresent {
364                         get {
365                                 return driver.MouseWheelPresent;
366                         }
367                 }
368
369                 public static LeftRightAlignment PopupMenuAlignment {
370                         get { return driver.PopupMenuAlignment; }
371                 }
372                 
373 #if NET_2_0
374                 public static PowerStatus PowerStatus {
375                         get { return driver.PowerStatus; }
376                 }
377 #endif
378
379                 public static bool RequiresPositiveClientAreaSize {
380                         get {
381                                 return driver.RequiresPositiveClientAreaSize;
382                         }
383                 }
384
385                 public static int SizingBorderWidth {
386                         get { return driver.SizingBorderWidth; }
387                 }
388                 
389                 public static Size SmallCaptionButtonSize {
390                         get { return driver.SmallCaptionButtonSize; }
391                 }
392                 
393                 public static bool UIEffectsEnabled {
394                         get { return driver.UIEffectsEnabled; }
395                 }
396                 
397                 static public bool UserClipWontExposeParent {
398                         get {
399                                 return driver.UserClipWontExposeParent;
400                         }
401                 }
402
403                 public static int VerticalResizeBorderThickness { get { return driver.VerticalResizeBorderThickness; } }
404
405                 static public int VerticalScrollBarWidth {
406                         get {
407                                 return driver.VerticalScrollBarWidth;
408                         }
409                 }
410
411                 static public Rectangle VirtualScreen {
412                         get {
413                                 return driver.VirtualScreen;
414                         }
415                 }
416
417                 static public Rectangle WorkingArea {
418                         get {
419                                 return driver.WorkingArea;
420                         }
421                 }
422
423                 public static bool ThemesEnabled {
424                         get {
425                                 return XplatUI.driver.ThemesEnabled;
426                         }
427                 }
428
429                 public static int ToolWindowCaptionHeight {
430                         get {
431                                 return driver.ToolWindowCaptionHeight;
432                         }
433                 }
434
435                 public static Size ToolWindowCaptionButtonSize {
436                         get {
437                                 return driver.ToolWindowCaptionButtonSize;
438                         }
439                 }
440                 #endregion      // Public Static Properties
441
442                 #region Events
443
444                 internal static event EventHandler Idle {
445                         add {
446                                 driver.Idle += value;
447                         }
448                         remove {
449                                 driver.Idle -= value;
450                         }
451                 }
452
453                 #endregion      // Events
454
455                 #region Public Static Methods
456                 internal static void Activate(IntPtr handle) {
457                         #if DriverDebug
458                                 Console.WriteLine("Activate({0}): Called", Window(handle));
459                         #endif
460                         driver.Activate(handle);
461                 }
462
463                 internal static void AudibleAlert() {
464                         #if DriverDebug
465                                 Console.WriteLine("AudibleAlert(): Called");
466                         #endif
467                         driver.AudibleAlert();
468                 }
469
470                 internal static bool CalculateWindowRect(ref Rectangle ClientRect, CreateParams cp, Menu menu, out Rectangle WindowRect) {
471                         #if DriverDebug
472                                 Console.WriteLine("CalculateWindowRect({0}, {1}, {2}): Called", ClientRect, cp, menu);
473                         #endif
474                         return driver.CalculateWindowRect(ref ClientRect, cp, menu, out WindowRect);
475                 }
476
477                 internal static void CaretVisible(IntPtr handle, bool visible) {
478                         #if DriverDebug
479                                 Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
480                         #endif
481                         driver.CaretVisible(handle, visible);
482                 }
483
484                 internal static void CreateCaret(IntPtr handle, int width, int height) {
485                         #if DriverDebug
486                                 Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
487                         #endif
488                         driver.CreateCaret(handle, width, height);
489                 }
490
491                 internal static IntPtr CreateWindow(CreateParams cp) {
492                         #if DriverDebug || DriverDebugCreate
493                                 IntPtr handle;
494
495                                 handle = driver.CreateWindow(cp);
496
497                                 Console.WriteLine("CreateWindow(): Called, returning {0:X}", handle.ToInt32());
498                                 return handle;
499                         #else
500                                 return driver.CreateWindow(cp);
501                         #endif
502                 }
503
504                 internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
505                         #if DriverDebug || DriverDebugCreate
506                                 Console.WriteLine("CreateWindow(): Called");
507                         #endif
508                         return driver.CreateWindow(Parent, X, Y, Width, Height);
509                 }
510
511                 internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
512                         #if DriverDebug
513                                 Console.WriteLine("ClientToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
514                         #endif
515                         driver.ClientToScreen(handle, ref x, ref y);
516                 }
517
518                 internal static int[] ClipboardAvailableFormats(IntPtr handle) {
519                         #if DriverDebug
520                                 Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
521                         #endif
522                         return driver.ClipboardAvailableFormats(handle);
523                 }
524
525                 internal static void ClipboardClose(IntPtr handle) {
526                         #if DriverDebug
527                                 Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
528                         #endif
529                         driver.ClipboardClose(handle);
530                 }
531
532                 internal static int ClipboardGetID(IntPtr handle, string format) {
533                         #if DriverDebug
534                                 Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
535                         #endif
536                         return driver.ClipboardGetID(handle, format);
537                 }
538
539                 internal static IntPtr ClipboardOpen(bool primary_selection) {
540                         #if DriverDebug
541                                 Console.WriteLine("ClipboardOpen(): Called");
542                         #endif
543                         return driver.ClipboardOpen (primary_selection);
544                 }
545
546                 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
547                         #if DriverDebug
548                                 Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, type, converter);
549                         #endif
550                         driver.ClipboardStore(handle, obj, type, converter);
551                 }
552
553                 internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
554                         #if DriverDebug
555                                 Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
556                         #endif
557                         return driver.ClipboardRetrieve(handle, type, converter);
558                 }
559
560                 internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
561                         #if DriverDebug
562                                 Console.WriteLine("DefineCursor(...): Called");
563                         #endif
564                         return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
565                 }
566
567                 internal static IntPtr DefineStdCursor(StdCursor id) {
568                         return driver.DefineStdCursor(id);
569                 }
570                 
571                 internal static Bitmap DefineStdCursorBitmap(StdCursor id) {
572                         return driver.DefineStdCursorBitmap(id);
573                 }
574
575                 internal static IntPtr DefWndProc(ref Message msg) {
576                         return driver.DefWndProc(ref msg);
577                 }
578
579                 internal static void DestroyCaret(IntPtr handle) {
580                         #if DriverDebug
581                                 Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
582                         #endif
583                         driver.DestroyCaret(handle);
584                 }
585
586                 internal static void DestroyCursor(IntPtr cursor) {
587                         #if DriverDebug
588                                 Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
589                         #endif
590                         driver.DestroyCursor(cursor);
591                 }
592
593                 internal static void DestroyWindow(IntPtr handle) {
594                         #if DriverDebug || DriverDebugDestroy
595                                 Console.WriteLine("DestroyWindow({0}): Called", Window(handle));
596                         #endif
597                         driver.DestroyWindow(handle);
598                 }
599
600                 internal static IntPtr DispatchMessage(ref MSG msg) {
601                         return driver.DispatchMessage(ref msg);
602                 }
603
604                 internal static void DoEvents() {
605                         driver.DoEvents();
606                 }
607
608                 internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
609                         #if DriverDebug
610                                 Console.WriteLine("DrawReversibleRectangle({0}, {1}, {2}): Called", Window(handle), rect, line_width);
611                         #endif
612                         driver.DrawReversibleRectangle(handle, rect, line_width);
613                 }
614
615                 internal static void FillReversibleRectangle (Rectangle rectangle, Color backColor)
616                 {
617                         #if DriverDebug
618                                 Console.WriteLine("FillReversibleRectangle({0}, {1}): Called", rectangle, backColor);
619                         #endif
620                         driver.FillReversibleRectangle (rectangle, backColor);
621                 }
622
623                 internal static void DrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style)
624                 {
625                         #if DriverDebug
626                                 Console.WriteLine("DrawReversibleFrame({0}, {1}, {2}): Called", rectangle, backColor, style);
627                         #endif
628                         driver.DrawReversibleFrame (rectangle, backColor, style);
629                 }
630
631                 internal static void DrawReversibleLine (Point start, Point end, Color backColor)
632                 {
633                         #if DriverDebug
634                                 Console.WriteLine("DrawReversibleLine({0}, {1}, {2}): Called", start, end, backColor);
635                         #endif
636                         driver.DrawReversibleLine (start, end, backColor);
637                 }
638
639                 internal static void EnableThemes() {
640                         driver.EnableThemes();
641                 }
642
643                 internal static void EnableWindow(IntPtr handle, bool Enable) {
644                         #if DriverDebug || DriverDebugState
645                                 Console.WriteLine("EnableWindow({0}, {1}): Called", Window(handle), Enable);
646                         #endif
647                         driver.EnableWindow(handle, Enable);
648                 }
649
650                 internal static void EndLoop(Thread thread) {
651                         #if DriverDebug
652                                 Console.WriteLine("EndLoop({0:X}): Called", thread.GetHashCode());
653                         #endif
654                         driver.EndLoop(thread);
655                 }
656
657                 internal static IntPtr GetActive() {
658                         #if DriverDebug
659                                 Console.WriteLine("GetActive(): Called");
660                         #endif
661                         return driver.GetActive();
662                 }
663
664                 internal static SizeF GetAutoScaleSize(Font font) {
665                         #if DriverDebug
666                                 Console.WriteLine("GetAutoScaleSize({0}): Called", font);
667                         #endif
668                         return driver.GetAutoScaleSize(font);
669                 }
670
671                 internal static Region GetClipRegion(IntPtr handle) {
672                         #if DriverDebug
673                                 Console.WriteLine("GetClipRegion({0}): Called", Window(handle));
674                         #endif
675                         return driver.GetClipRegion(handle);
676                 }
677
678                 internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
679                         #if DriverDebug
680                                 Console.WriteLine("GetCursorInfo({0}): Called", cursor.ToInt32());
681                         #endif
682                         driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
683                 }
684
685                 internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
686                         #if DriverDebug
687                                 Console.WriteLine("GetCursorPos({0}): Called", Window(handle));
688                         #endif
689                         driver.GetCursorPos(handle, out x, out y);
690                 }
691
692                 internal static void GetDisplaySize(out Size size) {
693                         #if DriverDebug
694                                 Console.WriteLine("GetDisplaySize(): Called");
695                         #endif
696                         driver.GetDisplaySize(out size);
697                 }
698
699                 internal static IntPtr GetFocus() {
700                         #if DriverDebug
701                                 Console.WriteLine("GetFocus(): Called, Result:{0}", Window(driver.GetFocus()));
702                         #endif
703                         return driver.GetFocus();
704                 }
705
706                 internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
707                         #if DriverDebug
708                                 Console.WriteLine("GetFontMetrics(): Called");
709                         #endif
710                         return driver.GetFontMetrics(g, font, out ascent, out descent);
711                 }
712                         
713                 internal static Point GetMenuOrigin(IntPtr handle) {
714                         #if DriverDebug
715                                 Console.WriteLine("GetMenuOrigin({0}): Called", Window(handle));
716                         #endif
717                         return driver.GetMenuOrigin(handle);
718                 }
719
720                 internal static bool GetMessage(object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
721                         return driver.GetMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax);
722                 }
723
724                 internal static IntPtr GetParent(IntPtr handle) {
725                         #if DriverDebug
726                                 Console.WriteLine("GetParent({0}): Called", Window(handle));
727                         #endif
728                         return driver.GetParent(handle);
729                 }
730
731                 internal static IntPtr GetPreviousWindow(IntPtr handle) {
732                         return driver.GetPreviousWindow(handle);
733                 }
734
735                 internal static bool GetText(IntPtr handle, out string text) {
736                         #if DriverDebug
737                                 Console.WriteLine("GetText({0}): Called", Window(handle));
738                         #endif
739                         return driver.GetText(handle, out text);
740                 }
741
742                 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) {
743                         #if DriverDebug
744                                 Console.WriteLine("GetWindowPos({0}): Called", Window(handle));
745                         #endif
746                         driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
747                 }
748
749                 /* this method can (and does, on X11) return
750                  * (FormWindowState)(-1), when the state of the window
751                  * cannot be determined (in the X11 case, when the
752                  * window isn't mapped.)  Checking for the additional
753                  * return value is less expensive than
754                  * throwing/catching an exception. */
755                 internal static FormWindowState GetWindowState(IntPtr handle) {
756                         #if DriverDebug
757                                 Console.WriteLine("GetWindowState({0}): Called", Window(handle));
758                         #endif
759                         return driver.GetWindowState(handle);
760                 }
761
762                 internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
763                         #if DriverDebug
764                                 Console.WriteLine("GrabInfo(): Called");
765                         #endif
766                         driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
767                 }
768
769                 internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
770                         #if DriverDebug
771                                 Console.WriteLine("GrabWindow({0}, {1}): Called", Window(handle), Window(ConfineToHwnd));
772                         #endif
773                         driver.GrabWindow(handle, ConfineToHwnd);
774                 }
775
776                 internal static void HandleException(Exception e) {
777                         driver.HandleException(e);
778                 }
779
780                 internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
781                         #if DriverDebug
782                                 Console.WriteLine("Invalidate({0}, {1}, {2}): Called", Window(handle), rc, clear);
783                         #endif
784                         driver.Invalidate(handle, rc, clear);
785                 }
786
787                 internal static void InvalidateNC (IntPtr handle)
788                 {
789                         #if DriverDebug
790                                 Console.WriteLine("InvalidateNC({0}): Called", Window(handle));
791                         #endif
792                         driver.InvalidateNC(handle);
793                 }
794
795
796                 internal static bool IsEnabled(IntPtr handle) {
797                         #if DriverDebug || DriverDebugState
798                                 Console.WriteLine("IsEnabled({0}): Called, Result={1}", Window(handle), driver.IsEnabled(handle));
799                         #endif
800                         return driver.IsEnabled(handle);
801                 }
802
803                 internal static bool IsKeyLocked (VirtualKeys key)
804                 {
805                         #if DriverDebug || DriverDebugState
806                                 Console.WriteLine("IsKeyLocked({0}): Called, Result={1}", key, driver.IsKeyLocked(key));
807                         #endif
808                         return driver.IsKeyLocked (key);
809                 }
810
811                 internal static bool IsVisible(IntPtr handle) {
812                         #if DriverDebug || DriverDebugState
813                                 Console.WriteLine("IsVisible({0}): Called, Result={1}", Window(handle), driver.IsVisible(handle));
814                         #endif
815                         return driver.IsVisible(handle);
816                 }
817
818                 internal static void KillTimer (Timer timer)
819                 {
820                         #if DriverDebug
821                                 Console.WriteLine("KillTimer({0}): Called", timer);
822                         #endif
823                         driver.KillTimer (timer);
824                 }
825
826                 internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
827                         #if DriverDebug
828                                 Console.WriteLine("MenuToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
829                         #endif
830                         driver.MenuToScreen(handle, ref x, ref y);
831                 }
832
833                 internal static void OverrideCursor(IntPtr cursor) {
834                         #if DriverDebug
835                                 Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
836                         #endif
837                         driver.OverrideCursor(cursor);
838                 }
839
840                 internal static void PaintEventEnd (ref Message msg, IntPtr handle, bool client) {
841                         #if DriverDebug || DriverDebugPaint
842                                 Console.WriteLine("PaintEventEnd({0}, {1}, {2}): Called from thread {3}", msg, Window(handle), client, Thread.CurrentThread.GetHashCode());
843                         #endif
844                         driver.PaintEventEnd (ref msg, handle, client);
845                 }
846
847                 internal static PaintEventArgs PaintEventStart (ref Message msg, IntPtr handle, bool client) {
848                         #if DriverDebug || DriverDebugPaint
849                                 Console.WriteLine("PaintEventStart({0}, {1}, {2}): Called from thread {3}", msg, Window(handle), client, Thread.CurrentThread.GetHashCode());
850                         #endif
851                         return driver.PaintEventStart (ref msg, handle, client);
852                 }
853
854                 internal static bool PeekMessage(Object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
855                         return driver.PeekMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax, flags);
856                 }
857
858                 internal static bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
859                         #if DriverDebug
860                                 Console.WriteLine("PostMessage({0}, {1}, {2:X}, {3:X}): Called", Window(hwnd), message, wParam.ToInt32(), lParam.ToInt32());
861                         #endif
862                         return driver.PostMessage(hwnd, message, wParam, lParam);
863                 }
864
865                 internal static bool PostMessage(ref MSG msg) {
866                         #if DriverDebug
867                                 Console.WriteLine("PostMessage({0}): Called", msg);
868                         #endif
869                         return driver.PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
870                 }
871
872                 internal static void PostQuitMessage(int exitCode) {
873                         #if DriverDebug
874                                 Console.WriteLine("PostQuitMessage({0}): Called", exitCode);
875                         #endif
876                         driver.PostQuitMessage(exitCode);
877                 }
878
879                 internal static void RaiseIdle (EventArgs e)
880                 {
881                         #if DriverDebug
882                                 Console.WriteLine("RaiseIdle({0}): Called", e.ToString ());
883                         #endif
884                         
885                         driver.RaiseIdle (e);
886                 }
887                 
888                 internal static void RequestAdditionalWM_NCMessages(IntPtr handle, bool hover, bool leave) {
889                         #if DriverDebug
890                                 Console.WriteLine("RequestAdditionalWM_NCMessages({0}, {1}, {2}): Called", Window(handle), hover, leave);
891                         #endif
892                         driver.RequestAdditionalWM_NCMessages (handle, hover, leave);
893                 }
894
895                 internal static void RequestNCRecalc(IntPtr handle) {
896                         #if DriverDebug
897                                 Console.WriteLine("RequestNCRecalc({0}): Called", Window(handle));
898                         #endif
899                         driver.RequestNCRecalc(handle);
900                 }
901
902                 internal static void ResetMouseHover(IntPtr handle) {
903                         #if DriverDebug
904                                 Console.WriteLine("ResetMouseHover({0}): Called", Window(handle));
905                         #endif
906                         driver.ResetMouseHover(handle);
907                 }
908
909                 internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
910                         #if DriverDebug
911                                 Console.WriteLine("ScreenToClient({0}, {1}, {2}): Called", Window(handle), x, y);
912                         #endif
913                         driver.ScreenToClient (handle, ref x, ref y);
914                 }
915
916                 internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
917                         #if DriverDebug
918                                 Console.WriteLine("ScreenToMenu({0}, {1}, {2}): Called", Window(handle), x, y);
919                         #endif
920                         driver.ScreenToMenu(handle, ref x, ref y);
921                 }
922
923                 internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
924                         #if DriverDebug
925                                 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}, {4}): Called", Window(handle), rectangle, XAmount, YAmount, with_children);
926                         #endif
927                         driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
928                 }
929
930                 internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
931                         #if DriverDebug
932                                 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}): Called", Window(handle), XAmount, YAmount, with_children);
933                         #endif
934                         driver.ScrollWindow(handle, XAmount, YAmount, with_children);
935                 }
936
937                 internal static void SendAsyncMethod (AsyncMethodData data) {
938                         #if DriverDebug
939                                 Console.WriteLine("SendAsyncMethod({0}): Called", data);
940                         #endif
941                         driver.SendAsyncMethod (data);
942                 }
943
944                 internal static int SendInput (IntPtr hwnd, Queue keys) {
945                         #if DriverDebug
946                                 Console.WriteLine("SendInput({0}, {1}): Called", hwnd, keys);
947                         #endif
948                         return driver.SendInput (hwnd, keys);
949                 }
950
951                 internal static IntPtr SendMessage (IntPtr handle, Msg message, IntPtr wParam, IntPtr lParam) {
952                         #if DriverDebug
953                                 Console.WriteLine("SendMessage ({0}, {1}, {2:X}, {3:X}): Called", Window(handle), message, wParam.ToInt32(), lParam.ToInt32());
954                         #endif
955                         return driver.SendMessage (handle, message, wParam, lParam);
956                 }
957
958                 internal static void SendMessage (ref Message m) {
959                         #if DriverDebug
960                                 Console.WriteLine("SendMessage ({0}): Called", m);
961                         #endif
962                         m.Result = driver.SendMessage(m.HWnd, (Msg)m.Msg, m.WParam, m.LParam);
963                 }
964
965                 internal static void SetAllowDrop (IntPtr handle, bool value)
966                 {
967                         #if DriverDebug
968                         Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
969                         #endif
970                         driver.SetAllowDrop (handle, value);
971                 }
972
973                 internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
974                         #if DriverDebug
975                                 Console.WriteLine("SetBorderStyle({0}, {1}): Called", Window(handle), border_style);
976                         #endif
977                         driver.SetBorderStyle(handle, border_style);
978                 }
979
980                 internal static void SetCaretPos(IntPtr handle, int x, int y) {
981                         #if DriverDebug
982                                 Console.WriteLine("SetCaretPos({0}, {1}, {2}): Called", Window(handle), x, y);
983                         #endif
984                         driver.SetCaretPos(handle, x, y);
985                 }
986
987                 internal static void SetClipRegion(IntPtr handle, Region region) {
988                         #if DriverDebug
989                                 Console.WriteLine("SetClipRegion({0}, {1}): Called", Window(handle), region);
990                         #endif
991                         driver.SetClipRegion(handle, region);
992                 }
993
994                 internal static void SetCursor(IntPtr handle, IntPtr cursor) {
995                         #if DriverDebug
996                                 Console.WriteLine("SetCursor({0}, {1:X}): Called", Window(handle), cursor.ToInt32());
997                         #endif
998                         driver.SetCursor(handle, cursor);
999                 }
1000
1001                 internal static void SetCursorPos(IntPtr handle, int x, int y) {
1002                         #if DriverDebug
1003                                 Console.WriteLine("SetCursorPos({0}, {1}, {2}): Called", Window(handle), x, y);
1004                         #endif
1005                         driver.SetCursorPos(handle, x, y);
1006                 }
1007
1008                 internal static void SetFocus(IntPtr handle) {
1009                         #if DriverDebug
1010                                 Console.WriteLine("SetFocus({0}): Called", Window(handle));
1011                         #endif
1012                         driver.SetFocus(handle);
1013                 }
1014
1015                 internal static void SetForegroundWindow(IntPtr handle) {
1016                         #if DriverDebug
1017                                 Console.WriteLine("SetForegroundWindow({0}): Called", Window(handle));
1018                         #endif
1019                         driver.SetForegroundWindow(handle);
1020                 }
1021
1022                 internal static void SetIcon(IntPtr handle, Icon icon) {
1023                         #if DriverDebug
1024                                 Console.WriteLine("SetIcon({0}, {1}): Called", Window(handle), icon);
1025                         #endif
1026                         driver.SetIcon(handle, icon);
1027                 }
1028
1029                 internal static void SetMenu(IntPtr handle, Menu menu) {
1030                         #if DriverDebug
1031                                 Console.WriteLine("SetMenu({0}, {1}): Called", Window(handle), menu);
1032                         #endif
1033                         driver.SetMenu(handle, menu);
1034                 }
1035
1036                 internal static void SetModal(IntPtr handle, bool Modal) {
1037                         #if DriverDebug || DriverDebugState
1038                                 Console.WriteLine("SetModal({0}, {1}): Called", Window(handle), Modal);
1039                         #endif
1040                         driver.SetModal(handle, Modal);
1041                 }
1042
1043                 internal static IntPtr SetParent(IntPtr handle, IntPtr hParent) {
1044                         #if DriverDebug
1045                                 Console.WriteLine("SetParent({0}, {1:X}): Called", Window(handle), Window(hParent));
1046                         #endif
1047                         return driver.SetParent(handle, hParent);
1048                 }
1049
1050                 internal static void SetTimer (Timer timer)
1051                 {
1052                         #if DriverDebug
1053                                 Console.WriteLine("SetTimer({0}): Called", timer);
1054                         #endif
1055                         driver.SetTimer (timer);
1056                 }
1057
1058                 internal static bool SetTopmost(IntPtr handle, bool Enabled) {
1059                         #if DriverDebug
1060                                 Console.WriteLine("SetTopMost({0}, {1}): Called", Window(handle), Enabled);
1061                         #endif
1062                         return driver.SetTopmost(handle, Enabled);
1063                 }
1064
1065                 internal static bool SetOwner(IntPtr handle, IntPtr hWndOwner) {
1066                         #if DriverDebug
1067                                 Console.WriteLine("SetOwner({0}, {1}): Called", Window(handle), Window(hWndOwner));
1068                         #endif
1069                         return driver.SetOwner(handle, hWndOwner);
1070                 }
1071
1072                 internal static bool SetVisible (IntPtr handle, bool visible, bool activate)
1073                 {
1074                         #if DriverDebug || DriverDebugState
1075                                 Console.WriteLine("SetVisible({0}, {1}, {2}): Called", Window(handle), visible, activate);
1076                         #endif
1077                         return driver.SetVisible (handle, visible, activate);
1078                 }
1079
1080                 internal static void SetWindowMinMax(IntPtr handle, Rectangle maximized, Size min, Size max) {
1081                         #if DriverDebug || DriverDebugState
1082                                 Console.WriteLine("SetWindowMinMax({0}, {1}, {2}, {3}): Called", Window(handle), maximized, min, max);
1083                         #endif
1084                         driver.SetWindowMinMax(handle, maximized, min, max);
1085                 }
1086
1087                 internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
1088                         #if DriverDebug
1089                                 Console.WriteLine("SetWindowPos({0}, {1}, {2}, {3}, {4}): Called", Window(handle), x, y, width, height);
1090                         #endif
1091                         driver.SetWindowPos(handle, x, y, width, height);
1092                 }
1093
1094                 internal static void SetWindowState(IntPtr handle, FormWindowState state) {
1095                         #if DriverDebug || DriverDebugState
1096                                 Console.WriteLine("SetWindowState({0} {1}): Called", Window(handle), state);
1097                         #endif
1098                         driver.SetWindowState(handle, state);
1099                 }
1100
1101                 internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
1102                         #if DriverDebug
1103                                 Console.WriteLine("SetWindowStyle({0}): Called", Window(handle));
1104                         #endif
1105                         driver.SetWindowStyle(handle, cp);
1106                 }
1107
1108                 internal static double GetWindowTransparency (IntPtr handle)
1109                 {
1110                         #if DriverDebug
1111                                 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
1112                         #endif
1113                         return driver.GetWindowTransparency(handle);
1114                 }
1115
1116                 internal static void SetWindowTransparency(IntPtr handle, double transparency, Color key) 
1117                 {
1118                         #if DriverDebug
1119                                 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
1120                         #endif
1121                         driver.SetWindowTransparency(handle, transparency, key);
1122                 }
1123
1124                 internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
1125                         #if DriverDebug
1126                                 Console.WriteLine("SetZOrder({0}, {1:X}, {2}, {3}): Called", Window(handle), Window(AfterhWnd), Top, Bottom);
1127                         #endif
1128                         return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
1129                 }
1130
1131                 internal static void ShowCursor(bool show) {
1132                         #if DriverDebug
1133                                 Console.WriteLine("ShowCursor({0}): Called", show);
1134                         #endif
1135                         driver.ShowCursor(show);
1136                 }
1137
1138                 internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
1139                         #if DriverDebug
1140                         Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", Window(handle), data, allowedEffects);
1141                         #endif
1142                         return driver.StartDrag (handle, data, allowedEffects);
1143                 }
1144
1145                 internal static object StartLoop(Thread thread) {
1146                         #if DriverDebug
1147                                 Console.WriteLine("StartLoop({0:X}): Called", thread.GetHashCode());
1148                         #endif
1149                         return driver.StartLoop(thread);
1150                 }
1151
1152                 internal static TransparencySupport SupportsTransparency() {
1153                         #if DriverDebug
1154                                 Console.WriteLine("SupportsTransparency(): Called, result={0}", driver.SupportsTransparency());
1155                         #endif
1156                         return driver.SupportsTransparency();
1157                 }
1158
1159                 internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
1160                         #if DriverDebug
1161                                 Console.WriteLine("SystrayAdd({0}, {1}): Called", Window(handle), tip);
1162                         #endif
1163                         return driver.SystrayAdd(handle, tip, icon, out tt);
1164                 }
1165
1166                 internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
1167                         #if DriverDebug
1168                                 Console.WriteLine("SystrayChange({0}, {1}): Called", Window(handle), tip);
1169                         #endif
1170                         driver.SystrayChange(handle, tip, icon, ref tt);
1171                 }
1172
1173                 internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
1174                         #if DriverDebug
1175                                 Console.WriteLine("SystrayRemove({0}): Called", Window(handle));
1176                         #endif
1177                         driver.SystrayRemove(handle, ref tt);
1178                 }
1179
1180 #if NET_2_0
1181                 internal static void SystrayBalloon(IntPtr handle, int timeout, string title, string text, ToolTipIcon icon) {
1182                         #if DriverDebug
1183                                 Console.WriteLine("SystrayBalloon ({0}, {1}, {2}, {3}, {4}): Called", Window(handle), timeout, title, text, icon);
1184                         #endif
1185                         driver.SystrayBalloon(handle, timeout, title, text, icon);
1186                 }
1187 #endif
1188
1189                 internal static bool Text(IntPtr handle, string text) {
1190                         #if DriverDebug
1191                                 Console.WriteLine("Text({0}, {1}): Called", Window(handle), text);
1192                         #endif
1193                         return driver.Text(handle, text);
1194                 }
1195
1196                 internal static bool TranslateMessage(ref MSG msg) {
1197                         return driver.TranslateMessage(ref msg);
1198                 }
1199
1200                 internal static void UngrabWindow(IntPtr handle) {
1201                         #if DriverDebug
1202                                 Console.WriteLine("UngrabWindow({0}): Called", Window(handle));
1203                         #endif
1204                         driver.UngrabWindow(handle);
1205                 }
1206
1207                 internal static void UpdateWindow(IntPtr handle) {
1208                         #if DriverDebug
1209                                 Console.WriteLine("UpdateWindow({0}): Called", Window(handle));
1210                         #endif
1211                         driver.UpdateWindow(handle);
1212                 }
1213
1214                 // double buffering
1215                 internal static void CreateOffscreenDrawable (IntPtr handle,
1216                                                             int width, int height,
1217                                                             out object offscreen_drawable)
1218                 {
1219 #if DriverDebug
1220                         Console.WriteLine("CreateOffscreenDrawable({2}, {0},{1}): Called", width, height, Window(handle));
1221 #endif
1222                         driver.CreateOffscreenDrawable (handle, width, height,
1223                                                         out offscreen_drawable);
1224                 }
1225
1226                 internal static void DestroyOffscreenDrawable (object offscreen_drawable)
1227                 {
1228 #if DriverDebug
1229                         Console.WriteLine("DestroyOffscreenDrawable(): Called");
1230 #endif
1231                         driver.DestroyOffscreenDrawable (offscreen_drawable);
1232                 }
1233
1234                 internal static Graphics GetOffscreenGraphics (object offscreen_drawable)
1235                 {
1236 #if DriverDebug
1237                         Console.WriteLine("GetOffscreenGraphics(): Called");
1238 #endif
1239                         return driver.GetOffscreenGraphics (offscreen_drawable);
1240                 }
1241
1242                 internal static void BlitFromOffscreen (IntPtr dest_handle,
1243                                                       Graphics dest_dc,
1244                                                       object offscreen_drawable,
1245                                                       Graphics offscreen_dc,
1246                                                       Rectangle r)
1247                 {
1248 #if DriverDebug
1249                         Console.WriteLine("BlitFromOffscreen({0}): Called", Window(dest_handle));
1250 #endif
1251                         driver.BlitFromOffscreen (dest_handle, dest_dc, offscreen_drawable, offscreen_dc, r);
1252                 }
1253
1254
1255                 // Santa's little helper
1256                 internal static void Version() {
1257                         Console.WriteLine("Xplat version $Revision: $");
1258                 }
1259
1260                 internal static void AddKeyFilter (IKeyFilter value)
1261                 {
1262                         lock (key_filters) {
1263                                 key_filters.Add (value);
1264                         }
1265                 }
1266
1267                 internal static bool FilterKey (KeyFilterData key)
1268                 {
1269                         lock (key_filters) {
1270                                 for (int i = 0; i < key_filters.Count; i++) {
1271                                         IKeyFilter filter = (IKeyFilter) key_filters[i];
1272                                         if (filter.PreFilterKey (key))
1273                                                 return true;
1274                                 }
1275                         }
1276                         return false;
1277                 }
1278                 #endregion      // Public Static Methods
1279
1280                 #region Delegates
1281                 public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
1282                 public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
1283                 #endregion      // Delegates
1284
1285                 [DllImport ("libc")]
1286                 static extern int uname (IntPtr buf);
1287         }
1288 }