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