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