Add this for backwards compatibility
[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-2005 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
30 using System;
31 using System.Drawing;
32 using System.ComponentModel;
33 using System.Collections;
34 using System.Diagnostics;
35 using System.Runtime.InteropServices;
36
37 /// X11 Version
38 namespace System.Windows.Forms {
39         internal class XplatUI {
40                 #region Local Variables
41                 static XplatUIDriver            driver;
42                 static String                   default_class_name;
43                 #endregion      // Local Variables
44
45                 #region Subclasses
46                 public class State {
47                         static public Keys ModifierKeys {
48                                 get {
49                                         return driver.ModifierKeys;
50                                 }
51                         }
52
53                         static public MouseButtons MouseButtons {
54                                 get {
55                                         return driver.MouseButtons;
56                                 }
57                         }
58
59                         static public Point MousePosition {
60                                 get {
61                                         return driver.MousePosition;
62                                 }
63                         }
64
65                 }
66                 #endregion      // Subclasses
67
68                 #region Constructor & Destructor
69                 static XplatUI() {
70                         Console.WriteLine("Mono System.Windows.Forms Assembly [Revision: 54007; built: 2005/12/6 14:35:24]");
71
72                         // Don't forget to throw the mac in here somewhere, too
73                         default_class_name="SWFClass";
74
75                         // check for Unix platforms - see FAQ for more details
76                         // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
77                         int platform = (int) Environment.OSVersion.Platform;
78                         if ((platform == 4) || (platform == 128)) {
79                                 if (Environment.GetEnvironmentVariable ("MONO_MWF_USE_QUARTZ_BACKEND") != null)
80                                         driver=XplatUIOSX.GetInstance();
81                                 else
82                                         driver=XplatUIX11.GetInstance();
83                         } else {
84                                 driver=XplatUIWin32.GetInstance();
85                         }
86
87                         driver.InitializeDriver();
88
89                         // Initialize things that need to be done after the driver is ready
90                         DataFormats.GetFormat(0);
91                 }
92                 #endregion      // Constructor & Destructor
93
94                 #region Public Static Properties
95                 internal static string DefaultClassName {
96                         get {
97                                 return default_class_name;
98                         }
99
100                         set {
101                                 default_class_name=value;
102                         }
103                 }
104
105                 static public int CaptionHeight {
106                         get {
107                                 return driver.Caption;
108                         }
109                 }
110
111                 static public Size CursorSize {
112                         get {
113                                 return driver.CursorSize;
114                         }
115                 }
116
117                 static public bool DragFullWindows {
118                         get {
119                                 return driver.DragFullWindows;
120                         }
121                 }
122
123                 static public Size DragSize {
124                         get {
125                                 return driver.DragSize;
126                         }
127                 }
128
129                 public static Size FrameBorderSize {
130                         get {
131                                 return driver.FrameBorderSize;
132                         }
133                 }
134
135                 static public Size IconSize {
136                         get {
137                                 return driver.IconSize;
138                         }
139                 }
140
141                 static public int KeyboardSpeed {
142                         get {
143                                 return driver.KeyboardSpeed;
144                         }
145                 }
146
147                 static public int KeyboardDelay {
148                         get {
149                                 return driver.KeyboardSpeed;
150                         }
151                 }
152
153                 static public Size MaxWindowTrackSize {
154                         get {
155                                 return driver.MaxWindowTrackSize;
156                         }
157                 }
158
159                 static public Size MinimizedWindowSize {
160                         get {
161                                 return driver.MinimizedWindowSize;
162                         }
163                 }
164
165                 static public Size MinimizedWindowSpacingSize {
166                         get {
167                                 return driver.MinimizedWindowSpacingSize;
168                         }
169                 }
170
171                 static public Size MinimumWindowSize {
172                         get {
173                                 return driver.MinimumWindowSize;
174                         }
175                 }
176
177                 static public Size MinWindowTrackSize {
178                         get {
179                                 return driver.MinWindowTrackSize;
180                         }
181                 }
182
183                 static public Size SmallIconSize {
184                         get {
185                                 return driver.SmallIconSize;
186                         }
187                 }
188
189                 static public int MouseButtonCount {
190                         get {
191                                 return driver.MouseButtonCount;
192                         }
193                 }
194
195                 static public bool MouseButtonsSwapped {
196                         get {
197                                 return driver.MouseButtonsSwapped;
198                         }
199                 }
200
201                 static public bool MouseWheelPresent {
202                         get {
203                                 return driver.MouseWheelPresent;
204                         }
205                 }
206
207                 static public Rectangle VirtualScreen {
208                         get {
209                                 return driver.VirtualScreen;
210                         }
211                 }
212
213                 static public Rectangle WorkingArea {
214                         get {
215                                 return driver.WorkingArea;
216                         }
217                 }
218                 #endregion      // Public Static Properties
219
220                 #region Events
221                 internal static event EventHandler Idle {
222                         add {
223                                 driver.Idle += value;
224                         }
225                         remove {
226                                 driver.Idle -= value;
227                         }
228                 }
229                 
230                 #endregion      // Events
231
232                 #region Public Static Methods
233                 internal static void Activate(IntPtr handle) {
234                         #if DriverDebug
235                                 Console.WriteLine("Activate({0:X}): Called", handle.ToInt32());
236                         #endif
237                         driver.Activate(handle);
238                 }
239
240                 internal static void AudibleAlert() {
241                         #if DriverDebug
242                                 Console.WriteLine("AudibleAlert(): Called");
243                         #endif
244                         driver.AudibleAlert();
245                 }
246
247                 internal static bool CalculateWindowRect(IntPtr handle, ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect) {
248                         #if DriverDebug
249                                 Console.WriteLine("CalculateWindowRect({0:X}): Called", handle.ToInt32());
250                         #endif
251                         return driver.CalculateWindowRect(handle, ref ClientRect, Style, ExStyle, menu, out WindowRect);
252                 }
253
254                 internal static void CaretVisible(IntPtr handle, bool visible) {
255                         #if DriverDebug
256                                 Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
257                         #endif
258                         driver.CaretVisible(handle, visible);
259                 }
260
261                 internal static void CreateCaret(IntPtr handle, int width, int height) {
262                         #if DriverDebug
263                                 Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
264                         #endif
265                         driver.CreateCaret(handle, width, height);
266                 }
267
268                 internal static IntPtr CreateWindow(CreateParams cp) {
269                         #if DriverDebug
270                                 Console.WriteLine("CreateWindow(): Called");
271                         #endif
272                         return driver.CreateWindow(cp);
273                 }
274
275                 internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
276                         #if DriverDebug
277                                 Console.WriteLine("CreateWindow(): Called");
278                         #endif
279                         return driver.CreateWindow(Parent, X, Y, Width, Height);
280                 }
281
282                 internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
283                         #if DriverDebug
284                                 Console.WriteLine("ClientToScreen({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
285                         #endif
286                         driver.ClientToScreen(handle, ref x, ref y);
287                 }
288
289                 internal static int[] ClipboardAvailableFormats(IntPtr handle) {
290                         #if DriverDebug
291                                 Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
292                         #endif
293                         return driver.ClipboardAvailableFormats(handle);
294                 }
295
296                 internal static void ClipboardClose(IntPtr handle) {
297                         #if DriverDebug
298                                 Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
299                         #endif
300                         driver.ClipboardClose(handle);
301                 }
302
303                 internal static int ClipboardGetID(IntPtr handle, string format) {
304                         #if DriverDebug
305                                 Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
306                         #endif
307                         return driver.ClipboardGetID(handle, format);
308                 }
309
310                 internal static IntPtr ClipboardOpen() {
311                         #if DriverDebug
312                                 Console.WriteLine("ClipboardOpen(): Called");
313                         #endif
314                         return driver.ClipboardOpen();
315                 }
316
317                 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
318                         #if DriverDebug
319                                 Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, (ClipboardFormat)type, converter);
320                         #endif
321                         driver.ClipboardStore(handle, obj, type, converter);
322                 }
323
324                 internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
325                         #if DriverDebug
326                                 Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
327                         #endif
328                         return driver.ClipboardRetrieve(handle, type, converter);
329                 }
330
331                 internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
332                         #if DriverDebug
333                                 Console.WriteLine("DefineCursor(...): Called");
334                         #endif
335                         return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
336                 }
337
338                 internal static IntPtr DefineStdCursor(StdCursor id) {
339                         return driver.DefineStdCursor(id);
340                 }
341
342                 internal static IntPtr DefWndProc(ref Message msg) {
343                         return driver.DefWndProc(ref msg);
344                 }
345
346                 internal static void DestroyCaret(IntPtr handle) {
347                         #if DriverDebug
348                                 Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
349                         #endif
350                         driver.DestroyCaret(handle);
351                 }
352
353                 internal static void DestroyCursor(IntPtr cursor) {
354                         #if DriverDebug
355                                 Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
356                         #endif
357                         driver.DestroyCursor(cursor);
358                 }
359
360                 internal static void DestroyWindow(IntPtr handle) {
361                         #if DriverDebug
362                                 Console.WriteLine("DestroyWindow({0:X}): Called", handle.ToInt32());
363                         #endif
364                         driver.DestroyWindow(handle);
365                 }
366
367                 internal static IntPtr DispatchMessage(ref MSG msg) {
368                         return driver.DispatchMessage(ref msg);
369                 }
370
371                 internal static void DoEvents() {
372                         driver.DoEvents();
373                 }
374
375                 internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
376                         #if DriverDebug
377                                 Console.WriteLine("DrawReversibleRectangle({0:X}, {1}, {2}): Called", handle.ToInt32(), rect, line_width);
378                         #endif
379                         driver.DrawReversibleRectangle(handle, rect, line_width);
380                 }
381
382                 internal static void EnableThemes() {
383                         driver.EnableThemes();
384                 }
385
386                 internal static void EnableWindow(IntPtr handle, bool Enable) {
387                         #if DriverDebug
388                                 Console.WriteLine("EnableWindow({0:X}, {1}): Called", handle.ToInt32(), Enable);
389                         #endif
390                         driver.EnableWindow(handle, Enable);
391                 }
392
393                 internal static IntPtr GetActive() {
394                         #if DriverDebug
395                                 Console.WriteLine("GetActive(): Called");
396                         #endif
397                         return driver.GetActive();
398                 }
399
400                 internal static SizeF GetAutoScaleSize(Font font) {
401                         #if DriverDebug
402                                 Console.WriteLine("GetAutoScaleSize({0}): Called", font);
403                         #endif
404                         return driver.GetAutoScaleSize(font);
405                 }
406
407                 internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
408                         #if DriverDebug
409                                 Console.WriteLine("GetCursorInfo({0:X}): Called", cursor.ToInt32());
410                         #endif
411                         driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
412                 }
413
414                 internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
415                         #if DriverDebug
416                                 Console.WriteLine("GetCursorPos({0:X}): Called", handle.ToInt32());
417                         #endif
418                         driver.GetCursorPos(handle, out x, out y);
419                 }
420
421                 internal static void GetDisplaySize(out Size size) {
422                         #if DriverDebug
423                                 Console.WriteLine("GetDisplaySize(): Called");
424                         #endif
425                         driver.GetDisplaySize(out size);
426                 }
427
428                 internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
429                         #if DriverDebug
430                                 Console.WriteLine("GetFontMetrics(): Called");
431                         #endif
432                         return driver.GetFontMetrics(g, font, out ascent, out descent);
433                 }
434                         
435                 internal static Graphics GetMenuDC(IntPtr handle, IntPtr ncpaint_region) {
436                         #if DriverDebug
437                                 Console.WriteLine("GetMenuDC({0:X}): Called", handle.ToInt32());
438                         #endif
439                         return driver.GetMenuDC(handle, ncpaint_region);
440                 }
441
442                 internal static Point GetMenuOrigin(IntPtr handle) {
443                         #if DriverDebug
444                                 Console.WriteLine("GetMenuOrigin({0:X}): Called", handle.ToInt32());
445                         #endif
446                         return driver.GetMenuOrigin(handle);
447                 }
448
449                 internal static bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
450                         return driver.GetMessage(ref msg, hWnd, wFilterMin, wFilterMax);
451                 }
452
453                 internal static IntPtr GetParent(IntPtr hWnd) {
454                         #if DriverDebug
455                                 Console.WriteLine("GetParent({0:X}): Called", hWnd.ToInt32());
456                         #endif
457                         return driver.GetParent(hWnd);
458                 }
459
460                 internal static bool GetText(IntPtr hWnd, out string text) {
461                         #if DriverDebug
462                                 Console.WriteLine("GetText(): Called");
463                         #endif
464                         return driver.GetText(hWnd, out text);
465                 }
466
467                 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) {
468                         #if DriverDebug
469                                 Console.WriteLine("GetWindowPos({0:X}): Called", handle.ToInt32());
470                         #endif
471                         driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
472                 }
473
474                 internal static FormWindowState GetWindowState(IntPtr handle) {
475                         #if DriverDebug
476                                 Console.WriteLine("GetWindowState({0:X}): Called", handle.ToInt32());
477                         #endif
478                         return driver.GetWindowState(handle);
479                 }
480
481                 internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
482                         #if DriverDebug
483                                 Console.WriteLine("GrabInfo(): Called");
484                         #endif
485                         driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
486                 }
487
488                 internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
489                         #if DriverDebug
490                                 Console.WriteLine("GrabWindow({0:X}): Called", handle.ToInt32());
491                         #endif
492                         driver.GrabWindow(handle, ConfineToHwnd);
493                 }
494
495                 internal static void HandleException(Exception e) {
496                         driver.HandleException(e);
497                 }
498
499                 internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
500                         #if DriverDebug
501                                 Console.WriteLine("Invalidate({0:X}, {1}, {2}): Called", handle.ToInt32(), rc, clear);
502                         #endif
503                         driver.Invalidate(handle, rc, clear);
504                 }
505
506                 internal static bool IsVisible(IntPtr hWnd) {
507                         #if DriverDebug
508                                 Console.WriteLine("IsVisible({0:X}): Called", hWnd.ToInt32());
509                         #endif
510                         return driver.IsVisible(hWnd);
511                 }
512
513                 internal static void KillTimer (Timer timer)
514                 {
515                         #if DriverDebug
516                                 Console.WriteLine("KillTimer({0}): Called", timer);
517                         #endif
518                         driver.KillTimer (timer);
519                 }
520
521                 internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
522                         #if DriverDebug
523                                 Console.WriteLine("MenuToScreen({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
524                         #endif
525                         driver.MenuToScreen(handle, ref x, ref y);
526                 }
527
528                 internal static void OverrideCursor(IntPtr cursor) {
529                         #if DriverDebug
530                                 Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
531                         #endif
532                         driver.OverrideCursor(cursor);
533                 }
534
535                 internal static void PaintEventEnd(IntPtr handle, bool client) {
536                         #if DriverDebug
537                                 Console.WriteLine("PaintEventEnd({0:X}, {1}): Called", handle.ToInt32(), client);
538                         #endif
539                         driver.PaintEventEnd(handle, client);
540                 }
541
542                 internal static PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
543                         #if DriverDebug
544                                 Console.WriteLine("PaintEventStart({0:X}, {1}): Called", handle.ToInt32(), client);
545                         #endif
546                         return driver.PaintEventStart(handle, client);
547                 }
548
549                 internal static bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
550                         return driver.PeekMessage(ref msg, hWnd, wFilterMin, wFilterMax, flags);
551                 }
552
553                 internal static void PostQuitMessage(int exitCode) {
554                         driver.PostQuitMessage(exitCode);
555                 }
556
557                 internal static void ReleaseMenuDC(IntPtr handle, Graphics dc) {
558                         #if DriverDebug
559                                 Console.WriteLine("ReleaseMenuDC({0:X}): Called", handle.ToInt32());
560                         #endif
561                         driver.ReleaseMenuDC(handle, dc);
562                 }
563
564                 internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
565                         #if DriverDebug
566                                 Console.WriteLine("ScreenToClient({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
567                         #endif
568                         driver.ScreenToClient (handle, ref x, ref y);
569                 }
570
571                 internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
572                         #if DriverDebug
573                                 Console.WriteLine("ScreenToMenu({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
574                         #endif
575                         driver.ScreenToMenu(handle, ref x, ref y);
576                 }
577
578                 internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
579                         #if DriverDebug
580                                 Console.WriteLine("ScrollWindow({0:X}, {1}, {2}, {3}, {4}): Called", handle.ToInt32(), rectangle, XAmount, YAmount, with_children);
581                         #endif
582                         driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
583                 }
584
585                 internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
586                         #if DriverDebug
587                                 Console.WriteLine("ScrollWindow({0:X}, {2}, {3}, {4}): Called", handle.ToInt32(), XAmount, YAmount, with_children);
588                         #endif
589                         driver.ScrollWindow(handle, XAmount, YAmount, with_children);
590                 }
591
592                 internal static void SendAsyncMethod (AsyncMethodData data) {
593                         #if DriverDebug
594                                 Console.WriteLine("SendAsyncMethod({0}): Called", data);
595                         #endif
596                         driver.SendAsyncMethod (data);
597                 }
598
599                 internal static void SetAllowDrop (IntPtr handle, bool value)
600                 {
601                         #if DriverDebug
602                         Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
603                         #endif
604                         driver.SetAllowDrop (handle, value);
605                 }
606
607                 internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
608                         #if DriverDebug
609                                 Console.WriteLine("SetBorderStyle({0:X}, {1}): Called", handle.ToInt32(), border_style);
610                         #endif
611                         driver.SetBorderStyle(handle, border_style);
612                 }
613
614                 internal static void SetCaretPos(IntPtr handle, int x, int y) {
615                         #if DriverDebug
616                                 Console.WriteLine("SetCaretPos({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
617                         #endif
618                         driver.SetCaretPos(handle, x, y);
619                 }
620
621                 internal static void SetCursor(IntPtr handle, IntPtr cursor) {
622                         #if DriverDebug
623                                 Console.WriteLine("SetCursor({0:X}, {1:X}): Called", handle.ToInt32(), cursor.ToInt32());
624                         #endif
625                         driver.SetCursor(handle, cursor);
626                 }
627
628                 internal static void SetCursorPos(IntPtr handle, int x, int y) {
629                         #if DriverDebug
630                                 Console.WriteLine("SetCursorPos({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
631                         #endif
632                         driver.SetCursorPos(handle, x, y);
633                 }
634
635                 internal static void SetFocus(IntPtr handle) {
636                         #if DriverDebug
637                                 Console.WriteLine("SetFocus({0:X}): Called", handle.ToInt32());
638                         #endif
639                         driver.SetFocus(handle);
640                 }
641
642                 internal static void SetIcon(IntPtr handle, Icon icon) {
643                         #if DriverDebug
644                                 Console.WriteLine("SetIcon({0:X}, {1}): Called", handle.ToInt32(), icon);
645                         #endif
646                         driver.SetIcon(handle, icon);
647                 }
648
649                 internal static void SetMenu(IntPtr handle, Menu menu) {
650                         #if DriverDebug
651                                 Console.WriteLine("SetMenu({0:X}, {1}): Called", handle.ToInt32(), menu);
652                         #endif
653                         driver.SetMenu(handle, menu);
654                 }
655
656                 internal static void SetModal(IntPtr handle, bool Modal) {
657                         #if DriverDebug
658                                 Console.WriteLine("SetModal({0:X}, {1}): Called", handle.ToInt32(), Modal);
659                         #endif
660                         driver.SetModal(handle, Modal);
661                 }
662
663                 internal static IntPtr SetParent(IntPtr hWnd, IntPtr hParent) {
664                         #if DriverDebug
665                                 Console.WriteLine("SetParent({0:X}, {1:X}): Called", hWnd.ToInt32(), hParent.ToInt32());
666                         #endif
667                         return driver.SetParent(hWnd, hParent);
668                 }
669
670                 internal static void SetTimer (Timer timer)
671                 {
672                         #if DriverDebug
673                                 Console.WriteLine("SetTimer({0}): Called", timer);
674                         #endif
675                         driver.SetTimer (timer);
676                 }
677
678                 internal static bool SetTopmost(IntPtr handle, IntPtr hWndOwner, bool Enabled) {
679                         #if DriverDebug
680                                 Console.WriteLine("SetTopMost({0:X}, {1:X}, {2}): Called", handle.ToInt32(), hWndOwner.ToInt32(), Enabled);
681                         #endif
682                         return driver.SetTopmost(handle, hWndOwner, Enabled);
683                 }
684
685                 internal static bool SetVisible(IntPtr hWnd, bool visible) {
686                         #if DriverDebug
687                                 Console.WriteLine("SetVisible({0:X}, {1}): Called", hWnd.ToInt32(), visible);
688                         #endif
689                         return driver.SetVisible(hWnd, visible);
690                 }
691
692                 internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
693                         #if DriverDebug
694                                 Console.WriteLine("SetWindowPos({0:X}, {1}, {2}, {3}, {4}): Called", handle.ToInt32(), x, y, width, height);
695                         #endif
696                         driver.SetWindowPos(handle, x, y, width, height);
697                 }
698
699                 internal static void SetWindowState(IntPtr handle, FormWindowState state) {
700                         #if DriverDebug
701                                 Console.WriteLine("SetWindowState({0:X} {1}): Called", handle.ToInt32(), state);
702                         #endif
703                         driver.SetWindowState(handle, state);
704                 }
705
706                 internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
707                         #if DriverDebug
708                                 Console.WriteLine("SetWindowStyle({0:X}): Called", handle.ToInt32());
709                         #endif
710                         driver.SetWindowStyle(handle, cp);
711                 }
712
713                 internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
714                         #if DriverDebug
715                                 Console.WriteLine("SetZOrder({0:X}, {1:X}, {2}, {3}): Called", handle.ToInt32(), AfterhWnd.ToInt32(), Top, Bottom);
716                         #endif
717                         return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
718                 }
719
720                 internal static void ShowCursor(bool show) {
721                         #if DriverDebug
722                                 Console.WriteLine("ShowCursor({0}): Called", show);
723                         #endif
724                         driver.ShowCursor(show);
725                 }
726
727                 internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
728                         #if DriverDebug
729                         Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", handle, data, allowedEffects);
730                         #endif
731                         return driver.StartDrag (handle, data, allowedEffects);
732                 }
733
734                 internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
735                         #if DriverDebug
736                                 Console.WriteLine("SystrayAdd({0:X}, {1}): Called", handle.ToInt32(), tip);
737                         #endif
738                         return driver.SystrayAdd(handle, tip, icon, out tt);
739                 }
740
741                 internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
742                         #if DriverDebug
743                                 Console.WriteLine("SystrayChange({0:X}, {1}): Called", handle.ToInt32(), tip);
744                         #endif
745                         driver.SystrayChange(handle, tip, icon, ref tt);
746                 }
747
748                 internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
749                         #if DriverDebug
750                                 Console.WriteLine("SystrayRemove({0:X}): Called", handle.ToInt32());
751                         #endif
752                         driver.SystrayRemove(handle, ref tt);
753                 }
754
755                 internal static bool Text(IntPtr hWnd, string text) {
756                         #if DriverDebug
757                                 Console.WriteLine("Text({0:X}, {1}): Called", hWnd.ToInt32(), text);
758                         #endif
759                         return driver.Text(hWnd, text);
760                 }
761
762                 internal static bool TranslateMessage(ref MSG msg) {
763                         return driver.TranslateMessage(ref msg);
764                 }
765
766                 internal static void UngrabWindow(IntPtr handle) {
767                         #if DriverDebug
768                                 Console.WriteLine("UngrabWindow({0:X}): Called", handle.ToInt32());
769                         #endif
770                         driver.UngrabWindow(handle);
771                 }
772
773                 internal static void UpdateWindow(IntPtr handle) {
774                         #if DriverDebug
775                                 Console.WriteLine("UpdateWindow({0:X}): Called", handle.ToInt32());
776                         #endif
777                         driver.UpdateWindow(handle);
778                 }
779
780                 // Santa's little helper
781                 internal static void Version() {
782                         Console.WriteLine("Xplat version $Revision: $");
783                 }
784
785                 internal static void Where() {
786                         XplatUIX11.Where();
787                 }
788                 #endregion      // Public Static Methods
789
790                 #region Delegates
791                 public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
792                 public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
793                 #endregion      // Delegates
794
795         }
796 }