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