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:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
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.
20 // Copyright (c) 2004-2006 Novell, Inc.
23 // Peter Bartok pbartok@novell.com
27 // define to log API calls to stdout
29 #undef DriverDebugPaint
30 #undef DriverDebugCreate
31 #undef DriverDebugDestroy
32 #undef DriverDebugState
36 using System
.ComponentModel
;
37 using System
.Collections
;
38 using System
.Diagnostics
;
39 using System
.Runtime
.InteropServices
;
40 using System
.Threading
;
41 using System
.Windows
.Forms
.X11Internal
;
43 namespace System
.Windows
.Forms
{
44 internal class XplatUI
{
45 #region Local Variables
46 static XplatUIDriver driver
;
47 static String default_class_name
;
48 #endregion // Local Variables
50 #region Private Methods
51 internal static string Window(IntPtr handle
) {
52 return String
.Format("'{0}' ({1:X})", Control
.FromHandle(handle
), handle
.ToInt32());
54 #endregion // Private Methods
58 static public Keys ModifierKeys
{
60 return driver
.ModifierKeys
;
64 static public MouseButtons MouseButtons
{
66 return driver
.MouseButtons
;
70 static public Point MousePosition
{
72 return driver
.MousePosition
;
77 #endregion // Subclasses
79 #region Constructor & Destructor
81 // Compose name with current domain id because on Win32 we register class name
82 // and name must be unique to process. If we load MWF into multiple appdomains
83 // and try to register same class name we fail.
84 default_class_name
= "SWFClass" + System
.Threading
.Thread
.GetDomainID().ToString();
86 // check for Unix platforms - see FAQ for more details
87 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
88 int platform
= (int) Environment
.OSVersion
.Platform
;
89 if ((platform
== 4) || (platform
== 128)) {
90 if (Environment
.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_QUARTZ_BACKEND") != null)
91 driver
=XplatUIOSX
.GetInstance ();
92 else if (Environment
.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null)
93 driver
=XplatUIX11_new
.GetInstance ();
95 driver
=XplatUIX11
.GetInstance ();
97 driver
=XplatUIWin32
.GetInstance();
100 driver
.InitializeDriver();
102 // Initialize things that need to be done after the driver is ready
103 DataFormats
.GetFormat(0);
105 #endregion // Constructor & Destructor
107 #region Public Static Properties
108 internal static string DefaultClassName
{
110 return default_class_name
;
114 default_class_name
=value;
118 static public int CaptionHeight
{
120 return driver
.Caption
;
124 static public Size CursorSize
{
126 return driver
.CursorSize
;
130 static public bool DragFullWindows
{
132 return driver
.DragFullWindows
;
136 static public Size DragSize
{
138 return driver
.DragSize
;
142 public static Size FrameBorderSize
{
144 return driver
.FrameBorderSize
;
148 static public int HorizontalScrollBarHeight
{
150 return driver
.HorizontalScrollBarHeight
;
154 static public Size IconSize
{
156 return driver
.IconSize
;
160 static public int KeyboardSpeed
{
162 return driver
.KeyboardSpeed
;
166 static public int KeyboardDelay
{
168 return driver
.KeyboardSpeed
;
172 static public Size MaxWindowTrackSize
{
174 return driver
.MaxWindowTrackSize
;
178 static public Size MinimizedWindowSize
{
180 return driver
.MinimizedWindowSize
;
184 static public Size MinimizedWindowSpacingSize
{
186 return driver
.MinimizedWindowSpacingSize
;
190 static public Size MinimumWindowSize
{
192 return driver
.MinimumWindowSize
;
196 static public Size MinWindowTrackSize
{
198 return driver
.MinWindowTrackSize
;
202 static public Size SmallIconSize
{
204 return driver
.SmallIconSize
;
208 static public int MenuHeight
{
210 return driver
.MenuHeight
;
214 static public int MouseButtonCount
{
216 return driver
.MouseButtonCount
;
220 static public bool MouseButtonsSwapped
{
222 return driver
.MouseButtonsSwapped
;
226 static public Size MouseHoverSize
{
228 return driver
.MouseHoverSize
;
232 static public int MouseHoverTime
{
234 return driver
.MouseHoverTime
;
238 static public bool MouseWheelPresent
{
240 return driver
.MouseWheelPresent
;
244 static public bool UserClipWontExposeParent
{
246 return driver
.UserClipWontExposeParent
;
250 static public int VerticalScrollBarWidth
{
252 return driver
.VerticalScrollBarWidth
;
256 static public Rectangle VirtualScreen
{
258 return driver
.VirtualScreen
;
262 static public Rectangle WorkingArea
{
264 return driver
.WorkingArea
;
268 public static bool ThemesEnabled
{
270 return XplatUI
.driver
.ThemesEnabled
;
275 #endregion // Public Static Properties
278 internal static event EventHandler Idle
{
280 driver
.Idle
+= value;
283 driver
.Idle
-= value;
289 #region Public Static Methods
290 internal static void Activate(IntPtr handle
) {
292 Console
.WriteLine("Activate({0}): Called", Window(handle
));
294 driver
.Activate(handle
);
297 internal static void AudibleAlert() {
299 Console
.WriteLine("AudibleAlert(): Called");
301 driver
.AudibleAlert();
304 internal static bool CalculateWindowRect(ref Rectangle ClientRect
, int Style
, int ExStyle
, Menu menu
, out Rectangle WindowRect
) {
306 Console
.WriteLine("CalculateWindowRect({0}, {1}, {2}, {3}): Called", ClientRect
, Style
, ExStyle
, menu
);
308 return driver
.CalculateWindowRect(ref ClientRect
, Style
, ExStyle
, menu
, out WindowRect
);
311 internal static void CaretVisible(IntPtr handle
, bool visible
) {
313 Console
.WriteLine("CaretVisible({0:X}, {1}): Called", handle
.ToInt32(), visible
);
315 driver
.CaretVisible(handle
, visible
);
318 internal static void CreateCaret(IntPtr handle
, int width
, int height
) {
320 Console
.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle
.ToInt32(), width
, height
);
322 driver
.CreateCaret(handle
, width
, height
);
325 internal static IntPtr
CreateWindow(CreateParams cp
) {
326 #if DriverDebug || DriverDebugCreate
329 handle
= driver
.CreateWindow(cp
);
331 Console
.WriteLine("CreateWindow(): Called, returning {0:X}", handle
.ToInt32());
334 return driver
.CreateWindow(cp
);
338 internal static IntPtr
CreateWindow(IntPtr Parent
, int X
, int Y
, int Width
, int Height
) {
339 #if DriverDebug || DriverDebugCreate
340 Console
.WriteLine("CreateWindow(): Called");
342 return driver
.CreateWindow(Parent
, X
, Y
, Width
, Height
);
345 internal static void ClientToScreen(IntPtr handle
, ref int x
, ref int y
) {
347 Console
.WriteLine("ClientToScreen({0}, {1}, {2}): Called", Window(handle
), x
, y
);
349 driver
.ClientToScreen(handle
, ref x
, ref y
);
352 internal static int[] ClipboardAvailableFormats(IntPtr handle
) {
354 Console
.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle
.ToInt32());
356 return driver
.ClipboardAvailableFormats(handle
);
359 internal static void ClipboardClose(IntPtr handle
) {
361 Console
.WriteLine("ClipboardClose({0:X}): Called", handle
.ToInt32());
363 driver
.ClipboardClose(handle
);
366 internal static int ClipboardGetID(IntPtr handle
, string format
) {
368 Console
.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle
.ToInt32(), format
);
370 return driver
.ClipboardGetID(handle
, format
);
373 internal static IntPtr
ClipboardOpen(bool primary_selection
) {
375 Console
.WriteLine("ClipboardOpen(): Called");
377 return driver
.ClipboardOpen (primary_selection
);
380 internal static void ClipboardStore(IntPtr handle
, object obj
, int type
, XplatUI
.ObjectToClipboard converter
) {
382 Console
.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle
.ToInt32(), obj
, type
, converter
);
384 driver
.ClipboardStore(handle
, obj
, type
, converter
);
387 internal static object ClipboardRetrieve(IntPtr handle
, int type
, XplatUI
.ClipboardToObject converter
) {
389 Console
.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle
.ToInt32(), converter
);
391 return driver
.ClipboardRetrieve(handle
, type
, converter
);
394 internal static IntPtr
DefineCursor(Bitmap bitmap
, Bitmap mask
, Color cursor_pixel
, Color mask_pixel
, int xHotSpot
, int yHotSpot
) {
396 Console
.WriteLine("DefineCursor(...): Called");
398 return driver
.DefineCursor(bitmap
, mask
, cursor_pixel
, mask_pixel
, xHotSpot
, yHotSpot
);
401 internal static IntPtr
DefineStdCursor(StdCursor id
) {
402 return driver
.DefineStdCursor(id
);
405 internal static IntPtr
DefWndProc(ref Message msg
) {
406 return driver
.DefWndProc(ref msg
);
409 internal static void DestroyCaret(IntPtr handle
) {
411 Console
.WriteLine("DestroyCaret({0:X}): Called", handle
.ToInt32());
413 driver
.DestroyCaret(handle
);
416 internal static void DestroyCursor(IntPtr cursor
) {
418 Console
.WriteLine("DestroyCursor({0:X}): Called", cursor
.ToInt32());
420 driver
.DestroyCursor(cursor
);
423 internal static void DestroyWindow(IntPtr handle
) {
424 #if DriverDebug || DriverDebugDestroy
425 Console
.WriteLine("DestroyWindow({0}): Called", Window(handle
));
427 driver
.DestroyWindow(handle
);
430 internal static IntPtr
DispatchMessage(ref MSG msg
) {
431 return driver
.DispatchMessage(ref msg
);
434 internal static void DoEvents() {
438 internal static void DrawReversibleRectangle(IntPtr handle
, Rectangle rect
, int line_width
) {
440 Console
.WriteLine("DrawReversibleRectangle({0}, {1}, {2}): Called", Window(handle
), rect
, line_width
);
442 driver
.DrawReversibleRectangle(handle
, rect
, line_width
);
445 internal static void EnableThemes() {
446 driver
.EnableThemes();
449 internal static void EnableWindow(IntPtr handle
, bool Enable
) {
450 #if DriverDebug || DriverDebugState
451 Console
.WriteLine("EnableWindow({0}, {1}): Called", Window(handle
), Enable
);
453 driver
.EnableWindow(handle
, Enable
);
456 internal static void EndLoop(Thread thread
) {
458 Console
.WriteLine("EndLoop({0:X}): Called", thread
.GetHashCode());
460 driver
.EndLoop(thread
);
463 internal static IntPtr
GetActive() {
465 Console
.WriteLine("GetActive(): Called");
467 return driver
.GetActive();
470 internal static SizeF
GetAutoScaleSize(Font font
) {
472 Console
.WriteLine("GetAutoScaleSize({0}): Called", font
);
474 return driver
.GetAutoScaleSize(font
);
477 internal static Region
GetClipRegion(IntPtr handle
) {
479 Console
.WriteLine("GetClipRegion({0}): Called", Window(handle
));
481 return driver
.GetClipRegion(handle
);
484 internal static void GetCursorInfo(IntPtr cursor
, out int width
, out int height
, out int hotspot_x
, out int hotspot_y
) {
486 Console
.WriteLine("GetCursorInfo({0}): Called", cursor
.ToInt32());
488 driver
.GetCursorInfo(cursor
, out width
, out height
, out hotspot_x
, out hotspot_y
);
491 internal static void GetCursorPos(IntPtr handle
, out int x
, out int y
) {
493 Console
.WriteLine("GetCursorPos({0}): Called", Window(handle
));
495 driver
.GetCursorPos(handle
, out x
, out y
);
498 internal static void GetDisplaySize(out Size size
) {
500 Console
.WriteLine("GetDisplaySize(): Called");
502 driver
.GetDisplaySize(out size
);
505 internal static IntPtr
GetFocus() {
507 Console
.WriteLine("GetFocus(): Called, Result:{0}", Window(driver
.GetFocus()));
509 return driver
.GetFocus();
512 internal static bool GetFontMetrics(Graphics g
, Font font
, out int ascent
, out int descent
) {
514 Console
.WriteLine("GetFontMetrics(): Called");
516 return driver
.GetFontMetrics(g
, font
, out ascent
, out descent
);
519 internal static Point
GetMenuOrigin(IntPtr handle
) {
521 Console
.WriteLine("GetMenuOrigin({0}): Called", Window(handle
));
523 return driver
.GetMenuOrigin(handle
);
526 internal static bool GetMessage(object queue_id
, ref MSG msg
, IntPtr hWnd
, int wFilterMin
, int wFilterMax
) {
527 return driver
.GetMessage(queue_id
, ref msg
, hWnd
, wFilterMin
, wFilterMax
);
530 internal static IntPtr
GetParent(IntPtr handle
) {
532 Console
.WriteLine("GetParent({0}): Called", Window(handle
));
534 return driver
.GetParent(handle
);
537 internal static bool GetText(IntPtr handle
, out string text
) {
539 Console
.WriteLine("GetText({0}): Called", Window(handle
));
541 return driver
.GetText(handle
, out text
);
544 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
) {
546 Console
.WriteLine("GetWindowPos({0}): Called", Window(handle
));
548 driver
.GetWindowPos(handle
, is_toplevel
, out x
, out y
, out width
, out height
, out client_width
, out client_height
);
551 /* this method can (and does, on X11) return
552 * (FormWindowState)(-1), when the state of the window
553 * cannot be determined (in the X11 case, when the
554 * window isn't mapped.) Checking for the additional
555 * return value is less expensive than
556 * throwing/catching an exception. */
557 internal static FormWindowState
GetWindowState(IntPtr handle
) {
559 Console
.WriteLine("GetWindowState({0}): Called", Window(handle
));
561 return driver
.GetWindowState(handle
);
564 internal static void GrabInfo(out IntPtr handle
, out bool GrabConfined
, out Rectangle GrabArea
) {
566 Console
.WriteLine("GrabInfo(): Called");
568 driver
.GrabInfo(out handle
, out GrabConfined
, out GrabArea
);
571 internal static void GrabWindow(IntPtr handle
, IntPtr ConfineToHwnd
) {
573 Console
.WriteLine("GrabWindow({0}, {1}): Called", Window(handle
), Window(ConfineToHwnd
));
575 driver
.GrabWindow(handle
, ConfineToHwnd
);
578 internal static void HandleException(Exception e
) {
579 driver
.HandleException(e
);
582 internal static void Invalidate(IntPtr handle
, Rectangle rc
, bool clear
) {
584 Console
.WriteLine("Invalidate({0}, {1}, {2}): Called", Window(handle
), rc
, clear
);
586 driver
.Invalidate(handle
, rc
, clear
);
589 internal static void InvalidateNC (IntPtr handle
)
592 Console
.WriteLine("InvalidateNC({0}): Called", Window(handle
));
594 driver
.InvalidateNC(handle
);
598 internal static bool IsEnabled(IntPtr handle
) {
599 #if DriverDebug || DriverDebugState
600 Console
.WriteLine("IsEnabled({0}): Called, Result={1}", Window(handle
), driver
.IsEnabled(handle
));
602 return driver
.IsEnabled(handle
);
605 internal static bool IsVisible(IntPtr handle
) {
606 #if DriverDebug || DriverDebugState
607 Console
.WriteLine("IsVisible({0}): Called, Result={1}", Window(handle
), driver
.IsVisible(handle
));
609 return driver
.IsVisible(handle
);
612 internal static void KillTimer (Timer timer
)
615 Console
.WriteLine("KillTimer({0}): Called", timer
);
617 driver
.KillTimer (timer
);
620 internal static void MenuToScreen(IntPtr handle
, ref int x
, ref int y
) {
622 Console
.WriteLine("MenuToScreen({0}, {1}, {2}): Called", Window(handle
), x
, y
);
624 driver
.MenuToScreen(handle
, ref x
, ref y
);
627 internal static void OverrideCursor(IntPtr cursor
) {
629 Console
.WriteLine("OverrideCursor({0:X}): Called", cursor
.ToInt32());
631 driver
.OverrideCursor(cursor
);
634 internal static void PaintEventEnd(IntPtr handle
, bool client
) {
635 #if DriverDebug || DriverDebugPaint
636 Console
.WriteLine("PaintEventEnd({0}, {1}): Called from thread {2}", Window(handle
), client
, Thread
.CurrentThread
.GetHashCode());
638 driver
.PaintEventEnd(handle
, client
);
641 internal static PaintEventArgs
PaintEventStart(IntPtr handle
, bool client
) {
642 #if DriverDebug || DriverDebugPaint
643 Console
.WriteLine("PaintEventStart({0}, {1}): Called from thread {2}", Window(handle
), client
, Thread
.CurrentThread
.GetHashCode());
645 return driver
.PaintEventStart(handle
, client
);
648 internal static bool PeekMessage(Object queue_id
, ref MSG msg
, IntPtr hWnd
, int wFilterMin
, int wFilterMax
, uint flags
) {
649 return driver
.PeekMessage(queue_id
, ref msg
, hWnd
, wFilterMin
, wFilterMax
, flags
);
652 internal static bool PostMessage(IntPtr hwnd
, Msg message
, IntPtr wParam
, IntPtr lParam
) {
654 Console
.WriteLine("PostMessage({0}, {1}, {2:X}, {3:X}): Called", Window(hwnd
), message
, wParam
.ToInt32(), lParam
.ToInt32());
656 return driver
.PostMessage(hwnd
, message
, wParam
, lParam
);
659 internal static bool PostMessage(ref MSG msg
) {
661 Console
.WriteLine("PostMessage({0}): Called", msg
);
663 return driver
.PostMessage(msg
.hwnd
, msg
.message
, msg
.wParam
, msg
.lParam
);
666 internal static void PostQuitMessage(int exitCode
) {
668 Console
.WriteLine("PostQuitMessage({0}): Called", exitCode
);
670 driver
.PostQuitMessage(exitCode
);
673 internal static void RequestAdditionalWM_NCMessages(IntPtr handle
, bool hover
, bool leave
) {
675 Console
.WriteLine("RequestAdditionalWM_NCMessages({0}, {1}, {2}): Called", Window(handle
), hover
, leave
);
677 driver
.RequestAdditionalWM_NCMessages (handle
, hover
, leave
);
680 internal static void RequestNCRecalc(IntPtr handle
) {
682 Console
.WriteLine("RequestNCRecalc({0}): Called", Window(handle
));
684 driver
.RequestNCRecalc(handle
);
687 internal static void ResetMouseHover(IntPtr handle
) {
689 Console
.WriteLine("ResetMouseHover({0}): Called", Window(handle
));
691 driver
.ResetMouseHover(handle
);
694 internal static void ScreenToClient(IntPtr handle
, ref int x
, ref int y
) {
696 Console
.WriteLine("ScreenToClient({0}, {1}, {2}): Called", Window(handle
), x
, y
);
698 driver
.ScreenToClient (handle
, ref x
, ref y
);
701 internal static void ScreenToMenu(IntPtr handle
, ref int x
, ref int y
) {
703 Console
.WriteLine("ScreenToMenu({0}, {1}, {2}): Called", Window(handle
), x
, y
);
705 driver
.ScreenToMenu(handle
, ref x
, ref y
);
708 internal static void ScrollWindow(IntPtr handle
, Rectangle rectangle
, int XAmount
, int YAmount
, bool with_children
) {
710 Console
.WriteLine("ScrollWindow({0}, {1}, {2}, {3}, {4}): Called", Window(handle
), rectangle
, XAmount
, YAmount
, with_children
);
712 driver
.ScrollWindow(handle
, rectangle
, XAmount
, YAmount
, with_children
);
715 internal static void ScrollWindow(IntPtr handle
, int XAmount
, int YAmount
, bool with_children
) {
717 Console
.WriteLine("ScrollWindow({0}, {2}, {3}, {4}): Called", Window(handle
), XAmount
, YAmount
, with_children
);
719 driver
.ScrollWindow(handle
, XAmount
, YAmount
, with_children
);
722 internal static void SendAsyncMethod (AsyncMethodData data
) {
724 Console
.WriteLine("SendAsyncMethod({0}): Called", data
);
726 driver
.SendAsyncMethod (data
);
729 internal static IntPtr
SendMessage (IntPtr handle
, Msg message
, IntPtr wParam
, IntPtr lParam
) {
731 Console
.WriteLine("SendMessage ({0}, {1}, {2:X}, {3:X}): Called", Window(handle
), message
, wParam
.ToInt32(), lParam
.ToInt32());
733 return driver
.SendMessage (handle
, message
, wParam
, lParam
);
736 internal static void SendMessage (ref Message m
) {
738 Console
.WriteLine("SendMessage ({0}): Called", m
);
740 m
.Result
= driver
.SendMessage(m
.HWnd
, (Msg
)m
.Msg
, m
.WParam
, m
.LParam
);
743 internal static void SetAllowDrop (IntPtr handle
, bool value)
746 Console
.WriteLine ("SetAllowDrop({0}, {1}): Called", handle
, value);
748 driver
.SetAllowDrop (handle
, value);
751 internal static void SetBorderStyle(IntPtr handle
, FormBorderStyle border_style
) {
753 Console
.WriteLine("SetBorderStyle({0}, {1}): Called", Window(handle
), border_style
);
755 driver
.SetBorderStyle(handle
, border_style
);
758 internal static void SetCaretPos(IntPtr handle
, int x
, int y
) {
760 Console
.WriteLine("SetCaretPos({0}, {1}, {2}): Called", Window(handle
), x
, y
);
762 driver
.SetCaretPos(handle
, x
, y
);
765 internal static void SetClipRegion(IntPtr handle
, Region region
) {
767 Console
.WriteLine("SetClipRegion({0}, {1}): Called", Window(handle
), region
);
769 driver
.SetClipRegion(handle
, region
);
772 internal static void SetCursor(IntPtr handle
, IntPtr cursor
) {
774 Console
.WriteLine("SetCursor({0}, {1:X}): Called", Window(handle
), cursor
.ToInt32());
776 driver
.SetCursor(handle
, cursor
);
779 internal static void SetCursorPos(IntPtr handle
, int x
, int y
) {
781 Console
.WriteLine("SetCursorPos({0}, {1}, {2}): Called", Window(handle
), x
, y
);
783 driver
.SetCursorPos(handle
, x
, y
);
786 internal static void SetFocus(IntPtr handle
) {
788 Console
.WriteLine("SetFocus({0}): Called", Window(handle
));
790 driver
.SetFocus(handle
);
793 internal static void SetIcon(IntPtr handle
, Icon icon
) {
795 Console
.WriteLine("SetIcon({0}, {1}): Called", Window(handle
), icon
);
797 driver
.SetIcon(handle
, icon
);
800 internal static void SetMenu(IntPtr handle
, Menu menu
) {
802 Console
.WriteLine("SetMenu({0}, {1}): Called", Window(handle
), menu
);
804 driver
.SetMenu(handle
, menu
);
807 internal static void SetModal(IntPtr handle
, bool Modal
) {
808 #if DriverDebug || DriverDebugState
809 Console
.WriteLine("SetModal({0}, {1}): Called", Window(handle
), Modal
);
811 driver
.SetModal(handle
, Modal
);
814 internal static IntPtr
SetParent(IntPtr handle
, IntPtr hParent
) {
816 Console
.WriteLine("SetParent({0}, {1:X}): Called", Window(handle
), Window(hParent
));
818 return driver
.SetParent(handle
, hParent
);
821 internal static void SetTimer (Timer timer
)
824 Console
.WriteLine("SetTimer({0}): Called", timer
);
826 driver
.SetTimer (timer
);
829 internal static bool SetTopmost(IntPtr handle
, IntPtr hWndOwner
, bool Enabled
) {
831 Console
.WriteLine("SetTopMost({0}, {1}, {2}): Called", Window(handle
), Window(hWndOwner
), Enabled
);
833 return driver
.SetTopmost(handle
, hWndOwner
, Enabled
);
836 internal static bool SetVisible (IntPtr handle
, bool visible
, bool activate
)
838 #if DriverDebug || DriverDebugState
839 Console
.WriteLine("SetVisible({0}, {1}, {2}): Called", Window(handle
), visible
, activate
);
841 return driver
.SetVisible (handle
, visible
, activate
);
844 internal static void SetWindowMinMax(IntPtr handle
, Rectangle maximized
, Size min
, Size max
) {
845 #if DriverDebug || DriverDebugState
846 Console
.WriteLine("SetWindowMinMax({0}, {1}, {2}, {3}): Called", Window(handle
), maximized
, min
, max
);
848 driver
.SetWindowMinMax(handle
, maximized
, min
, max
);
851 internal static void SetWindowPos(IntPtr handle
, int x
, int y
, int width
, int height
) {
853 Console
.WriteLine("SetWindowPos({0}, {1}, {2}, {3}, {4}): Called", Window(handle
), x
, y
, width
, height
);
855 driver
.SetWindowPos(handle
, x
, y
, width
, height
);
858 internal static void SetWindowState(IntPtr handle
, FormWindowState state
) {
859 #if DriverDebug || DriverDebugState
860 Console
.WriteLine("SetWindowState({0} {1}): Called", Window(handle
), state
);
862 driver
.SetWindowState(handle
, state
);
865 internal static void SetWindowStyle(IntPtr handle
, CreateParams cp
) {
867 Console
.WriteLine("SetWindowStyle({0}): Called", Window(handle
));
869 driver
.SetWindowStyle(handle
, cp
);
872 internal static double GetWindowTransparency (IntPtr handle
)
875 Console
.WriteLine("SetWindowTransparency({0}): Called", Window(handle
));
877 return driver
.GetWindowTransparency(handle
);
880 internal static void SetWindowTransparency(IntPtr handle
, double transparency
, Color key
)
883 Console
.WriteLine("SetWindowTransparency({0}): Called", Window(handle
));
885 driver
.SetWindowTransparency(handle
, transparency
, key
);
888 internal static bool SetZOrder(IntPtr handle
, IntPtr AfterhWnd
, bool Top
, bool Bottom
) {
890 Console
.WriteLine("SetZOrder({0}, {1:X}, {2}, {3}): Called", Window(handle
), Window(AfterhWnd
), Top
, Bottom
);
892 return driver
.SetZOrder(handle
, AfterhWnd
, Top
, Bottom
);
895 internal static void ShowCursor(bool show
) {
897 Console
.WriteLine("ShowCursor({0}): Called", show
);
899 driver
.ShowCursor(show
);
902 internal static DragDropEffects
StartDrag(IntPtr handle
, object data
, DragDropEffects allowedEffects
) {
904 Console
.WriteLine ("StartDrag({0}, {1}, {2}): Called", Window(handle
), data
, allowedEffects
);
906 return driver
.StartDrag (handle
, data
, allowedEffects
);
909 internal static object StartLoop(Thread thread
) {
911 Console
.WriteLine("StartLoop({0:X}): Called", thread
.GetHashCode());
913 return driver
.StartLoop(thread
);
916 internal static TransparencySupport
SupportsTransparency() {
918 Console
.WriteLine("SupportsTransparency(): Called, result={0}", driver
.SupportsTransparency());
920 return driver
.SupportsTransparency();
923 internal static bool SystrayAdd(IntPtr handle
, string tip
, Icon icon
, out ToolTip tt
) {
925 Console
.WriteLine("SystrayAdd({0}, {1}): Called", Window(handle
), tip
);
927 return driver
.SystrayAdd(handle
, tip
, icon
, out tt
);
930 internal static void SystrayChange(IntPtr handle
, string tip
, Icon icon
, ref ToolTip tt
) {
932 Console
.WriteLine("SystrayChange({0}, {1}): Called", Window(handle
), tip
);
934 driver
.SystrayChange(handle
, tip
, icon
, ref tt
);
937 internal static void SystrayRemove(IntPtr handle
, ref ToolTip tt
) {
939 Console
.WriteLine("SystrayRemove({0}): Called", Window(handle
));
941 driver
.SystrayRemove(handle
, ref tt
);
944 internal static bool Text(IntPtr handle
, string text
) {
946 Console
.WriteLine("Text({0}, {1}): Called", Window(handle
), text
);
948 return driver
.Text(handle
, text
);
951 internal static bool TranslateMessage(ref MSG msg
) {
952 return driver
.TranslateMessage(ref msg
);
955 internal static void UngrabWindow(IntPtr handle
) {
957 Console
.WriteLine("UngrabWindow({0}): Called", Window(handle
));
959 driver
.UngrabWindow(handle
);
962 internal static void UpdateWindow(IntPtr handle
) {
964 Console
.WriteLine("UpdateWindow({0}): Called", Window(handle
));
966 driver
.UpdateWindow(handle
);
969 // Santa's little helper
970 internal static void Version() {
971 Console
.WriteLine("Xplat version $Revision: $");
974 internal static void Where() {
977 #endregion // Public Static Methods
980 public delegate bool ClipboardToObject(int type
, IntPtr data
, out object obj
);
981 public delegate bool ObjectToClipboard(ref int type
, object obj
, out byte[] data
);
982 #endregion // Delegates