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 ("MONO_MWF_USE_QUARTZ_BACKEND") != null)
88 driver=XplatUIOSX.GetInstance ();
89 else if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null)
90 driver=XplatUIX11_new.GetInstance ();
92 driver=XplatUIX11.GetInstance ();
94 driver=XplatUIWin32.GetInstance();
97 driver.InitializeDriver();
99 // Initialize things that need to be done after the driver is ready
100 DataFormats.GetFormat(0);
102 #endregion // Constructor & Destructor
104 #region Public Static Properties
106 public static bool RunningOnUnix {
109 return (Environment.OSVersion.Platform == PlatformID.Unix);
111 int platform = (int) Environment.OSVersion.Platform;
112 return (platform == 128);
117 public static int ActiveWindowTrackingDelay {
118 get { return driver.ActiveWindowTrackingDelay; }
121 internal static string DefaultClassName {
123 return default_class_name;
127 default_class_name=value;
131 static public Size Border3DSize {
133 return driver.Border3DSize;
137 static public Size BorderSize {
139 return driver.BorderSize;
143 static public Size CaptionButtonSize {
145 return driver.CaptionButtonSize;
149 static public int CaptionHeight {
151 return driver.CaptionHeight;
155 public static int CaretBlinkTime { get { return driver.CaretBlinkTime; } }
156 public static int CaretWidth { get { return driver.CaretWidth; } }
158 static public Size CursorSize {
160 return driver.CursorSize;
164 static public Size DoubleClickSize {
166 return driver.DoubleClickSize;
170 static public int DoubleClickTime {
172 return driver.DoubleClickTime;
176 static public bool DragFullWindows {
178 return driver.DragFullWindows;
182 static public Size DragSize {
184 return driver.DragSize;
188 static public Size FixedFrameBorderSize {
190 return driver.FixedFrameBorderSize;
194 public static int FontSmoothingContrast { get { return driver.FontSmoothingContrast; } }
195 public static int FontSmoothingType { get { return driver.FontSmoothingType; } }
197 public static Size FrameBorderSize {
199 return driver.FrameBorderSize;
203 public static int HorizontalResizeBorderThickness { get { return driver.HorizontalResizeBorderThickness; } }
205 static public int HorizontalScrollBarHeight {
207 return driver.HorizontalScrollBarHeight;
211 static public Size IconSize {
213 return driver.IconSize;
217 public static bool IsActiveWindowTrackingEnabled { get { return driver.IsActiveWindowTrackingEnabled; } }
218 public static bool IsComboBoxAnimationEnabled { get { return driver.IsComboBoxAnimationEnabled; } }
219 public static bool IsDropShadowEnabled { get { return driver.IsDropShadowEnabled; } }
220 public static bool IsFontSmoothingEnabled { get { return driver.IsFontSmoothingEnabled; } }
221 public static bool IsHotTrackingEnabled { get { return driver.IsHotTrackingEnabled; } }
222 public static bool IsIconTitleWrappingEnabled { get { return driver.IsIconTitleWrappingEnabled; } }
223 public static bool IsKeyboardPreferred { get { return driver.IsKeyboardPreferred; } }
224 public static bool IsListBoxSmoothScrollingEnabled { get { return driver.IsListBoxSmoothScrollingEnabled; } }
225 public static bool IsMenuAnimationEnabled { get { return driver.IsMenuAnimationEnabled; } }
226 public static bool IsMenuFadeEnabled { get { return driver.IsMenuFadeEnabled; } }
227 public static bool IsMinimizeRestoreAnimationEnabled { get { return driver.IsMinimizeRestoreAnimationEnabled; } }
228 public static bool IsSelectionFadeEnabled { get { return driver.IsSelectionFadeEnabled; } }
229 public static bool IsSnapToDefaultEnabled { get { return driver.IsSnapToDefaultEnabled; } }
230 public static bool IsTitleBarGradientEnabled { get { return driver.IsTitleBarGradientEnabled; } }
231 public static bool IsToolTipAnimationEnabled { get { return driver.IsToolTipAnimationEnabled; } }
233 static public int KeyboardSpeed {
235 return driver.KeyboardSpeed;
239 static public int KeyboardDelay {
241 return driver.KeyboardDelay;
245 static public Size MaxWindowTrackSize {
247 return driver.MaxWindowTrackSize;
251 static public bool MenuAccessKeysUnderlined {
253 return driver.MenuAccessKeysUnderlined;
257 static public Size MenuBarButtonSize { get { return driver.MenuBarButtonSize; } }
258 static public int MenuShowDelay { get { return driver.MenuShowDelay; } }
260 static public Size MinimizedWindowSize {
262 return driver.MinimizedWindowSize;
266 static public Size MinimizedWindowSpacingSize {
268 return driver.MinimizedWindowSpacingSize;
272 static public Size MinimumWindowSize {
274 return driver.MinimumWindowSize;
278 static public Size MinWindowTrackSize {
280 return driver.MinWindowTrackSize;
284 public static int MouseSpeed {
285 get { return driver.MouseSpeed; }
288 static public Size SmallIconSize {
290 return driver.SmallIconSize;
294 static public int MenuHeight {
296 return driver.MenuHeight;
300 static public int MouseButtonCount {
302 return driver.MouseButtonCount;
306 static public bool MouseButtonsSwapped {
308 return driver.MouseButtonsSwapped;
312 static public Size MouseHoverSize {
314 return driver.MouseHoverSize;
318 static public int MouseHoverTime {
320 return driver.MouseHoverTime;
324 static public int MouseWheelScrollDelta {
326 return driver.MouseWheelScrollDelta;
330 static public bool MouseWheelPresent {
332 return driver.MouseWheelPresent;
336 public static LeftRightAlignment PopupMenuAlignment {
337 get { return driver.PopupMenuAlignment; }
341 public static PowerStatus PowerStatus {
342 get { return driver.PowerStatus; }
346 public static int SizingBorderWidth {
347 get { return driver.SizingBorderWidth; }
350 public static Size SmallCaptionButtonSize {
351 get { return driver.SmallCaptionButtonSize; }
354 public static bool UIEffectsEnabled {
355 get { return driver.UIEffectsEnabled; }
358 static public bool UserClipWontExposeParent {
360 return driver.UserClipWontExposeParent;
364 public static int VerticalResizeBorderThickness { get { return driver.VerticalResizeBorderThickness; } }
366 static public int VerticalScrollBarWidth {
368 return driver.VerticalScrollBarWidth;
372 static public Rectangle VirtualScreen {
374 return driver.VirtualScreen;
378 static public Rectangle WorkingArea {
380 return driver.WorkingArea;
384 public static bool ThemesEnabled {
386 return XplatUI.driver.ThemesEnabled;
390 #endregion // Public Static Properties
394 internal static event EventHandler Idle {
396 driver.Idle += value;
399 driver.Idle -= value;
405 #region Public Static Methods
406 internal static void Activate(IntPtr handle) {
408 Console.WriteLine("Activate({0}): Called", Window(handle));
410 driver.Activate(handle);
413 internal static void AudibleAlert() {
415 Console.WriteLine("AudibleAlert(): Called");
417 driver.AudibleAlert();
420 internal static bool CalculateWindowRect(ref Rectangle ClientRect, CreateParams cp, Menu menu, out Rectangle WindowRect) {
422 Console.WriteLine("CalculateWindowRect({0}, {1}, {2}): Called", ClientRect, cp, menu);
424 return driver.CalculateWindowRect(ref ClientRect, cp, menu, out WindowRect);
427 internal static void CaretVisible(IntPtr handle, bool visible) {
429 Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
431 driver.CaretVisible(handle, visible);
434 internal static void CreateCaret(IntPtr handle, int width, int height) {
436 Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
438 driver.CreateCaret(handle, width, height);
441 internal static IntPtr CreateWindow(CreateParams cp) {
442 #if DriverDebug || DriverDebugCreate
445 handle = driver.CreateWindow(cp);
447 Console.WriteLine("CreateWindow(): Called, returning {0:X}", handle.ToInt32());
450 return driver.CreateWindow(cp);
454 internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
455 #if DriverDebug || DriverDebugCreate
456 Console.WriteLine("CreateWindow(): Called");
458 return driver.CreateWindow(Parent, X, Y, Width, Height);
461 internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
463 Console.WriteLine("ClientToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
465 driver.ClientToScreen(handle, ref x, ref y);
468 internal static int[] ClipboardAvailableFormats(IntPtr handle) {
470 Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
472 return driver.ClipboardAvailableFormats(handle);
475 internal static void ClipboardClose(IntPtr handle) {
477 Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
479 driver.ClipboardClose(handle);
482 internal static int ClipboardGetID(IntPtr handle, string format) {
484 Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
486 return driver.ClipboardGetID(handle, format);
489 internal static IntPtr ClipboardOpen(bool primary_selection) {
491 Console.WriteLine("ClipboardOpen(): Called");
493 return driver.ClipboardOpen (primary_selection);
496 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
498 Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, type, converter);
500 driver.ClipboardStore(handle, obj, type, converter);
503 internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
505 Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
507 return driver.ClipboardRetrieve(handle, type, converter);
510 internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
512 Console.WriteLine("DefineCursor(...): Called");
514 return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
517 internal static IntPtr DefineStdCursor(StdCursor id) {
518 return driver.DefineStdCursor(id);
521 internal static Bitmap DefineStdCursorBitmap(StdCursor id) {
522 return driver.DefineStdCursorBitmap(id);
525 internal static IntPtr DefWndProc(ref Message msg) {
526 return driver.DefWndProc(ref msg);
529 internal static void DestroyCaret(IntPtr handle) {
531 Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
533 driver.DestroyCaret(handle);
536 internal static void DestroyCursor(IntPtr cursor) {
538 Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
540 driver.DestroyCursor(cursor);
543 internal static void DestroyWindow(IntPtr handle) {
544 #if DriverDebug || DriverDebugDestroy
545 Console.WriteLine("DestroyWindow({0}): Called", Window(handle));
547 driver.DestroyWindow(handle);
550 internal static IntPtr DispatchMessage(ref MSG msg) {
551 return driver.DispatchMessage(ref msg);
554 internal static void DoEvents() {
558 internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
560 Console.WriteLine("DrawReversibleRectangle({0}, {1}, {2}): Called", Window(handle), rect, line_width);
562 driver.DrawReversibleRectangle(handle, rect, line_width);
565 internal static void FillReversibleRectangle (Rectangle rectangle, Color backColor)
568 Console.WriteLine("FillReversibleRectangle({0}, {1}): Called", rectangle, backColor);
570 driver.FillReversibleRectangle (rectangle, backColor);
573 internal static void DrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style)
576 Console.WriteLine("DrawReversibleFrame({0}, {1}, {2}): Called", rectangle, backColor, style);
578 driver.DrawReversibleFrame (rectangle, backColor, style);
581 internal static void DrawReversibleLine (Point start, Point end, Color backColor)
584 Console.WriteLine("DrawReversibleLine({0}, {1}, {2}): Called", start, end, backColor);
586 driver.DrawReversibleLine (start, end, backColor);
589 internal static void EnableThemes() {
590 driver.EnableThemes();
593 internal static void EnableWindow(IntPtr handle, bool Enable) {
594 #if DriverDebug || DriverDebugState
595 Console.WriteLine("EnableWindow({0}, {1}): Called", Window(handle), Enable);
597 driver.EnableWindow(handle, Enable);
600 internal static void EndLoop(Thread thread) {
602 Console.WriteLine("EndLoop({0:X}): Called", thread.GetHashCode());
604 driver.EndLoop(thread);
607 internal static IntPtr GetActive() {
609 Console.WriteLine("GetActive(): Called");
611 return driver.GetActive();
614 internal static SizeF GetAutoScaleSize(Font font) {
616 Console.WriteLine("GetAutoScaleSize({0}): Called", font);
618 return driver.GetAutoScaleSize(font);
621 internal static Region GetClipRegion(IntPtr handle) {
623 Console.WriteLine("GetClipRegion({0}): Called", Window(handle));
625 return driver.GetClipRegion(handle);
628 internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
630 Console.WriteLine("GetCursorInfo({0}): Called", cursor.ToInt32());
632 driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
635 internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
637 Console.WriteLine("GetCursorPos({0}): Called", Window(handle));
639 driver.GetCursorPos(handle, out x, out y);
642 internal static void GetDisplaySize(out Size size) {
644 Console.WriteLine("GetDisplaySize(): Called");
646 driver.GetDisplaySize(out size);
649 internal static IntPtr GetFocus() {
651 Console.WriteLine("GetFocus(): Called, Result:{0}", Window(driver.GetFocus()));
653 return driver.GetFocus();
656 internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
658 Console.WriteLine("GetFontMetrics(): Called");
660 return driver.GetFontMetrics(g, font, out ascent, out descent);
663 internal static Point GetMenuOrigin(IntPtr handle) {
665 Console.WriteLine("GetMenuOrigin({0}): Called", Window(handle));
667 return driver.GetMenuOrigin(handle);
670 internal static bool GetMessage(object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
671 return driver.GetMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax);
674 internal static IntPtr GetParent(IntPtr handle) {
676 Console.WriteLine("GetParent({0}): Called", Window(handle));
678 return driver.GetParent(handle);
681 internal static IntPtr GetPreviousWindow(IntPtr handle) {
682 return driver.GetPreviousWindow(handle);
685 internal static bool GetText(IntPtr handle, out string text) {
687 Console.WriteLine("GetText({0}): Called", Window(handle));
689 return driver.GetText(handle, out text);
692 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) {
694 Console.WriteLine("GetWindowPos({0}): Called", Window(handle));
696 driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
699 /* this method can (and does, on X11) return
700 * (FormWindowState)(-1), when the state of the window
701 * cannot be determined (in the X11 case, when the
702 * window isn't mapped.) Checking for the additional
703 * return value is less expensive than
704 * throwing/catching an exception. */
705 internal static FormWindowState GetWindowState(IntPtr handle) {
707 Console.WriteLine("GetWindowState({0}): Called", Window(handle));
709 return driver.GetWindowState(handle);
712 internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
714 Console.WriteLine("GrabInfo(): Called");
716 driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
719 internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
721 Console.WriteLine("GrabWindow({0}, {1}): Called", Window(handle), Window(ConfineToHwnd));
723 driver.GrabWindow(handle, ConfineToHwnd);
726 internal static void HandleException(Exception e) {
727 driver.HandleException(e);
730 internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
732 Console.WriteLine("Invalidate({0}, {1}, {2}): Called", Window(handle), rc, clear);
734 driver.Invalidate(handle, rc, clear);
737 internal static void InvalidateNC (IntPtr handle)
740 Console.WriteLine("InvalidateNC({0}): Called", Window(handle));
742 driver.InvalidateNC(handle);
746 internal static bool IsEnabled(IntPtr handle) {
747 #if DriverDebug || DriverDebugState
748 Console.WriteLine("IsEnabled({0}): Called, Result={1}", Window(handle), driver.IsEnabled(handle));
750 return driver.IsEnabled(handle);
753 internal static bool IsKeyLocked (VirtualKeys key)
755 #if DriverDebug || DriverDebugState
756 Console.WriteLine("IsKeyLocked({0}): Called, Result={1}", key, driver.IsKeyLocked(key));
758 return driver.IsKeyLocked (key);
761 internal static bool IsVisible(IntPtr handle) {
762 #if DriverDebug || DriverDebugState
763 Console.WriteLine("IsVisible({0}): Called, Result={1}", Window(handle), driver.IsVisible(handle));
765 return driver.IsVisible(handle);
768 internal static void KillTimer (Timer timer)
771 Console.WriteLine("KillTimer({0}): Called", timer);
773 driver.KillTimer (timer);
776 internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
778 Console.WriteLine("MenuToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
780 driver.MenuToScreen(handle, ref x, ref y);
783 internal static void OverrideCursor(IntPtr cursor) {
785 Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
787 driver.OverrideCursor(cursor);
790 internal static void PaintEventEnd (ref Message msg, IntPtr handle, bool client) {
791 #if DriverDebug || DriverDebugPaint
792 Console.WriteLine("PaintEventEnd({0}, {1}, {2}): Called from thread {3}", msg, Window(handle), client, Thread.CurrentThread.GetHashCode());
794 driver.PaintEventEnd (ref msg, handle, client);
797 internal static PaintEventArgs PaintEventStart (ref Message msg, IntPtr handle, bool client) {
798 #if DriverDebug || DriverDebugPaint
799 Console.WriteLine("PaintEventStart({0}, {1}, {2}): Called from thread {3}", msg, Window(handle), client, Thread.CurrentThread.GetHashCode());
801 return driver.PaintEventStart (ref msg, handle, client);
804 internal static bool PeekMessage(Object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
805 return driver.PeekMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax, flags);
808 internal static bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
810 Console.WriteLine("PostMessage({0}, {1}, {2:X}, {3:X}): Called", Window(hwnd), message, wParam.ToInt32(), lParam.ToInt32());
812 return driver.PostMessage(hwnd, message, wParam, lParam);
815 internal static bool PostMessage(ref MSG msg) {
817 Console.WriteLine("PostMessage({0}): Called", msg);
819 return driver.PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
822 internal static void PostQuitMessage(int exitCode) {
824 Console.WriteLine("PostQuitMessage({0}): Called", exitCode);
826 driver.PostQuitMessage(exitCode);
829 internal static void RaiseIdle (EventArgs e)
832 Console.WriteLine("RaiseIdle({0}): Called", e.ToString ());
835 driver.RaiseIdle (e);
838 internal static void RequestAdditionalWM_NCMessages(IntPtr handle, bool hover, bool leave) {
840 Console.WriteLine("RequestAdditionalWM_NCMessages({0}, {1}, {2}): Called", Window(handle), hover, leave);
842 driver.RequestAdditionalWM_NCMessages (handle, hover, leave);
845 internal static void RequestNCRecalc(IntPtr handle) {
847 Console.WriteLine("RequestNCRecalc({0}): Called", Window(handle));
849 driver.RequestNCRecalc(handle);
852 internal static void ResetMouseHover(IntPtr handle) {
854 Console.WriteLine("ResetMouseHover({0}): Called", Window(handle));
856 driver.ResetMouseHover(handle);
859 internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
861 Console.WriteLine("ScreenToClient({0}, {1}, {2}): Called", Window(handle), x, y);
863 driver.ScreenToClient (handle, ref x, ref y);
866 internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
868 Console.WriteLine("ScreenToMenu({0}, {1}, {2}): Called", Window(handle), x, y);
870 driver.ScreenToMenu(handle, ref x, ref y);
873 internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
875 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}, {4}): Called", Window(handle), rectangle, XAmount, YAmount, with_children);
877 driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
880 internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
882 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}): Called", Window(handle), XAmount, YAmount, with_children);
884 driver.ScrollWindow(handle, XAmount, YAmount, with_children);
887 internal static void SendAsyncMethod (AsyncMethodData data) {
889 Console.WriteLine("SendAsyncMethod({0}): Called", data);
891 driver.SendAsyncMethod (data);
894 internal static int SendInput (IntPtr hwnd, Queue keys) {
896 Console.WriteLine("SendInput({0}, {1}): Called", hwnd, keys);
898 return driver.SendInput (hwnd, keys);
901 internal static IntPtr SendMessage (IntPtr handle, Msg message, IntPtr wParam, IntPtr lParam) {
903 Console.WriteLine("SendMessage ({0}, {1}, {2:X}, {3:X}): Called", Window(handle), message, wParam.ToInt32(), lParam.ToInt32());
905 return driver.SendMessage (handle, message, wParam, lParam);
908 internal static void SendMessage (ref Message m) {
910 Console.WriteLine("SendMessage ({0}): Called", m);
912 m.Result = driver.SendMessage(m.HWnd, (Msg)m.Msg, m.WParam, m.LParam);
915 internal static void SetAllowDrop (IntPtr handle, bool value)
918 Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
920 driver.SetAllowDrop (handle, value);
923 internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
925 Console.WriteLine("SetBorderStyle({0}, {1}): Called", Window(handle), border_style);
927 driver.SetBorderStyle(handle, border_style);
930 internal static void SetCaretPos(IntPtr handle, int x, int y) {
932 Console.WriteLine("SetCaretPos({0}, {1}, {2}): Called", Window(handle), x, y);
934 driver.SetCaretPos(handle, x, y);
937 internal static void SetClipRegion(IntPtr handle, Region region) {
939 Console.WriteLine("SetClipRegion({0}, {1}): Called", Window(handle), region);
941 driver.SetClipRegion(handle, region);
944 internal static void SetCursor(IntPtr handle, IntPtr cursor) {
946 Console.WriteLine("SetCursor({0}, {1:X}): Called", Window(handle), cursor.ToInt32());
948 driver.SetCursor(handle, cursor);
951 internal static void SetCursorPos(IntPtr handle, int x, int y) {
953 Console.WriteLine("SetCursorPos({0}, {1}, {2}): Called", Window(handle), x, y);
955 driver.SetCursorPos(handle, x, y);
958 internal static void SetFocus(IntPtr handle) {
960 Console.WriteLine("SetFocus({0}): Called", Window(handle));
962 driver.SetFocus(handle);
965 internal static void SetIcon(IntPtr handle, Icon icon) {
967 Console.WriteLine("SetIcon({0}, {1}): Called", Window(handle), icon);
969 driver.SetIcon(handle, icon);
972 internal static void SetMenu(IntPtr handle, Menu menu) {
974 Console.WriteLine("SetMenu({0}, {1}): Called", Window(handle), menu);
976 driver.SetMenu(handle, menu);
979 internal static void SetModal(IntPtr handle, bool Modal) {
980 #if DriverDebug || DriverDebugState
981 Console.WriteLine("SetModal({0}, {1}): Called", Window(handle), Modal);
983 driver.SetModal(handle, Modal);
986 internal static IntPtr SetParent(IntPtr handle, IntPtr hParent) {
988 Console.WriteLine("SetParent({0}, {1:X}): Called", Window(handle), Window(hParent));
990 return driver.SetParent(handle, hParent);
993 internal static void SetTimer (Timer timer)
996 Console.WriteLine("SetTimer({0}): Called", timer);
998 driver.SetTimer (timer);
1001 internal static bool SetTopmost(IntPtr handle, bool Enabled) {
1003 Console.WriteLine("SetTopMost({0}, {1}): Called", Window(handle), Enabled);
1005 return driver.SetTopmost(handle, Enabled);
1008 internal static bool SetOwner(IntPtr handle, IntPtr hWndOwner) {
1010 Console.WriteLine("SetOwner({0}, {1}): Called", Window(handle), Window(hWndOwner));
1012 return driver.SetOwner(handle, hWndOwner);
1015 internal static bool SetVisible (IntPtr handle, bool visible, bool activate)
1017 #if DriverDebug || DriverDebugState
1018 Console.WriteLine("SetVisible({0}, {1}, {2}): Called", Window(handle), visible, activate);
1020 return driver.SetVisible (handle, visible, activate);
1023 internal static void SetWindowMinMax(IntPtr handle, Rectangle maximized, Size min, Size max) {
1024 #if DriverDebug || DriverDebugState
1025 Console.WriteLine("SetWindowMinMax({0}, {1}, {2}, {3}): Called", Window(handle), maximized, min, max);
1027 driver.SetWindowMinMax(handle, maximized, min, max);
1030 internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
1032 Console.WriteLine("SetWindowPos({0}, {1}, {2}, {3}, {4}): Called", Window(handle), x, y, width, height);
1034 driver.SetWindowPos(handle, x, y, width, height);
1037 internal static void SetWindowState(IntPtr handle, FormWindowState state) {
1038 #if DriverDebug || DriverDebugState
1039 Console.WriteLine("SetWindowState({0} {1}): Called", Window(handle), state);
1041 driver.SetWindowState(handle, state);
1044 internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
1046 Console.WriteLine("SetWindowStyle({0}): Called", Window(handle));
1048 driver.SetWindowStyle(handle, cp);
1051 internal static double GetWindowTransparency (IntPtr handle)
1054 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
1056 return driver.GetWindowTransparency(handle);
1059 internal static void SetWindowTransparency(IntPtr handle, double transparency, Color key)
1062 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
1064 driver.SetWindowTransparency(handle, transparency, key);
1067 internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
1069 Console.WriteLine("SetZOrder({0}, {1:X}, {2}, {3}): Called", Window(handle), Window(AfterhWnd), Top, Bottom);
1071 return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
1074 internal static void ShowCursor(bool show) {
1076 Console.WriteLine("ShowCursor({0}): Called", show);
1078 driver.ShowCursor(show);
1081 internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
1083 Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", Window(handle), data, allowedEffects);
1085 return driver.StartDrag (handle, data, allowedEffects);
1088 internal static object StartLoop(Thread thread) {
1090 Console.WriteLine("StartLoop({0:X}): Called", thread.GetHashCode());
1092 return driver.StartLoop(thread);
1095 internal static TransparencySupport SupportsTransparency() {
1097 Console.WriteLine("SupportsTransparency(): Called, result={0}", driver.SupportsTransparency());
1099 return driver.SupportsTransparency();
1102 internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
1104 Console.WriteLine("SystrayAdd({0}, {1}): Called", Window(handle), tip);
1106 return driver.SystrayAdd(handle, tip, icon, out tt);
1109 internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
1111 Console.WriteLine("SystrayChange({0}, {1}): Called", Window(handle), tip);
1113 driver.SystrayChange(handle, tip, icon, ref tt);
1116 internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
1118 Console.WriteLine("SystrayRemove({0}): Called", Window(handle));
1120 driver.SystrayRemove(handle, ref tt);
1124 internal static void SystrayBalloon(IntPtr handle, int timeout, string title, string text, ToolTipIcon icon) {
1126 Console.WriteLine("SystrayBalloon ({0}, {1}, {2}, {3}, {4}): Called", Window(handle), timeout, title, text, icon);
1128 driver.SystrayBalloon(handle, timeout, title, text, icon);
1132 internal static bool Text(IntPtr handle, string text) {
1134 Console.WriteLine("Text({0}, {1}): Called", Window(handle), text);
1136 return driver.Text(handle, text);
1139 internal static bool TranslateMessage(ref MSG msg) {
1140 return driver.TranslateMessage(ref msg);
1143 internal static void UngrabWindow(IntPtr handle) {
1145 Console.WriteLine("UngrabWindow({0}): Called", Window(handle));
1147 driver.UngrabWindow(handle);
1150 internal static void UpdateWindow(IntPtr handle) {
1152 Console.WriteLine("UpdateWindow({0}): Called", Window(handle));
1154 driver.UpdateWindow(handle);
1158 internal static void CreateOffscreenDrawable (IntPtr handle,
1159 int width, int height,
1160 out object offscreen_drawable)
1163 Console.WriteLine("CreateOffscreenDrawable({2}, {0},{1}): Called", width, height, Window(handle));
1165 driver.CreateOffscreenDrawable (handle, width, height,
1166 out offscreen_drawable);
1169 internal static void DestroyOffscreenDrawable (object offscreen_drawable)
1172 Console.WriteLine("DestroyOffscreenDrawable(): Called");
1174 driver.DestroyOffscreenDrawable (offscreen_drawable);
1177 internal static Graphics GetOffscreenGraphics (object offscreen_drawable)
1180 Console.WriteLine("GetOffscreenGraphics(): Called");
1182 return driver.GetOffscreenGraphics (offscreen_drawable);
1185 internal static void BlitFromOffscreen (IntPtr dest_handle,
1187 object offscreen_drawable,
1188 Graphics offscreen_dc,
1192 Console.WriteLine("BlitFromOffscreen({0}): Called", Window(dest_handle));
1194 driver.BlitFromOffscreen (dest_handle, dest_dc, offscreen_drawable, offscreen_dc, r);
1198 // Santa's little helper
1199 internal static void Version() {
1200 Console.WriteLine("Xplat version $Revision: $");
1202 #endregion // Public Static Methods
1205 public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
1206 public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
1207 #endregion // Delegates