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