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();
87 if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null) {
88 driver=XplatUIX11_new.GetInstance ();
89 } else if (Environment.GetEnvironmentVariable ("MONO_MWF_MAC_FORCE_X11") != null) {
90 driver = XplatUIX11.GetInstance ();
92 IntPtr buf = Marshal.AllocHGlobal (8192);
93 // This is a hacktastic way of getting sysname from uname ()
94 if (uname (buf) != 0) {
95 // WTF: We cannot run uname
96 driver=XplatUIX11.GetInstance ();
98 string os = Marshal.PtrToStringAnsi (buf);
100 driver=XplatUICarbon.GetInstance ();
102 driver=XplatUIX11.GetInstance ();
104 Marshal.FreeHGlobal (buf);
107 driver=XplatUIWin32.GetInstance();
110 driver.InitializeDriver();
112 // Initialize things that need to be done after the driver is ready
113 DataFormats.GetFormat(0);
115 #endregion // Constructor & Destructor
117 #region Public Static Properties
119 public static bool RunningOnUnix {
122 return (Environment.OSVersion.Platform == PlatformID.Unix);
124 int platform = (int) Environment.OSVersion.Platform;
125 return (platform == 128);
130 public static int ActiveWindowTrackingDelay {
131 get { return driver.ActiveWindowTrackingDelay; }
134 internal static string DefaultClassName {
136 return default_class_name;
140 default_class_name=value;
144 static public Size Border3DSize {
146 return driver.Border3DSize;
150 static public Size BorderSize {
152 return driver.BorderSize;
156 static public Size CaptionButtonSize {
158 return driver.CaptionButtonSize;
162 static public int CaptionHeight {
164 return driver.CaptionHeight;
168 public static int CaretBlinkTime { get { return driver.CaretBlinkTime; } }
169 public static int CaretWidth { get { return driver.CaretWidth; } }
171 static public Size CursorSize {
173 return driver.CursorSize;
177 static public Size DoubleClickSize {
179 return driver.DoubleClickSize;
183 static public int DoubleClickTime {
185 return driver.DoubleClickTime;
189 static public bool DragFullWindows {
191 return driver.DragFullWindows;
195 static public Size DragSize {
197 return driver.DragSize;
201 static public Size FixedFrameBorderSize {
203 return driver.FixedFrameBorderSize;
207 public static int FontSmoothingContrast { get { return driver.FontSmoothingContrast; } }
208 public static int FontSmoothingType { get { return driver.FontSmoothingType; } }
210 public static Size FrameBorderSize {
212 return driver.FrameBorderSize;
216 public static int HorizontalResizeBorderThickness { get { return driver.HorizontalResizeBorderThickness; } }
218 static public int HorizontalScrollBarHeight {
220 return driver.HorizontalScrollBarHeight;
224 static public Size IconSize {
226 return driver.IconSize;
230 public static bool IsActiveWindowTrackingEnabled { get { return driver.IsActiveWindowTrackingEnabled; } }
231 public static bool IsComboBoxAnimationEnabled { get { return driver.IsComboBoxAnimationEnabled; } }
232 public static bool IsDropShadowEnabled { get { return driver.IsDropShadowEnabled; } }
233 public static bool IsFontSmoothingEnabled { get { return driver.IsFontSmoothingEnabled; } }
234 public static bool IsHotTrackingEnabled { get { return driver.IsHotTrackingEnabled; } }
235 public static bool IsIconTitleWrappingEnabled { get { return driver.IsIconTitleWrappingEnabled; } }
236 public static bool IsKeyboardPreferred { get { return driver.IsKeyboardPreferred; } }
237 public static bool IsListBoxSmoothScrollingEnabled { get { return driver.IsListBoxSmoothScrollingEnabled; } }
238 public static bool IsMenuAnimationEnabled { get { return driver.IsMenuAnimationEnabled; } }
239 public static bool IsMenuFadeEnabled { get { return driver.IsMenuFadeEnabled; } }
240 public static bool IsMinimizeRestoreAnimationEnabled { get { return driver.IsMinimizeRestoreAnimationEnabled; } }
241 public static bool IsSelectionFadeEnabled { get { return driver.IsSelectionFadeEnabled; } }
242 public static bool IsSnapToDefaultEnabled { get { return driver.IsSnapToDefaultEnabled; } }
243 public static bool IsTitleBarGradientEnabled { get { return driver.IsTitleBarGradientEnabled; } }
244 public static bool IsToolTipAnimationEnabled { get { return driver.IsToolTipAnimationEnabled; } }
246 static public int KeyboardSpeed {
248 return driver.KeyboardSpeed;
252 static public int KeyboardDelay {
254 return driver.KeyboardDelay;
258 static public Size MaxWindowTrackSize {
260 return driver.MaxWindowTrackSize;
264 static public bool MenuAccessKeysUnderlined {
266 return driver.MenuAccessKeysUnderlined;
270 static public Size MenuBarButtonSize { get { return driver.MenuBarButtonSize; } }
271 static public int MenuShowDelay { get { return driver.MenuShowDelay; } }
273 static public Size MinimizedWindowSize {
275 return driver.MinimizedWindowSize;
279 static public Size MinimizedWindowSpacingSize {
281 return driver.MinimizedWindowSpacingSize;
285 static public Size MinimumWindowSize {
287 return driver.MinimumWindowSize;
291 static public Size MinimumFixedToolWindowSize {
292 get { return driver.MinimumFixedToolWindowSize; }
295 static public Size MinimumSizeableToolWindowSize {
296 get { return driver.MinimumSizeableToolWindowSize; }
299 static public Size MinimumNoBorderWindowSize {
300 get { return driver.MinimumNoBorderWindowSize; }
303 static public Size MinWindowTrackSize {
305 return driver.MinWindowTrackSize;
309 public static int MouseSpeed {
310 get { return driver.MouseSpeed; }
313 static public Size SmallIconSize {
315 return driver.SmallIconSize;
319 static public int MenuHeight {
321 return driver.MenuHeight;
325 static public int MouseButtonCount {
327 return driver.MouseButtonCount;
331 static public bool MouseButtonsSwapped {
333 return driver.MouseButtonsSwapped;
337 static public Size MouseHoverSize {
339 return driver.MouseHoverSize;
343 static public int MouseHoverTime {
345 return driver.MouseHoverTime;
349 static public int MouseWheelScrollDelta {
351 return driver.MouseWheelScrollDelta;
355 static public bool MouseWheelPresent {
357 return driver.MouseWheelPresent;
361 public static LeftRightAlignment PopupMenuAlignment {
362 get { return driver.PopupMenuAlignment; }
366 public static PowerStatus PowerStatus {
367 get { return driver.PowerStatus; }
371 public static bool RequiresPositiveClientAreaSize {
373 return driver.RequiresPositiveClientAreaSize;
377 public static int SizingBorderWidth {
378 get { return driver.SizingBorderWidth; }
381 public static Size SmallCaptionButtonSize {
382 get { return driver.SmallCaptionButtonSize; }
385 public static bool UIEffectsEnabled {
386 get { return driver.UIEffectsEnabled; }
389 static public bool UserClipWontExposeParent {
391 return driver.UserClipWontExposeParent;
395 public static int VerticalResizeBorderThickness { get { return driver.VerticalResizeBorderThickness; } }
397 static public int VerticalScrollBarWidth {
399 return driver.VerticalScrollBarWidth;
403 static public Rectangle VirtualScreen {
405 return driver.VirtualScreen;
409 static public Rectangle WorkingArea {
411 return driver.WorkingArea;
415 public static bool ThemesEnabled {
417 return XplatUI.driver.ThemesEnabled;
421 public static int ToolWindowCaptionHeight {
423 return driver.ToolWindowCaptionHeight;
426 #endregion // Public Static Properties
430 internal static event EventHandler Idle {
432 driver.Idle += value;
435 driver.Idle -= value;
441 #region Public Static Methods
442 internal static void Activate(IntPtr handle) {
444 Console.WriteLine("Activate({0}): Called", Window(handle));
446 driver.Activate(handle);
449 internal static void AudibleAlert() {
451 Console.WriteLine("AudibleAlert(): Called");
453 driver.AudibleAlert();
456 internal static bool CalculateWindowRect(ref Rectangle ClientRect, CreateParams cp, Menu menu, out Rectangle WindowRect) {
458 Console.WriteLine("CalculateWindowRect({0}, {1}, {2}): Called", ClientRect, cp, menu);
460 return driver.CalculateWindowRect(ref ClientRect, cp, menu, out WindowRect);
463 internal static void CaretVisible(IntPtr handle, bool visible) {
465 Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
467 driver.CaretVisible(handle, visible);
470 internal static void CreateCaret(IntPtr handle, int width, int height) {
472 Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
474 driver.CreateCaret(handle, width, height);
477 internal static IntPtr CreateWindow(CreateParams cp) {
478 #if DriverDebug || DriverDebugCreate
481 handle = driver.CreateWindow(cp);
483 Console.WriteLine("CreateWindow(): Called, returning {0:X}", handle.ToInt32());
486 return driver.CreateWindow(cp);
490 internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
491 #if DriverDebug || DriverDebugCreate
492 Console.WriteLine("CreateWindow(): Called");
494 return driver.CreateWindow(Parent, X, Y, Width, Height);
497 internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
499 Console.WriteLine("ClientToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
501 driver.ClientToScreen(handle, ref x, ref y);
504 internal static int[] ClipboardAvailableFormats(IntPtr handle) {
506 Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
508 return driver.ClipboardAvailableFormats(handle);
511 internal static void ClipboardClose(IntPtr handle) {
513 Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
515 driver.ClipboardClose(handle);
518 internal static int ClipboardGetID(IntPtr handle, string format) {
520 Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
522 return driver.ClipboardGetID(handle, format);
525 internal static IntPtr ClipboardOpen(bool primary_selection) {
527 Console.WriteLine("ClipboardOpen(): Called");
529 return driver.ClipboardOpen (primary_selection);
532 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
534 Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, type, converter);
536 driver.ClipboardStore(handle, obj, type, converter);
539 internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
541 Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
543 return driver.ClipboardRetrieve(handle, type, converter);
546 internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
548 Console.WriteLine("DefineCursor(...): Called");
550 return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
553 internal static IntPtr DefineStdCursor(StdCursor id) {
554 return driver.DefineStdCursor(id);
557 internal static Bitmap DefineStdCursorBitmap(StdCursor id) {
558 return driver.DefineStdCursorBitmap(id);
561 internal static IntPtr DefWndProc(ref Message msg) {
562 return driver.DefWndProc(ref msg);
565 internal static void DestroyCaret(IntPtr handle) {
567 Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
569 driver.DestroyCaret(handle);
572 internal static void DestroyCursor(IntPtr cursor) {
574 Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
576 driver.DestroyCursor(cursor);
579 internal static void DestroyWindow(IntPtr handle) {
580 #if DriverDebug || DriverDebugDestroy
581 Console.WriteLine("DestroyWindow({0}): Called", Window(handle));
583 driver.DestroyWindow(handle);
586 internal static IntPtr DispatchMessage(ref MSG msg) {
587 return driver.DispatchMessage(ref msg);
590 internal static void DoEvents() {
594 internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
596 Console.WriteLine("DrawReversibleRectangle({0}, {1}, {2}): Called", Window(handle), rect, line_width);
598 driver.DrawReversibleRectangle(handle, rect, line_width);
601 internal static void FillReversibleRectangle (Rectangle rectangle, Color backColor)
604 Console.WriteLine("FillReversibleRectangle({0}, {1}): Called", rectangle, backColor);
606 driver.FillReversibleRectangle (rectangle, backColor);
609 internal static void DrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style)
612 Console.WriteLine("DrawReversibleFrame({0}, {1}, {2}): Called", rectangle, backColor, style);
614 driver.DrawReversibleFrame (rectangle, backColor, style);
617 internal static void DrawReversibleLine (Point start, Point end, Color backColor)
620 Console.WriteLine("DrawReversibleLine({0}, {1}, {2}): Called", start, end, backColor);
622 driver.DrawReversibleLine (start, end, backColor);
625 internal static void EnableThemes() {
626 driver.EnableThemes();
629 internal static void EnableWindow(IntPtr handle, bool Enable) {
630 #if DriverDebug || DriverDebugState
631 Console.WriteLine("EnableWindow({0}, {1}): Called", Window(handle), Enable);
633 driver.EnableWindow(handle, Enable);
636 internal static void EndLoop(Thread thread) {
638 Console.WriteLine("EndLoop({0:X}): Called", thread.GetHashCode());
640 driver.EndLoop(thread);
643 internal static IntPtr GetActive() {
645 Console.WriteLine("GetActive(): Called");
647 return driver.GetActive();
650 internal static SizeF GetAutoScaleSize(Font font) {
652 Console.WriteLine("GetAutoScaleSize({0}): Called", font);
654 return driver.GetAutoScaleSize(font);
657 internal static Region GetClipRegion(IntPtr handle) {
659 Console.WriteLine("GetClipRegion({0}): Called", Window(handle));
661 return driver.GetClipRegion(handle);
664 internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
666 Console.WriteLine("GetCursorInfo({0}): Called", cursor.ToInt32());
668 driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
671 internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
673 Console.WriteLine("GetCursorPos({0}): Called", Window(handle));
675 driver.GetCursorPos(handle, out x, out y);
678 internal static void GetDisplaySize(out Size size) {
680 Console.WriteLine("GetDisplaySize(): Called");
682 driver.GetDisplaySize(out size);
685 internal static IntPtr GetFocus() {
687 Console.WriteLine("GetFocus(): Called, Result:{0}", Window(driver.GetFocus()));
689 return driver.GetFocus();
692 internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
694 Console.WriteLine("GetFontMetrics(): Called");
696 return driver.GetFontMetrics(g, font, out ascent, out descent);
699 internal static Point GetMenuOrigin(IntPtr handle) {
701 Console.WriteLine("GetMenuOrigin({0}): Called", Window(handle));
703 return driver.GetMenuOrigin(handle);
706 internal static bool GetMessage(object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
707 return driver.GetMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax);
710 internal static IntPtr GetParent(IntPtr handle) {
712 Console.WriteLine("GetParent({0}): Called", Window(handle));
714 return driver.GetParent(handle);
717 internal static IntPtr GetPreviousWindow(IntPtr handle) {
718 return driver.GetPreviousWindow(handle);
721 internal static bool GetText(IntPtr handle, out string text) {
723 Console.WriteLine("GetText({0}): Called", Window(handle));
725 return driver.GetText(handle, out text);
728 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) {
730 Console.WriteLine("GetWindowPos({0}): Called", Window(handle));
732 driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
735 /* this method can (and does, on X11) return
736 * (FormWindowState)(-1), when the state of the window
737 * cannot be determined (in the X11 case, when the
738 * window isn't mapped.) Checking for the additional
739 * return value is less expensive than
740 * throwing/catching an exception. */
741 internal static FormWindowState GetWindowState(IntPtr handle) {
743 Console.WriteLine("GetWindowState({0}): Called", Window(handle));
745 return driver.GetWindowState(handle);
748 internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
750 Console.WriteLine("GrabInfo(): Called");
752 driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
755 internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
757 Console.WriteLine("GrabWindow({0}, {1}): Called", Window(handle), Window(ConfineToHwnd));
759 driver.GrabWindow(handle, ConfineToHwnd);
762 internal static void HandleException(Exception e) {
763 driver.HandleException(e);
766 internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
768 Console.WriteLine("Invalidate({0}, {1}, {2}): Called", Window(handle), rc, clear);
770 driver.Invalidate(handle, rc, clear);
773 internal static void InvalidateNC (IntPtr handle)
776 Console.WriteLine("InvalidateNC({0}): Called", Window(handle));
778 driver.InvalidateNC(handle);
782 internal static bool IsEnabled(IntPtr handle) {
783 #if DriverDebug || DriverDebugState
784 Console.WriteLine("IsEnabled({0}): Called, Result={1}", Window(handle), driver.IsEnabled(handle));
786 return driver.IsEnabled(handle);
789 internal static bool IsKeyLocked (VirtualKeys key)
791 #if DriverDebug || DriverDebugState
792 Console.WriteLine("IsKeyLocked({0}): Called, Result={1}", key, driver.IsKeyLocked(key));
794 return driver.IsKeyLocked (key);
797 internal static bool IsVisible(IntPtr handle) {
798 #if DriverDebug || DriverDebugState
799 Console.WriteLine("IsVisible({0}): Called, Result={1}", Window(handle), driver.IsVisible(handle));
801 return driver.IsVisible(handle);
804 internal static void KillTimer (Timer timer)
807 Console.WriteLine("KillTimer({0}): Called", timer);
809 driver.KillTimer (timer);
812 internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
814 Console.WriteLine("MenuToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
816 driver.MenuToScreen(handle, ref x, ref y);
819 internal static void OverrideCursor(IntPtr cursor) {
821 Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
823 driver.OverrideCursor(cursor);
826 internal static void PaintEventEnd (ref Message msg, IntPtr handle, bool client) {
827 #if DriverDebug || DriverDebugPaint
828 Console.WriteLine("PaintEventEnd({0}, {1}, {2}): Called from thread {3}", msg, Window(handle), client, Thread.CurrentThread.GetHashCode());
830 driver.PaintEventEnd (ref msg, handle, client);
833 internal static PaintEventArgs PaintEventStart (ref Message msg, IntPtr handle, bool client) {
834 #if DriverDebug || DriverDebugPaint
835 Console.WriteLine("PaintEventStart({0}, {1}, {2}): Called from thread {3}", msg, Window(handle), client, Thread.CurrentThread.GetHashCode());
837 return driver.PaintEventStart (ref msg, handle, client);
840 internal static bool PeekMessage(Object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
841 return driver.PeekMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax, flags);
844 internal static bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
846 Console.WriteLine("PostMessage({0}, {1}, {2:X}, {3:X}): Called", Window(hwnd), message, wParam.ToInt32(), lParam.ToInt32());
848 return driver.PostMessage(hwnd, message, wParam, lParam);
851 internal static bool PostMessage(ref MSG msg) {
853 Console.WriteLine("PostMessage({0}): Called", msg);
855 return driver.PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
858 internal static void PostQuitMessage(int exitCode) {
860 Console.WriteLine("PostQuitMessage({0}): Called", exitCode);
862 driver.PostQuitMessage(exitCode);
865 internal static void RaiseIdle (EventArgs e)
868 Console.WriteLine("RaiseIdle({0}): Called", e.ToString ());
871 driver.RaiseIdle (e);
874 internal static void RequestAdditionalWM_NCMessages(IntPtr handle, bool hover, bool leave) {
876 Console.WriteLine("RequestAdditionalWM_NCMessages({0}, {1}, {2}): Called", Window(handle), hover, leave);
878 driver.RequestAdditionalWM_NCMessages (handle, hover, leave);
881 internal static void RequestNCRecalc(IntPtr handle) {
883 Console.WriteLine("RequestNCRecalc({0}): Called", Window(handle));
885 driver.RequestNCRecalc(handle);
888 internal static void ResetMouseHover(IntPtr handle) {
890 Console.WriteLine("ResetMouseHover({0}): Called", Window(handle));
892 driver.ResetMouseHover(handle);
895 internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
897 Console.WriteLine("ScreenToClient({0}, {1}, {2}): Called", Window(handle), x, y);
899 driver.ScreenToClient (handle, ref x, ref y);
902 internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
904 Console.WriteLine("ScreenToMenu({0}, {1}, {2}): Called", Window(handle), x, y);
906 driver.ScreenToMenu(handle, ref x, ref y);
909 internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
911 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}, {4}): Called", Window(handle), rectangle, XAmount, YAmount, with_children);
913 driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
916 internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
918 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}): Called", Window(handle), XAmount, YAmount, with_children);
920 driver.ScrollWindow(handle, XAmount, YAmount, with_children);
923 internal static void SendAsyncMethod (AsyncMethodData data) {
925 Console.WriteLine("SendAsyncMethod({0}): Called", data);
927 driver.SendAsyncMethod (data);
930 internal static int SendInput (IntPtr hwnd, Queue keys) {
932 Console.WriteLine("SendInput({0}, {1}): Called", hwnd, keys);
934 return driver.SendInput (hwnd, keys);
937 internal static IntPtr SendMessage (IntPtr handle, Msg message, IntPtr wParam, IntPtr lParam) {
939 Console.WriteLine("SendMessage ({0}, {1}, {2:X}, {3:X}): Called", Window(handle), message, wParam.ToInt32(), lParam.ToInt32());
941 return driver.SendMessage (handle, message, wParam, lParam);
944 internal static void SendMessage (ref Message m) {
946 Console.WriteLine("SendMessage ({0}): Called", m);
948 m.Result = driver.SendMessage(m.HWnd, (Msg)m.Msg, m.WParam, m.LParam);
951 internal static void SetAllowDrop (IntPtr handle, bool value)
954 Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
956 driver.SetAllowDrop (handle, value);
959 internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
961 Console.WriteLine("SetBorderStyle({0}, {1}): Called", Window(handle), border_style);
963 driver.SetBorderStyle(handle, border_style);
966 internal static void SetCaretPos(IntPtr handle, int x, int y) {
968 Console.WriteLine("SetCaretPos({0}, {1}, {2}): Called", Window(handle), x, y);
970 driver.SetCaretPos(handle, x, y);
973 internal static void SetClipRegion(IntPtr handle, Region region) {
975 Console.WriteLine("SetClipRegion({0}, {1}): Called", Window(handle), region);
977 driver.SetClipRegion(handle, region);
980 internal static void SetCursor(IntPtr handle, IntPtr cursor) {
982 Console.WriteLine("SetCursor({0}, {1:X}): Called", Window(handle), cursor.ToInt32());
984 driver.SetCursor(handle, cursor);
987 internal static void SetCursorPos(IntPtr handle, int x, int y) {
989 Console.WriteLine("SetCursorPos({0}, {1}, {2}): Called", Window(handle), x, y);
991 driver.SetCursorPos(handle, x, y);
994 internal static void SetFocus(IntPtr handle) {
996 Console.WriteLine("SetFocus({0}): Called", Window(handle));
998 driver.SetFocus(handle);
1001 internal static void SetForegroundWindow(IntPtr handle) {
1003 Console.WriteLine("SetForegroundWindow({0}): Called", Window(handle));
1005 driver.SetForegroundWindow(handle);
1008 internal static void SetIcon(IntPtr handle, Icon icon) {
1010 Console.WriteLine("SetIcon({0}, {1}): Called", Window(handle), icon);
1012 driver.SetIcon(handle, icon);
1015 internal static void SetMenu(IntPtr handle, Menu menu) {
1017 Console.WriteLine("SetMenu({0}, {1}): Called", Window(handle), menu);
1019 driver.SetMenu(handle, menu);
1022 internal static void SetModal(IntPtr handle, bool Modal) {
1023 #if DriverDebug || DriverDebugState
1024 Console.WriteLine("SetModal({0}, {1}): Called", Window(handle), Modal);
1026 driver.SetModal(handle, Modal);
1029 internal static IntPtr SetParent(IntPtr handle, IntPtr hParent) {
1031 Console.WriteLine("SetParent({0}, {1:X}): Called", Window(handle), Window(hParent));
1033 return driver.SetParent(handle, hParent);
1036 internal static void SetTimer (Timer timer)
1039 Console.WriteLine("SetTimer({0}): Called", timer);
1041 driver.SetTimer (timer);
1044 internal static bool SetTopmost(IntPtr handle, bool Enabled) {
1046 Console.WriteLine("SetTopMost({0}, {1}): Called", Window(handle), Enabled);
1048 return driver.SetTopmost(handle, Enabled);
1051 internal static bool SetOwner(IntPtr handle, IntPtr hWndOwner) {
1053 Console.WriteLine("SetOwner({0}, {1}): Called", Window(handle), Window(hWndOwner));
1055 return driver.SetOwner(handle, hWndOwner);
1058 internal static bool SetVisible (IntPtr handle, bool visible, bool activate)
1060 #if DriverDebug || DriverDebugState
1061 Console.WriteLine("SetVisible({0}, {1}, {2}): Called", Window(handle), visible, activate);
1063 return driver.SetVisible (handle, visible, activate);
1066 internal static void SetWindowMinMax(IntPtr handle, Rectangle maximized, Size min, Size max) {
1067 #if DriverDebug || DriverDebugState
1068 Console.WriteLine("SetWindowMinMax({0}, {1}, {2}, {3}): Called", Window(handle), maximized, min, max);
1070 driver.SetWindowMinMax(handle, maximized, min, max);
1073 internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
1075 Console.WriteLine("SetWindowPos({0}, {1}, {2}, {3}, {4}): Called", Window(handle), x, y, width, height);
1077 driver.SetWindowPos(handle, x, y, width, height);
1080 internal static void SetWindowState(IntPtr handle, FormWindowState state) {
1081 #if DriverDebug || DriverDebugState
1082 Console.WriteLine("SetWindowState({0} {1}): Called", Window(handle), state);
1084 driver.SetWindowState(handle, state);
1087 internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
1089 Console.WriteLine("SetWindowStyle({0}): Called", Window(handle));
1091 driver.SetWindowStyle(handle, cp);
1094 internal static double GetWindowTransparency (IntPtr handle)
1097 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
1099 return driver.GetWindowTransparency(handle);
1102 internal static void SetWindowTransparency(IntPtr handle, double transparency, Color key)
1105 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
1107 driver.SetWindowTransparency(handle, transparency, key);
1110 internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
1112 Console.WriteLine("SetZOrder({0}, {1:X}, {2}, {3}): Called", Window(handle), Window(AfterhWnd), Top, Bottom);
1114 return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
1117 internal static void ShowCursor(bool show) {
1119 Console.WriteLine("ShowCursor({0}): Called", show);
1121 driver.ShowCursor(show);
1124 internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
1126 Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", Window(handle), data, allowedEffects);
1128 return driver.StartDrag (handle, data, allowedEffects);
1131 internal static object StartLoop(Thread thread) {
1133 Console.WriteLine("StartLoop({0:X}): Called", thread.GetHashCode());
1135 return driver.StartLoop(thread);
1138 internal static TransparencySupport SupportsTransparency() {
1140 Console.WriteLine("SupportsTransparency(): Called, result={0}", driver.SupportsTransparency());
1142 return driver.SupportsTransparency();
1145 internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
1147 Console.WriteLine("SystrayAdd({0}, {1}): Called", Window(handle), tip);
1149 return driver.SystrayAdd(handle, tip, icon, out tt);
1152 internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
1154 Console.WriteLine("SystrayChange({0}, {1}): Called", Window(handle), tip);
1156 driver.SystrayChange(handle, tip, icon, ref tt);
1159 internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
1161 Console.WriteLine("SystrayRemove({0}): Called", Window(handle));
1163 driver.SystrayRemove(handle, ref tt);
1167 internal static void SystrayBalloon(IntPtr handle, int timeout, string title, string text, ToolTipIcon icon) {
1169 Console.WriteLine("SystrayBalloon ({0}, {1}, {2}, {3}, {4}): Called", Window(handle), timeout, title, text, icon);
1171 driver.SystrayBalloon(handle, timeout, title, text, icon);
1175 internal static bool Text(IntPtr handle, string text) {
1177 Console.WriteLine("Text({0}, {1}): Called", Window(handle), text);
1179 return driver.Text(handle, text);
1182 internal static bool TranslateMessage(ref MSG msg) {
1183 return driver.TranslateMessage(ref msg);
1186 internal static void UngrabWindow(IntPtr handle) {
1188 Console.WriteLine("UngrabWindow({0}): Called", Window(handle));
1190 driver.UngrabWindow(handle);
1193 internal static void UpdateWindow(IntPtr handle) {
1195 Console.WriteLine("UpdateWindow({0}): Called", Window(handle));
1197 driver.UpdateWindow(handle);
1201 internal static void CreateOffscreenDrawable (IntPtr handle,
1202 int width, int height,
1203 out object offscreen_drawable)
1206 Console.WriteLine("CreateOffscreenDrawable({2}, {0},{1}): Called", width, height, Window(handle));
1208 driver.CreateOffscreenDrawable (handle, width, height,
1209 out offscreen_drawable);
1212 internal static void DestroyOffscreenDrawable (object offscreen_drawable)
1215 Console.WriteLine("DestroyOffscreenDrawable(): Called");
1217 driver.DestroyOffscreenDrawable (offscreen_drawable);
1220 internal static Graphics GetOffscreenGraphics (object offscreen_drawable)
1223 Console.WriteLine("GetOffscreenGraphics(): Called");
1225 return driver.GetOffscreenGraphics (offscreen_drawable);
1228 internal static void BlitFromOffscreen (IntPtr dest_handle,
1230 object offscreen_drawable,
1231 Graphics offscreen_dc,
1235 Console.WriteLine("BlitFromOffscreen({0}): Called", Window(dest_handle));
1237 driver.BlitFromOffscreen (dest_handle, dest_dc, offscreen_drawable, offscreen_dc, r);
1241 // Santa's little helper
1242 internal static void Version() {
1243 Console.WriteLine("Xplat version $Revision: $");
1245 #endregion // Public Static Methods
1248 public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
1249 public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
1250 #endregion // Delegates
1252 [DllImport ("libc")]
1253 static extern int uname (IntPtr buf);