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 Size Border3DSize {
120 return driver.Border3DSize;
124 static public Size BorderSize {
126 return driver.BorderSize;
130 static public Size CaptionButtonSize {
132 return driver.CaptionButtonSize;
136 static public int CaptionHeight {
138 return driver.CaptionHeight;
142 static public Size CursorSize {
144 return driver.CursorSize;
148 static public Size DoubleClickSize {
150 return driver.DoubleClickSize;
154 static public int DoubleClickTime {
156 return driver.DoubleClickTime;
160 static public bool DragFullWindows {
162 return driver.DragFullWindows;
166 static public Size DragSize {
168 return driver.DragSize;
172 static public Size FixedFrameBorderSize {
174 return driver.FixedFrameBorderSize;
178 public static Size FrameBorderSize {
180 return driver.FrameBorderSize;
184 static public int HorizontalScrollBarHeight {
186 return driver.HorizontalScrollBarHeight;
190 static public Size IconSize {
192 return driver.IconSize;
196 static public int KeyboardSpeed {
198 return driver.KeyboardSpeed;
202 static public int KeyboardDelay {
204 return driver.KeyboardDelay;
208 static public Size MaxWindowTrackSize {
210 return driver.MaxWindowTrackSize;
214 static public bool MenuAccessKeysUnderlined {
216 return driver.MenuAccessKeysUnderlined;
220 static public Size MinimizedWindowSize {
222 return driver.MinimizedWindowSize;
226 static public Size MinimizedWindowSpacingSize {
228 return driver.MinimizedWindowSpacingSize;
232 static public Size MinimumWindowSize {
234 return driver.MinimumWindowSize;
238 static public Size MinWindowTrackSize {
240 return driver.MinWindowTrackSize;
244 static public Size SmallIconSize {
246 return driver.SmallIconSize;
250 static public int MenuHeight {
252 return driver.MenuHeight;
256 static public int MouseButtonCount {
258 return driver.MouseButtonCount;
262 static public bool MouseButtonsSwapped {
264 return driver.MouseButtonsSwapped;
268 static public Size MouseHoverSize {
270 return driver.MouseHoverSize;
274 static public int MouseHoverTime {
276 return driver.MouseHoverTime;
280 static public int MouseWheelScrollDelta {
282 return driver.MouseWheelScrollDelta;
286 static public bool MouseWheelPresent {
288 return driver.MouseWheelPresent;
292 static public bool UserClipWontExposeParent {
294 return driver.UserClipWontExposeParent;
298 static public int VerticalScrollBarWidth {
300 return driver.VerticalScrollBarWidth;
304 static public Rectangle VirtualScreen {
306 return driver.VirtualScreen;
310 static public Rectangle WorkingArea {
312 return driver.WorkingArea;
316 public static bool ThemesEnabled {
318 return XplatUI.driver.ThemesEnabled;
322 #endregion // Public Static Properties
326 internal static event EventHandler Idle {
328 driver.Idle += value;
331 driver.Idle -= value;
337 #region Public Static Methods
338 internal static void Activate(IntPtr handle) {
340 Console.WriteLine("Activate({0}): Called", Window(handle));
342 driver.Activate(handle);
345 internal static void AudibleAlert() {
347 Console.WriteLine("AudibleAlert(): Called");
349 driver.AudibleAlert();
352 internal static bool CalculateWindowRect(ref Rectangle ClientRect, CreateParams cp, Menu menu, out Rectangle WindowRect) {
354 Console.WriteLine("CalculateWindowRect({0}, {1}, {2}): Called", ClientRect, cp, menu);
356 return driver.CalculateWindowRect(ref ClientRect, cp, menu, out WindowRect);
359 internal static void CaretVisible(IntPtr handle, bool visible) {
361 Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
363 driver.CaretVisible(handle, visible);
366 internal static void CreateCaret(IntPtr handle, int width, int height) {
368 Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
370 driver.CreateCaret(handle, width, height);
373 internal static IntPtr CreateWindow(CreateParams cp) {
374 #if DriverDebug || DriverDebugCreate
377 handle = driver.CreateWindow(cp);
379 Console.WriteLine("CreateWindow(): Called, returning {0:X}", handle.ToInt32());
382 return driver.CreateWindow(cp);
386 internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
387 #if DriverDebug || DriverDebugCreate
388 Console.WriteLine("CreateWindow(): Called");
390 return driver.CreateWindow(Parent, X, Y, Width, Height);
393 internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
395 Console.WriteLine("ClientToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
397 driver.ClientToScreen(handle, ref x, ref y);
400 internal static int[] ClipboardAvailableFormats(IntPtr handle) {
402 Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
404 return driver.ClipboardAvailableFormats(handle);
407 internal static void ClipboardClose(IntPtr handle) {
409 Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
411 driver.ClipboardClose(handle);
414 internal static int ClipboardGetID(IntPtr handle, string format) {
416 Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
418 return driver.ClipboardGetID(handle, format);
421 internal static IntPtr ClipboardOpen(bool primary_selection) {
423 Console.WriteLine("ClipboardOpen(): Called");
425 return driver.ClipboardOpen (primary_selection);
428 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
430 Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, type, converter);
432 driver.ClipboardStore(handle, obj, type, converter);
435 internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
437 Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
439 return driver.ClipboardRetrieve(handle, type, converter);
442 internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
444 Console.WriteLine("DefineCursor(...): Called");
446 return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
449 internal static IntPtr DefineStdCursor(StdCursor id) {
450 return driver.DefineStdCursor(id);
453 internal static Bitmap DefineStdCursorBitmap(StdCursor id) {
454 return driver.DefineStdCursorBitmap(id);
457 internal static IntPtr DefWndProc(ref Message msg) {
458 return driver.DefWndProc(ref msg);
461 internal static void DestroyCaret(IntPtr handle) {
463 Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
465 driver.DestroyCaret(handle);
468 internal static void DestroyCursor(IntPtr cursor) {
470 Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
472 driver.DestroyCursor(cursor);
475 internal static void DestroyWindow(IntPtr handle) {
476 #if DriverDebug || DriverDebugDestroy
477 Console.WriteLine("DestroyWindow({0}): Called", Window(handle));
479 driver.DestroyWindow(handle);
482 internal static IntPtr DispatchMessage(ref MSG msg) {
483 return driver.DispatchMessage(ref msg);
486 internal static void DoEvents() {
490 internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
492 Console.WriteLine("DrawReversibleRectangle({0}, {1}, {2}): Called", Window(handle), rect, line_width);
494 driver.DrawReversibleRectangle(handle, rect, line_width);
497 internal static void FillReversibleRectangle (Rectangle rectangle, Color backColor)
500 Console.WriteLine("FillReversibleRectangle({0}, {1}): Called", rectangle, backColor);
502 driver.FillReversibleRectangle (rectangle, backColor);
505 internal static void DrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style)
508 Console.WriteLine("DrawReversibleFrame({0}, {1}, {2}): Called", rectangle, backColor, style);
510 driver.DrawReversibleFrame (rectangle, backColor, style);
513 internal static void DrawReversibleLine (Point start, Point end, Color backColor)
516 Console.WriteLine("DrawReversibleLine({0}, {1}, {2}): Called", start, end, backColor);
518 driver.DrawReversibleLine (start, end, backColor);
521 internal static void EnableThemes() {
522 driver.EnableThemes();
525 internal static void EnableWindow(IntPtr handle, bool Enable) {
526 #if DriverDebug || DriverDebugState
527 Console.WriteLine("EnableWindow({0}, {1}): Called", Window(handle), Enable);
529 driver.EnableWindow(handle, Enable);
532 internal static void EndLoop(Thread thread) {
534 Console.WriteLine("EndLoop({0:X}): Called", thread.GetHashCode());
536 driver.EndLoop(thread);
539 internal static IntPtr GetActive() {
541 Console.WriteLine("GetActive(): Called");
543 return driver.GetActive();
546 internal static SizeF GetAutoScaleSize(Font font) {
548 Console.WriteLine("GetAutoScaleSize({0}): Called", font);
550 return driver.GetAutoScaleSize(font);
553 internal static Region GetClipRegion(IntPtr handle) {
555 Console.WriteLine("GetClipRegion({0}): Called", Window(handle));
557 return driver.GetClipRegion(handle);
560 internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
562 Console.WriteLine("GetCursorInfo({0}): Called", cursor.ToInt32());
564 driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
567 internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
569 Console.WriteLine("GetCursorPos({0}): Called", Window(handle));
571 driver.GetCursorPos(handle, out x, out y);
574 internal static void GetDisplaySize(out Size size) {
576 Console.WriteLine("GetDisplaySize(): Called");
578 driver.GetDisplaySize(out size);
581 internal static IntPtr GetFocus() {
583 Console.WriteLine("GetFocus(): Called, Result:{0}", Window(driver.GetFocus()));
585 return driver.GetFocus();
588 internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
590 Console.WriteLine("GetFontMetrics(): Called");
592 return driver.GetFontMetrics(g, font, out ascent, out descent);
595 internal static Point GetMenuOrigin(IntPtr handle) {
597 Console.WriteLine("GetMenuOrigin({0}): Called", Window(handle));
599 return driver.GetMenuOrigin(handle);
602 internal static bool GetMessage(object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
603 return driver.GetMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax);
606 internal static IntPtr GetParent(IntPtr handle) {
608 Console.WriteLine("GetParent({0}): Called", Window(handle));
610 return driver.GetParent(handle);
613 internal static bool GetText(IntPtr handle, out string text) {
615 Console.WriteLine("GetText({0}): Called", Window(handle));
617 return driver.GetText(handle, out text);
620 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) {
622 Console.WriteLine("GetWindowPos({0}): Called", Window(handle));
624 driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
627 /* this method can (and does, on X11) return
628 * (FormWindowState)(-1), when the state of the window
629 * cannot be determined (in the X11 case, when the
630 * window isn't mapped.) Checking for the additional
631 * return value is less expensive than
632 * throwing/catching an exception. */
633 internal static FormWindowState GetWindowState(IntPtr handle) {
635 Console.WriteLine("GetWindowState({0}): Called", Window(handle));
637 return driver.GetWindowState(handle);
640 internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
642 Console.WriteLine("GrabInfo(): Called");
644 driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
647 internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
649 Console.WriteLine("GrabWindow({0}, {1}): Called", Window(handle), Window(ConfineToHwnd));
651 driver.GrabWindow(handle, ConfineToHwnd);
654 internal static void HandleException(Exception e) {
655 driver.HandleException(e);
658 internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
660 Console.WriteLine("Invalidate({0}, {1}, {2}): Called", Window(handle), rc, clear);
662 driver.Invalidate(handle, rc, clear);
665 internal static void InvalidateNC (IntPtr handle)
668 Console.WriteLine("InvalidateNC({0}): Called", Window(handle));
670 driver.InvalidateNC(handle);
674 internal static bool IsEnabled(IntPtr handle) {
675 #if DriverDebug || DriverDebugState
676 Console.WriteLine("IsEnabled({0}): Called, Result={1}", Window(handle), driver.IsEnabled(handle));
678 return driver.IsEnabled(handle);
681 internal static bool IsVisible(IntPtr handle) {
682 #if DriverDebug || DriverDebugState
683 Console.WriteLine("IsVisible({0}): Called, Result={1}", Window(handle), driver.IsVisible(handle));
685 return driver.IsVisible(handle);
688 internal static void KillTimer (Timer timer)
691 Console.WriteLine("KillTimer({0}): Called", timer);
693 driver.KillTimer (timer);
696 internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
698 Console.WriteLine("MenuToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
700 driver.MenuToScreen(handle, ref x, ref y);
703 internal static void OverrideCursor(IntPtr cursor) {
705 Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
707 driver.OverrideCursor(cursor);
710 internal static void PaintEventEnd(IntPtr handle, bool client) {
711 #if DriverDebug || DriverDebugPaint
712 Console.WriteLine("PaintEventEnd({0}, {1}): Called from thread {2}", Window(handle), client, Thread.CurrentThread.GetHashCode());
714 driver.PaintEventEnd(handle, client);
717 internal static PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
718 #if DriverDebug || DriverDebugPaint
719 Console.WriteLine("PaintEventStart({0}, {1}): Called from thread {2}", Window(handle), client, Thread.CurrentThread.GetHashCode());
721 return driver.PaintEventStart(handle, client);
724 internal static bool PeekMessage(Object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
725 return driver.PeekMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax, flags);
728 internal static bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
730 Console.WriteLine("PostMessage({0}, {1}, {2:X}, {3:X}): Called", Window(hwnd), message, wParam.ToInt32(), lParam.ToInt32());
732 return driver.PostMessage(hwnd, message, wParam, lParam);
735 internal static bool PostMessage(ref MSG msg) {
737 Console.WriteLine("PostMessage({0}): Called", msg);
739 return driver.PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
742 internal static void PostQuitMessage(int exitCode) {
744 Console.WriteLine("PostQuitMessage({0}): Called", exitCode);
746 driver.PostQuitMessage(exitCode);
749 internal static void RequestAdditionalWM_NCMessages(IntPtr handle, bool hover, bool leave) {
751 Console.WriteLine("RequestAdditionalWM_NCMessages({0}, {1}, {2}): Called", Window(handle), hover, leave);
753 driver.RequestAdditionalWM_NCMessages (handle, hover, leave);
756 internal static void RequestNCRecalc(IntPtr handle) {
758 Console.WriteLine("RequestNCRecalc({0}): Called", Window(handle));
760 driver.RequestNCRecalc(handle);
763 internal static void ResetMouseHover(IntPtr handle) {
765 Console.WriteLine("ResetMouseHover({0}): Called", Window(handle));
767 driver.ResetMouseHover(handle);
770 internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
772 Console.WriteLine("ScreenToClient({0}, {1}, {2}): Called", Window(handle), x, y);
774 driver.ScreenToClient (handle, ref x, ref y);
777 internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
779 Console.WriteLine("ScreenToMenu({0}, {1}, {2}): Called", Window(handle), x, y);
781 driver.ScreenToMenu(handle, ref x, ref y);
784 internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
786 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}, {4}): Called", Window(handle), rectangle, XAmount, YAmount, with_children);
788 driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
791 internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
793 Console.WriteLine("ScrollWindow({0}, {2}, {3}, {4}): Called", Window(handle), XAmount, YAmount, with_children);
795 driver.ScrollWindow(handle, XAmount, YAmount, with_children);
798 internal static void SendAsyncMethod (AsyncMethodData data) {
800 Console.WriteLine("SendAsyncMethod({0}): Called", data);
802 driver.SendAsyncMethod (data);
805 internal static int SendInput (IntPtr hwnd, Queue keys) {
807 Console.WriteLine("SendInput({0}, {1}): Called", hwnd, keys);
809 return driver.SendInput (hwnd, keys);
812 internal static IntPtr SendMessage (IntPtr handle, Msg message, IntPtr wParam, IntPtr lParam) {
814 Console.WriteLine("SendMessage ({0}, {1}, {2:X}, {3:X}): Called", Window(handle), message, wParam.ToInt32(), lParam.ToInt32());
816 return driver.SendMessage (handle, message, wParam, lParam);
819 internal static void SendMessage (ref Message m) {
821 Console.WriteLine("SendMessage ({0}): Called", m);
823 m.Result = driver.SendMessage(m.HWnd, (Msg)m.Msg, m.WParam, m.LParam);
826 internal static void SetAllowDrop (IntPtr handle, bool value)
829 Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
831 driver.SetAllowDrop (handle, value);
834 internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
836 Console.WriteLine("SetBorderStyle({0}, {1}): Called", Window(handle), border_style);
838 driver.SetBorderStyle(handle, border_style);
841 internal static void SetCaretPos(IntPtr handle, int x, int y) {
843 Console.WriteLine("SetCaretPos({0}, {1}, {2}): Called", Window(handle), x, y);
845 driver.SetCaretPos(handle, x, y);
848 internal static void SetClipRegion(IntPtr handle, Region region) {
850 Console.WriteLine("SetClipRegion({0}, {1}): Called", Window(handle), region);
852 driver.SetClipRegion(handle, region);
855 internal static void SetCursor(IntPtr handle, IntPtr cursor) {
857 Console.WriteLine("SetCursor({0}, {1:X}): Called", Window(handle), cursor.ToInt32());
859 driver.SetCursor(handle, cursor);
862 internal static void SetCursorPos(IntPtr handle, int x, int y) {
864 Console.WriteLine("SetCursorPos({0}, {1}, {2}): Called", Window(handle), x, y);
866 driver.SetCursorPos(handle, x, y);
869 internal static void SetFocus(IntPtr handle) {
871 Console.WriteLine("SetFocus({0}): Called", Window(handle));
873 driver.SetFocus(handle);
876 internal static void SetIcon(IntPtr handle, Icon icon) {
878 Console.WriteLine("SetIcon({0}, {1}): Called", Window(handle), icon);
880 driver.SetIcon(handle, icon);
883 internal static void SetMenu(IntPtr handle, Menu menu) {
885 Console.WriteLine("SetMenu({0}, {1}): Called", Window(handle), menu);
887 driver.SetMenu(handle, menu);
890 internal static void SetModal(IntPtr handle, bool Modal) {
891 #if DriverDebug || DriverDebugState
892 Console.WriteLine("SetModal({0}, {1}): Called", Window(handle), Modal);
894 driver.SetModal(handle, Modal);
897 internal static IntPtr SetParent(IntPtr handle, IntPtr hParent) {
899 Console.WriteLine("SetParent({0}, {1:X}): Called", Window(handle), Window(hParent));
901 return driver.SetParent(handle, hParent);
904 internal static void SetTimer (Timer timer)
907 Console.WriteLine("SetTimer({0}): Called", timer);
909 driver.SetTimer (timer);
912 internal static bool SetTopmost(IntPtr handle, bool Enabled) {
914 Console.WriteLine("SetTopMost({0}, {1}): Called", Window(handle), Enabled);
916 return driver.SetTopmost(handle, Enabled);
919 internal static bool SetOwner(IntPtr handle, IntPtr hWndOwner) {
921 Console.WriteLine("SetOwner({0}, {1}): Called", Window(handle), Window(hWndOwner));
923 return driver.SetOwner(handle, hWndOwner);
926 internal static bool SetVisible (IntPtr handle, bool visible, bool activate)
928 #if DriverDebug || DriverDebugState
929 Console.WriteLine("SetVisible({0}, {1}, {2}): Called", Window(handle), visible, activate);
931 return driver.SetVisible (handle, visible, activate);
934 internal static void SetWindowMinMax(IntPtr handle, Rectangle maximized, Size min, Size max) {
935 #if DriverDebug || DriverDebugState
936 Console.WriteLine("SetWindowMinMax({0}, {1}, {2}, {3}): Called", Window(handle), maximized, min, max);
938 driver.SetWindowMinMax(handle, maximized, min, max);
941 internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
943 Console.WriteLine("SetWindowPos({0}, {1}, {2}, {3}, {4}): Called", Window(handle), x, y, width, height);
945 driver.SetWindowPos(handle, x, y, width, height);
948 internal static void SetWindowState(IntPtr handle, FormWindowState state) {
949 #if DriverDebug || DriverDebugState
950 Console.WriteLine("SetWindowState({0} {1}): Called", Window(handle), state);
952 driver.SetWindowState(handle, state);
955 internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
957 Console.WriteLine("SetWindowStyle({0}): Called", Window(handle));
959 driver.SetWindowStyle(handle, cp);
962 internal static double GetWindowTransparency (IntPtr handle)
965 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
967 return driver.GetWindowTransparency(handle);
970 internal static void SetWindowTransparency(IntPtr handle, double transparency, Color key)
973 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
975 driver.SetWindowTransparency(handle, transparency, key);
978 internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
980 Console.WriteLine("SetZOrder({0}, {1:X}, {2}, {3}): Called", Window(handle), Window(AfterhWnd), Top, Bottom);
982 return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
985 internal static void ShowCursor(bool show) {
987 Console.WriteLine("ShowCursor({0}): Called", show);
989 driver.ShowCursor(show);
992 internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
994 Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", Window(handle), data, allowedEffects);
996 return driver.StartDrag (handle, data, allowedEffects);
999 internal static object StartLoop(Thread thread) {
1001 Console.WriteLine("StartLoop({0:X}): Called", thread.GetHashCode());
1003 return driver.StartLoop(thread);
1006 internal static TransparencySupport SupportsTransparency() {
1008 Console.WriteLine("SupportsTransparency(): Called, result={0}", driver.SupportsTransparency());
1010 return driver.SupportsTransparency();
1013 internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
1015 Console.WriteLine("SystrayAdd({0}, {1}): Called", Window(handle), tip);
1017 return driver.SystrayAdd(handle, tip, icon, out tt);
1020 internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
1022 Console.WriteLine("SystrayChange({0}, {1}): Called", Window(handle), tip);
1024 driver.SystrayChange(handle, tip, icon, ref tt);
1027 internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
1029 Console.WriteLine("SystrayRemove({0}): Called", Window(handle));
1031 driver.SystrayRemove(handle, ref tt);
1035 internal static void SystrayBalloon(IntPtr handle, int timeout, string title, string text, ToolTipIcon icon) {
1037 Console.WriteLine("SystrayBalloon ({0}, {1}, {2}, {3}, {4}): Called", Window(handle), timeout, title, text, icon);
1039 driver.SystrayBalloon(handle, timeout, title, text, icon);
1043 internal static bool Text(IntPtr handle, string text) {
1045 Console.WriteLine("Text({0}, {1}): Called", Window(handle), text);
1047 return driver.Text(handle, text);
1050 internal static bool TranslateMessage(ref MSG msg) {
1051 return driver.TranslateMessage(ref msg);
1054 internal static void UngrabWindow(IntPtr handle) {
1056 Console.WriteLine("UngrabWindow({0}): Called", Window(handle));
1058 driver.UngrabWindow(handle);
1061 internal static void UpdateWindow(IntPtr handle) {
1063 Console.WriteLine("UpdateWindow({0}): Called", Window(handle));
1065 driver.UpdateWindow(handle);
1069 internal static void CreateOffscreenDrawable (IntPtr handle,
1070 int width, int height,
1071 out object offscreen_drawable)
1074 Console.WriteLine("CreateOffscreenDrawable({2}, {0},{1}): Called", width, height, Window(handle));
1076 driver.CreateOffscreenDrawable (handle, width, height,
1077 out offscreen_drawable);
1080 internal static void DestroyOffscreenDrawable (object offscreen_drawable)
1083 Console.WriteLine("DestroyOffscreenDrawable(): Called");
1085 driver.DestroyOffscreenDrawable (offscreen_drawable);
1088 internal static Graphics GetOffscreenGraphics (object offscreen_drawable)
1091 Console.WriteLine("GetOffscreenGraphics(): Called");
1093 return driver.GetOffscreenGraphics (offscreen_drawable);
1096 internal static void BlitFromOffscreen (IntPtr dest_handle,
1098 object offscreen_drawable,
1099 Graphics offscreen_dc,
1103 Console.WriteLine("BlitFromOffscreen({0}): Called", Window(dest_handle));
1105 driver.BlitFromOffscreen (dest_handle, dest_dc, offscreen_drawable, offscreen_dc, r);
1109 // Santa's little helper
1110 internal static void Version() {
1111 Console.WriteLine("Xplat version $Revision: $");
1113 #endregion // Public Static Methods
1116 public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
1117 public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
1118 #endregion // Delegates