ec7d4890e4fef0b3e7857888f1743c20af1e7000
[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: 52467; built: 2005/11/3 12:50:32]");
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 bool CalculateWindowRect(IntPtr handle, ref Rectangle ClientRect, int Style, int ExStyle, IntPtr MenuHandle, out Rectangle WindowRect) {
241                         #if DriverDebug
242                                 Console.WriteLine("CalculateWindowRect({0:X}): Called", handle.ToInt32());
243                         #endif
244                         return driver.CalculateWindowRect(handle, ref ClientRect, Style, ExStyle, MenuHandle, out WindowRect);
245                 }
246
247                 internal static void CaretVisible(IntPtr handle, bool visible) {
248                         #if DriverDebug
249                                 Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
250                         #endif
251                         driver.CaretVisible(handle, visible);
252                 }
253
254                 internal static void CreateCaret(IntPtr handle, int width, int height) {
255                         #if DriverDebug
256                                 Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
257                         #endif
258                         driver.CreateCaret(handle, width, height);
259                 }
260
261                 internal static IntPtr CreateWindow(CreateParams cp) {
262                         #if DriverDebug
263                                 Console.WriteLine("CreateWindow(): Called");
264                         #endif
265                         return driver.CreateWindow(cp);
266                 }
267
268                 internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
269                         #if DriverDebug
270                                 Console.WriteLine("CreateWindow(): Called");
271                         #endif
272                         return driver.CreateWindow(Parent, X, Y, Width, Height);
273                 }
274
275                 internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
276                         #if DriverDebug
277                                 Console.WriteLine("ClientToScreen({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
278                         #endif
279                         driver.ClientToScreen(handle, ref x, ref y);
280                 }
281
282                 internal static int[] ClipboardAvailableFormats(IntPtr handle) {
283                         #if DriverDebug
284                                 Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
285                         #endif
286                         return driver.ClipboardAvailableFormats(handle);
287                 }
288
289                 internal static void ClipboardClose(IntPtr handle) {
290                         #if DriverDebug
291                                 Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
292                         #endif
293                         driver.ClipboardClose(handle);
294                 }
295
296                 internal static int ClipboardGetID(IntPtr handle, string format) {
297                         #if DriverDebug
298                                 Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
299                         #endif
300                         return driver.ClipboardGetID(handle, format);
301                 }
302
303                 internal static IntPtr ClipboardOpen() {
304                         #if DriverDebug
305                                 Console.WriteLine("ClipboardOpen(): Called");
306                         #endif
307                         return driver.ClipboardOpen();
308                 }
309
310                 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
311                         #if DriverDebug
312                                 Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, (ClipboardFormat)type, converter);
313                         #endif
314                         driver.ClipboardStore(handle, obj, type, converter);
315                 }
316
317                 internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
318                         #if DriverDebug
319                                 Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
320                         #endif
321                         return driver.ClipboardRetrieve(handle, type, converter);
322                 }
323
324                 internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
325                         #if DriverDebug
326                                 Console.WriteLine("DefineCursor(...): Called");
327                         #endif
328                         return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
329                 }
330
331                 internal static IntPtr DefineStdCursor(StdCursor id) {
332                         return driver.DefineStdCursor(id);
333                 }
334
335                 internal static IntPtr DefWndProc(ref Message msg) {
336                         return driver.DefWndProc(ref msg);
337                 }
338
339                 internal static void DestroyCaret(IntPtr handle) {
340                         #if DriverDebug
341                                 Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
342                         #endif
343                         driver.DestroyCaret(handle);
344                 }
345
346                 internal static void DestroyCursor(IntPtr cursor) {
347                         #if DriverDebug
348                                 Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
349                         #endif
350                         driver.DestroyCursor(cursor);
351                 }
352
353                 internal static void DestroyWindow(IntPtr handle) {
354                         #if DriverDebug
355                                 Console.WriteLine("DestroyWindow({0:X}): Called", handle.ToInt32());
356                         #endif
357                         driver.DestroyWindow(handle);
358                 }
359
360                 internal static IntPtr DispatchMessage(ref MSG msg) {
361                         return driver.DispatchMessage(ref msg);
362                 }
363
364                 internal static void DoEvents() {
365                         driver.DoEvents();
366                 }
367
368                 internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
369                         #if DriverDebug
370                                 Console.WriteLine("DrawReversibleRectangle({0:X}, {1}, {2}): Called", handle.ToInt32(), rect, line_width);
371                         #endif
372                         driver.DrawReversibleRectangle(handle, rect, line_width);
373                 }
374
375                 internal static void EnableThemes() {
376                         driver.EnableThemes();
377                 }
378
379                 internal static void EnableWindow(IntPtr handle, bool Enable) {
380                         #if DriverDebug
381                                 Console.WriteLine("EnableWindow({0:X}, {1}): Called", handle.ToInt32(), Enable);
382                         #endif
383                         driver.EnableWindow(handle, Enable);
384                 }
385
386                 internal static void Exit() {
387                         driver.Exit();
388                 }
389
390                 internal static IntPtr GetActive() {
391                         #if DriverDebug
392                                 Console.WriteLine("GetActive(): Called");
393                         #endif
394                         return driver.GetActive();
395                 }
396
397                 internal static SizeF GetAutoScaleSize(Font font) {
398                         #if DriverDebug
399                                 Console.WriteLine("GetAutoScaleSize({0}): Called", font);
400                         #endif
401                         return driver.GetAutoScaleSize(font);
402                 }
403
404                 internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
405                         #if DriverDebug
406                                 Console.WriteLine("GetCursorInfo({0:X}): Called", cursor.ToInt32());
407                         #endif
408                         driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
409                 }
410
411                 internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
412                         #if DriverDebug
413                                 Console.WriteLine("GetCursorPos({0:X}): Called", handle.ToInt32());
414                         #endif
415                         driver.GetCursorPos(handle, out x, out y);
416                 }
417
418                 internal static void GetDisplaySize(out Size size) {
419                         #if DriverDebug
420                                 Console.WriteLine("GetDisplaySize(): Called");
421                         #endif
422                         driver.GetDisplaySize(out size);
423                 }
424
425                 internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
426                         #if DriverDebug
427                                 Console.WriteLine("GetFontMetrics(): Called");
428                         #endif
429                         return driver.GetFontMetrics(g, font, out ascent, out descent);
430                 }
431                         
432                 internal static Graphics GetMenuDC(IntPtr handle, IntPtr ncpaint_region) {
433                         #if DriverDebug
434                                 Console.WriteLine("GetMenuDC({0:X}): Called", handle.ToInt32());
435                         #endif
436                         return driver.GetMenuDC(handle, ncpaint_region);
437                 }
438
439                 internal static Point GetMenuOrigin(IntPtr handle) {
440                         #if DriverDebug
441                                 Console.WriteLine("GetMenuOrigin({0:X}): Called", handle.ToInt32());
442                         #endif
443                         return driver.GetMenuOrigin(handle);
444                 }
445
446                 internal static bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
447                         return driver.GetMessage(ref msg, hWnd, wFilterMin, wFilterMax);
448                 }
449
450                 internal static IntPtr GetParent(IntPtr hWnd) {
451                         #if DriverDebug
452                                 Console.WriteLine("GetParent({0:X}): Called", hWnd.ToInt32());
453                         #endif
454                         return driver.GetParent(hWnd);
455                 }
456
457                 internal static bool GetText(IntPtr hWnd, out string text) {
458                         #if DriverDebug
459                                 Console.WriteLine("GetText(): Called");
460                         #endif
461                         return driver.GetText(hWnd, out text);
462                 }
463
464                 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) {
465                         #if DriverDebug
466                                 Console.WriteLine("GetWindowPos({0:X}): Called", handle.ToInt32());
467                         #endif
468                         driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
469                 }
470
471                 internal static FormWindowState GetWindowState(IntPtr handle) {
472                         #if DriverDebug
473                                 Console.WriteLine("GetWindowState({0:X}): Called", handle.ToInt32());
474                         #endif
475                         return driver.GetWindowState(handle);
476                 }
477
478                 internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
479                         #if DriverDebug
480                                 Console.WriteLine("GrabInfo(): Called");
481                         #endif
482                         driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
483                 }
484
485                 internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
486                         #if DriverDebug
487                                 Console.WriteLine("GrabWindow({0:X}): Called", handle.ToInt32());
488                         #endif
489                         driver.GrabWindow(handle, ConfineToHwnd);
490                 }
491
492                 internal static void HandleException(Exception e) {
493                         driver.HandleException(e);
494                 }
495
496                 internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
497                         #if DriverDebug
498                                 Console.WriteLine("Invalidate({0:X}, {1}, {2}): Called", handle.ToInt32(), rc, clear);
499                         #endif
500                         driver.Invalidate(handle, rc, clear);
501                 }
502
503                 internal static bool IsVisible(IntPtr hWnd) {
504                         #if DriverDebug
505                                 Console.WriteLine("IsVisible({0:X}): Called", hWnd.ToInt32());
506                         #endif
507                         return driver.IsVisible(hWnd);
508                 }
509
510                 internal static void KillTimer (Timer timer)
511                 {
512                         #if DriverDebug
513                                 Console.WriteLine("KillTimer({0}): Called", timer);
514                         #endif
515                         driver.KillTimer (timer);
516                 }
517
518                 internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
519                         #if DriverDebug
520                                 Console.WriteLine("MenuToScreen({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
521                         #endif
522                         driver.MenuToScreen(handle, ref x, ref y);
523                 }
524
525                 internal static void OverrideCursor(IntPtr cursor) {
526                         #if DriverDebug
527                                 Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
528                         #endif
529                         driver.OverrideCursor(cursor);
530                 }
531
532                 internal static void PaintEventEnd(IntPtr handle, bool client) {
533                         #if DriverDebug
534                                 Console.WriteLine("PaintEventEnd({0:X}, {1}): Called", handle.ToInt32(), client);
535                         #endif
536                         driver.PaintEventEnd(handle, client);
537                 }
538
539                 internal static PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
540                         #if DriverDebug
541                                 Console.WriteLine("PaintEventStart({0:X}, {1}): Called", handle.ToInt32(), client);
542                         #endif
543                         return driver.PaintEventStart(handle, client);
544                 }
545
546                 internal static bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
547                         return driver.PeekMessage(ref msg, hWnd, wFilterMin, wFilterMax, flags);
548                 }
549
550                 internal static void ReleaseMenuDC(IntPtr handle, Graphics dc) {
551                         #if DriverDebug
552                                 Console.WriteLine("ReleaseMenuDC({0:X}): Called", handle.ToInt32());
553                         #endif
554                         driver.ReleaseMenuDC(handle, dc);
555                 }
556
557                 internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
558                         #if DriverDebug
559                                 Console.WriteLine("ScreenToClient({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
560                         #endif
561                         driver.ScreenToClient (handle, ref x, ref y);
562                 }
563
564                 internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
565                         #if DriverDebug
566                                 Console.WriteLine("ScreenToMenu({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
567                         #endif
568                         driver.ScreenToMenu(handle, ref x, ref y);
569                 }
570
571                 internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
572                         #if DriverDebug
573                                 Console.WriteLine("ScrollWindow({0:X}, {1}, {2}, {3}, {4}): Called", handle.ToInt32(), rectangle, XAmount, YAmount, with_children);
574                         #endif
575                         driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
576                 }
577
578                 internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
579                         #if DriverDebug
580                                 Console.WriteLine("ScrollWindow({0:X}, {2}, {3}, {4}): Called", handle.ToInt32(), XAmount, YAmount, with_children);
581                         #endif
582                         driver.ScrollWindow(handle, XAmount, YAmount, with_children);
583                 }
584
585                 internal static void SendAsyncMethod (AsyncMethodData data) {
586                         #if DriverDebug
587                                 Console.WriteLine("SendAsyncMethod({0}): Called", data);
588                         #endif
589                         driver.SendAsyncMethod (data);
590                 }
591
592                 internal static void SetAllowDrop (IntPtr handle, bool value)
593                 {
594                         #if DriverDebug
595                         Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
596                         #endif
597                         driver.SetAllowDrop (handle, value);
598                 }
599
600                 internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
601                         #if DriverDebug
602                                 Console.WriteLine("SetBorderStyle({0:X}, {1}): Called", handle.ToInt32(), border_style);
603                         #endif
604                         driver.SetBorderStyle(handle, border_style);
605                 }
606
607                 internal static void SetCaretPos(IntPtr handle, int x, int y) {
608                         #if DriverDebug
609                                 Console.WriteLine("SetCaretPos({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
610                         #endif
611                         driver.SetCaretPos(handle, x, y);
612                 }
613
614                 internal static void SetCursor(IntPtr handle, IntPtr cursor) {
615                         #if DriverDebug
616                                 Console.WriteLine("SetCursor({0:X}, {1:X}): Called", handle.ToInt32(), cursor.ToInt32());
617                         #endif
618                         driver.SetCursor(handle, cursor);
619                 }
620
621                 internal static void SetCursorPos(IntPtr handle, int x, int y) {
622                         #if DriverDebug
623                                 Console.WriteLine("SetCursorPos({0:X}, {1}, {2}): Called", handle.ToInt32(), x, y);
624                         #endif
625                         driver.SetCursorPos(handle, x, y);
626                 }
627
628                 internal static void SetFocus(IntPtr handle) {
629                         #if DriverDebug
630                                 Console.WriteLine("SetFocus({0:X}): Called", handle.ToInt32());
631                         #endif
632                         driver.SetFocus(handle);
633                 }
634
635                 internal static void SetIcon(IntPtr handle, Icon icon) {
636                         #if DriverDebug
637                                 Console.WriteLine("SetIcon({0:X}, {1}): Called", handle.ToInt32(), icon);
638                         #endif
639                         driver.SetIcon(handle, icon);
640                 }
641
642                 internal static void SetMenu(IntPtr handle, IntPtr menu_handle) {
643                         #if DriverDebug
644                                 Console.WriteLine("SetMenu({0:X}, {1:X}): Called", handle.ToInt32(), menu_handle.ToInt32());
645                         #endif
646                         driver.SetMenu(handle, menu_handle);
647                 }
648
649                 internal static void SetModal(IntPtr handle, bool Modal) {
650                         #if DriverDebug
651                                 Console.WriteLine("SetModal({0:X}, {1}): Called", handle.ToInt32(), Modal);
652                         #endif
653                         driver.SetModal(handle, Modal);
654                 }
655
656                 internal static IntPtr SetParent(IntPtr hWnd, IntPtr hParent) {
657                         #if DriverDebug
658                                 Console.WriteLine("SetParent({0:X}, {1:X}): Called", hWnd.ToInt32(), hParent.ToInt32());
659                         #endif
660                         return driver.SetParent(hWnd, hParent);
661                 }
662
663                 internal static void SetTimer (Timer timer)
664                 {
665                         #if DriverDebug
666                                 Console.WriteLine("SetTimer({0}): Called", timer);
667                         #endif
668                         driver.SetTimer (timer);
669                 }
670
671                 internal static bool SetTopmost(IntPtr handle, IntPtr hWndOwner, bool Enabled) {
672                         #if DriverDebug
673                                 Console.WriteLine("SetTopMost({0:X}, {1:X}, {2}): Called", handle.ToInt32(), hWndOwner.ToInt32(), Enabled);
674                         #endif
675                         return driver.SetTopmost(handle, hWndOwner, Enabled);
676                 }
677
678                 internal static bool SetVisible(IntPtr hWnd, bool visible) {
679                         #if DriverDebug
680                                 Console.WriteLine("SetVisible({0:X}, {1}): Called", hWnd.ToInt32(), visible);
681                         #endif
682                         return driver.SetVisible(hWnd, visible);
683                 }
684
685                 internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
686                         #if DriverDebug
687                                 Console.WriteLine("SetWindowPos({0:X}, {1}, {2}, {3}, {4}): Called", handle.ToInt32(), x, y, width, height);
688                         #endif
689                         driver.SetWindowPos(handle, x, y, width, height);
690                 }
691
692                 internal static void SetWindowState(IntPtr handle, FormWindowState state) {
693                         #if DriverDebug
694                                 Console.WriteLine("SetWindowState({0:X} {1}): Called", handle.ToInt32(), state);
695                         #endif
696                         driver.SetWindowState(handle, state);
697                 }
698
699                 internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
700                         #if DriverDebug
701                                 Console.WriteLine("SetWindowStyle({0:X}): Called", handle.ToInt32());
702                         #endif
703                         driver.SetWindowStyle(handle, cp);
704                 }
705
706                 internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
707                         #if DriverDebug
708                                 Console.WriteLine("SetZOrder({0:X}, {1:X}, {2}, {3}): Called", handle.ToInt32(), AfterhWnd.ToInt32(), Top, Bottom);
709                         #endif
710                         return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
711                 }
712
713                 internal static void ShowCursor(bool show) {
714                         #if DriverDebug
715                                 Console.WriteLine("ShowCursor({0}): Called", show);
716                         #endif
717                         driver.ShowCursor(show);
718                 }
719
720                 internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
721                         #if DriverDebug
722                         Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", handle, data, allowedEffects);
723                         #endif
724                         return driver.StartDrag (handle, data, allowedEffects);
725                 }
726
727                 internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
728                         #if DriverDebug
729                                 Console.WriteLine("SystrayAdd({0:X}, {1}): Called", handle.ToInt32(), tip);
730                         #endif
731                         return driver.SystrayAdd(handle, tip, icon, out tt);
732                 }
733
734                 internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
735                         #if DriverDebug
736                                 Console.WriteLine("SystrayChange({0:X}, {1}): Called", handle.ToInt32(), tip);
737                         #endif
738                         driver.SystrayChange(handle, tip, icon, ref tt);
739                 }
740
741                 internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
742                         #if DriverDebug
743                                 Console.WriteLine("SystrayRemove({0:X}): Called", handle.ToInt32());
744                         #endif
745                         driver.SystrayRemove(handle, ref tt);
746                 }
747
748                 internal static bool Text(IntPtr hWnd, string text) {
749                         #if DriverDebug
750                                 Console.WriteLine("Text({0:X}, {1}): Called", hWnd.ToInt32(), text);
751                         #endif
752                         return driver.Text(hWnd, text);
753                 }
754
755                 internal static bool TranslateMessage(ref MSG msg) {
756                         return driver.TranslateMessage(ref msg);
757                 }
758
759                 internal static void UngrabWindow(IntPtr handle) {
760                         #if DriverDebug
761                                 Console.WriteLine("UngrabWindow({0:X}): Called", handle.ToInt32());
762                         #endif
763                         driver.UngrabWindow(handle);
764                 }
765
766                 internal static void UpdateWindow(IntPtr handle) {
767                         #if DriverDebug
768                                 Console.WriteLine("UpdateWindow({0:X}): Called", handle.ToInt32());
769                         #endif
770                         driver.UpdateWindow(handle);
771                 }
772
773                 // Santa's little helper
774                 internal static void Version() {
775                         Console.WriteLine("Xplat version $Revision: $");
776                 }
777
778                 internal static void Where() {
779                         XplatUIX11.Where();
780                 }
781                 #endregion      // Public Static Methods
782
783                 #region Delegates
784                 public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
785                 public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
786                 #endregion      // Delegates
787
788         }
789 }