1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2004-2006 Novell, Inc.
23 // Peter Bartok pbartok@novell.com
27 // define to log API calls to stdout
29 #undef DriverDebugPaint
30 #undef DriverDebugCreate
31 #undef DriverDebugDestroy
32 #undef DriverDebugState
36 using System.ComponentModel;
37 using System.Collections;
38 using System.Diagnostics;
39 using System.Runtime.InteropServices;
40 using System.Threading;
41 using System.Windows.Forms.X11Internal;
43 namespace System.Windows.Forms {
44 internal class XplatUI {
45 #region Local Variables
46 static XplatUIDriver driver;
47 static String default_class_name;
48 #endregion // Local Variables
50 #region Private Methods
51 internal static string Window(IntPtr handle) {
52 return String.Format("'{0}' ({1:X})", Control.FromHandle(handle), handle.ToInt32());
54 #endregion // Private Methods
58 static public Keys ModifierKeys {
60 return driver.ModifierKeys;
64 static public MouseButtons MouseButtons {
66 return driver.MouseButtons;
70 static public Point MousePosition {
72 return driver.MousePosition;
77 #endregion // Subclasses
79 #region Constructor & Destructor
81 // Compose name with current domain id because on Win32 we register class name
82 // and name must be unique to process. If we load MWF into multiple appdomains
83 // and try to register same class name we fail.
84 default_class_name = "SWFClass" + System.Threading.Thread.GetDomainID().ToString();
86 // check for Unix platforms - see FAQ for more details
87 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
88 int platform = (int) Environment.OSVersion.Platform;
89 if ((platform == 4) || (platform == 128)) {
90 if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_QUARTZ_BACKEND") != null)
91 driver=XplatUIOSX.GetInstance ();
92 else if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null)
93 driver=XplatUIX11_new.GetInstance ();
95 driver=XplatUIX11.GetInstance ();
97 driver=XplatUIWin32.GetInstance();
100 driver.InitializeDriver();
102 // Initialize things that need to be done after the driver is ready
103 DataFormats.GetFormat(0);
105 #endregion // Constructor & Destructor
107 #region Public Static Properties
108 internal static string DefaultClassName {
110 return default_class_name;
114 default_class_name=value;
118 static public int CaptionHeight {
120 return driver.Caption;
124 static public Size CursorSize {
126 return driver.CursorSize;
130 static public bool DragFullWindows {
132 return driver.DragFullWindows;
136 static public Size DragSize {
138 return driver.DragSize;
142 public static Size FrameBorderSize {
144 return driver.FrameBorderSize;
148 static public int HorizontalScrollBarHeight {
150 return driver.HorizontalScrollBarHeight;
154 static public Size IconSize {
156 return driver.IconSize;
160 static public int KeyboardSpeed {
162 return driver.KeyboardSpeed;
166 static public int KeyboardDelay {
168 return driver.KeyboardDelay;
172 static public Size MaxWindowTrackSize {
174 return driver.MaxWindowTrackSize;
178 static public Size MinimizedWindowSize {
180 return driver.MinimizedWindowSize;
184 static public Size MinimizedWindowSpacingSize {
186 return driver.MinimizedWindowSpacingSize;
190 static public Size MinimumWindowSize {
192 return driver.MinimumWindowSize;
196 static public Size MinWindowTrackSize {
198 return driver.MinWindowTrackSize;
202 static public Size SmallIconSize {
204 return driver.SmallIconSize;
208 static public int MenuHeight {
210 return driver.MenuHeight;
214 static public int MouseButtonCount {
216 return driver.MouseButtonCount;
220 static public bool MouseButtonsSwapped {
222 return driver.MouseButtonsSwapped;
226 static public Size MouseHoverSize {
228 return driver.MouseHoverSize;
232 static public int MouseHoverTime {
234 return driver.MouseHoverTime;
238 static public bool MouseWheelPresent {
240 return driver.MouseWheelPresent;
244 static public bool UserClipWontExposeParent {
246 return driver.UserClipWontExposeParent;
250 static public int VerticalScrollBarWidth {
252 return driver.VerticalScrollBarWidth;
256 static public Rectangle VirtualScreen {
258 return driver.VirtualScreen;
262 static public Rectangle WorkingArea {
264 return driver.WorkingArea;
268 public static bool ThemesEnabled {
270 return XplatUI.driver.ThemesEnabled;
275 #endregion // Public Static Properties
278 internal static event EventHandler Idle {
280 driver.Idle += value;
283 driver.Idle -= value;
289 #region Public Static Methods
290 internal static void Activate(IntPtr handle) {
292 Console.WriteLine("Activate({0}): Called", Window(handle));
294 driver.Activate(handle);
297 internal static void AudibleAlert() {
299 Console.WriteLine("AudibleAlert(): Called");
301 driver.AudibleAlert();
304 internal static bool CalculateWindowRect(ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect) {
306 Console.WriteLine("CalculateWindowRect({0}, {1}, {2}, {3}): Called", ClientRect, Style, ExStyle, menu);
308 return driver.CalculateWindowRect(ref ClientRect, Style, ExStyle, menu, out WindowRect);
311 internal static void CaretVisible(IntPtr handle, bool visible) {
313 Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
315 driver.CaretVisible(handle, visible);
318 internal static void CreateCaret(IntPtr handle, int width, int height) {
320 Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
322 driver.CreateCaret(handle, width, height);
325 internal static IntPtr CreateWindow(CreateParams cp) {
326 #if DriverDebug || DriverDebugCreate
329 handle = driver.CreateWindow(cp);
331 Console.WriteLine("CreateWindow(): Called, returning {0:X}", handle.ToInt32());
334 return driver.CreateWindow(cp);
338 internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
339 #if DriverDebug || DriverDebugCreate
340 Console.WriteLine("CreateWindow(): Called");
342 return driver.CreateWindow(Parent, X, Y, Width, Height);
345 internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
347 Console.WriteLine("ClientToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
349 driver.ClientToScreen(handle, ref x, ref y);
352 internal static int[] ClipboardAvailableFormats(IntPtr handle) {
354 Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
356 return driver.ClipboardAvailableFormats(handle);
359 internal static void ClipboardClose(IntPtr handle) {
361 Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
363 driver.ClipboardClose(handle);
366 internal static int ClipboardGetID(IntPtr handle, string format) {
368 Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
370 return driver.ClipboardGetID(handle, format);
373 internal static IntPtr ClipboardOpen(bool primary_selection) {
375 Console.WriteLine("ClipboardOpen(): Called");
377 return driver.ClipboardOpen (primary_selection);
380 internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
382 Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, type, converter);
384 driver.ClipboardStore(handle, obj, type, converter);
387 internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
389 Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
391 return driver.ClipboardRetrieve(handle, type, converter);
394 internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
396 Console.WriteLine("DefineCursor(...): Called");
398 return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
401 internal static IntPtr DefineStdCursor(StdCursor id) {
402 return driver.DefineStdCursor(id);
405 internal static IntPtr DefWndProc(ref Message msg) {
406 return driver.DefWndProc(ref msg);
409 internal static void DestroyCaret(IntPtr handle) {
411 Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
413 driver.DestroyCaret(handle);
416 internal static void DestroyCursor(IntPtr cursor) {
418 Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
420 driver.DestroyCursor(cursor);
423 internal static void DestroyWindow(IntPtr handle) {
424 #if DriverDebug || DriverDebugDestroy
425 Console.WriteLine("DestroyWindow({0}): Called", Window(handle));
427 driver.DestroyWindow(handle);
430 internal static IntPtr DispatchMessage(ref MSG msg) {
431 return driver.DispatchMessage(ref msg);
434 internal static void DoEvents() {
438 internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
440 Console.WriteLine("DrawReversibleRectangle({0}, {1}, {2}): Called", Window(handle), rect, line_width);
442 driver.DrawReversibleRectangle(handle, rect, line_width);
445 internal static void FillReversibleRectangle (Rectangle rectangle, Color backColor)
448 Console.WriteLine("FillReversibleRectangle({0}, {1}): Called", rectangle, backColor);
450 driver.FillReversibleRectangle (rectangle, backColor);
453 internal static void DrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style)
456 Console.WriteLine("DrawReversibleFrame({0}, {1}, {2}): Called", rectangle, backColor, style);
458 driver.DrawReversibleFrame (rectangle, backColor, style);
461 internal static void DrawReversibleLine (Point start, Point end, Color backColor)
464 Console.WriteLine("DrawReversibleLine({0}, {1}, {2}): Called", start, end, backColor);
466 driver.DrawReversibleLine (start, end, backColor);
469 internal static void EnableThemes() {
470 driver.EnableThemes();
473 internal static void EnableWindow(IntPtr handle, bool Enable) {
474 #if DriverDebug || DriverDebugState
475 Console.WriteLine("EnableWindow({0}, {1}): Called", Window(handle), Enable);
477 driver.EnableWindow(handle, Enable);
480 internal static void EndLoop(Thread thread) {
482 Console.WriteLine("EndLoop({0:X}): Called", thread.GetHashCode());
484 driver.EndLoop(thread);
487 internal static IntPtr GetActive() {
489 Console.WriteLine("GetActive(): Called");
491 return driver.GetActive();
494 internal static SizeF GetAutoScaleSize(Font font) {
496 Console.WriteLine("GetAutoScaleSize({0}): Called", font);
498 return driver.GetAutoScaleSize(font);
501 internal static Region GetClipRegion(IntPtr handle) {
503 Console.WriteLine("GetClipRegion({0}): Called", Window(handle));
505 return driver.GetClipRegion(handle);
508 internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
510 Console.WriteLine("GetCursorInfo({0}): Called", cursor.ToInt32());
512 driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
515 internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
517 Console.WriteLine("GetCursorPos({0}): Called", Window(handle));
519 driver.GetCursorPos(handle, out x, out y);
522 internal static void GetDisplaySize(out Size size) {
524 Console.WriteLine("GetDisplaySize(): Called");
526 driver.GetDisplaySize(out size);
529 internal static IntPtr GetFocus() {
531 Console.WriteLine("GetFocus(): Called, Result:{0}", Window(driver.GetFocus()));
533 return driver.GetFocus();
536 internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
538 Console.WriteLine("GetFontMetrics(): Called");
540 return driver.GetFontMetrics(g, font, out ascent, out descent);
543 internal static Point GetMenuOrigin(IntPtr handle) {
545 Console.WriteLine("GetMenuOrigin({0}): Called", Window(handle));
547 return driver.GetMenuOrigin(handle);
550 internal static bool GetMessage(object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
551 return driver.GetMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax);
554 internal static IntPtr GetParent(IntPtr handle) {
556 Console.WriteLine("GetParent({0}): Called", Window(handle));
558 return driver.GetParent(handle);
561 internal static bool GetText(IntPtr handle, out string text) {
563 Console.WriteLine("GetText({0}): Called", Window(handle));
565 return driver.GetText(handle, out text);
568 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) {
570 Console.WriteLine("GetWindowPos({0}): Called", Window(handle));
572 driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
575 /* this method can (and does, on X11) return
576 * (FormWindowState)(-1), when the state of the window
577 * cannot be determined (in the X11 case, when the
578 * window isn't mapped.) Checking for the additional
579 * return value is less expensive than
580 * throwing/catching an exception. */
581 internal static FormWindowState GetWindowState(IntPtr handle) {
583 Console.WriteLine("GetWindowState({0}): Called", Window(handle));
585 return driver.GetWindowState(handle);
588 internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
590 Console.WriteLine("GrabInfo(): Called");
592 driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
595 internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
597 Console.WriteLine("GrabWindow({0}, {1}): Called", Window(handle), Window(ConfineToHwnd));
599 driver.GrabWindow(handle, ConfineToHwnd);
602 internal static void HandleException(Exception e) {
603 driver.HandleException(e);
606 internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
608 Console.WriteLine("Invalidate({0}, {1}, {2}): Called", Window(handle), rc, clear);
610 driver.Invalidate(handle, rc, clear);
613 internal static void InvalidateNC (IntPtr handle)
616 Console.WriteLine("InvalidateNC({0}): Called", Window(handle));
618 driver.InvalidateNC(handle);
622 internal static bool IsEnabled(IntPtr handle) {
623 #if DriverDebug || DriverDebugState
624 Console.WriteLine("IsEnabled({0}): Called, Result={1}", Window(handle), driver.IsEnabled(handle));
626 return driver.IsEnabled(handle);
629 internal static bool IsVisible(IntPtr handle) {
630 #if DriverDebug || DriverDebugState
631 Console.WriteLine("IsVisible({0}): Called, Result={1}", Window(handle), driver.IsVisible(handle));
633 return driver.IsVisible(handle);
636 internal static void KillTimer (Timer timer)
639 Console.WriteLine("KillTimer({0}): Called", timer);
641 driver.KillTimer (timer);
644 internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
646 Console.WriteLine("MenuToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
648 driver.MenuToScreen(handle, ref x, ref y);
651 internal static void OverrideCursor(IntPtr cursor) {
653 Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
655 driver.OverrideCursor(cursor);
658 internal static void PaintEventEnd(IntPtr handle, bool client) {
659 #if DriverDebug || DriverDebugPaint
660 Console.WriteLine("PaintEventEnd({0}, {1}): Called from thread {2}", Window(handle), client, Thread.CurrentThread.GetHashCode());
662 driver.PaintEventEnd(handle, client);
665 internal static PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
666 #if DriverDebug || DriverDebugPaint
667 Console.WriteLine("PaintEventStart({0}, {1}): Called from thread {2}", Window(handle), client, Thread.CurrentThread.GetHashCode());
669 return driver.PaintEventStart(handle, client);
672 internal static bool PeekMessage(Object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
673 return driver.PeekMessage(queue_id, ref msg, hWnd, wFilterMin, wFilterMax, flags);
676 internal static bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
678 Console.WriteLine("PostMessage({0}, {1}, {2:X}, {3:X}): Called", Window(hwnd), message, wParam.ToInt32(), lParam.ToInt32());
680 return driver.PostMessage(hwnd, message, wParam, lParam);
683 internal static bool PostMessage(ref MSG msg) {
685 Console.WriteLine("PostMessage({0}): Called", msg);
687 return driver.PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
690 internal static void PostQuitMessage(int exitCode) {
692 Console.WriteLine("PostQuitMessage({0}): Called", exitCode);
694 driver.PostQuitMessage(exitCode);
697 internal static void RequestAdditionalWM_NCMessages(IntPtr handle, bool hover, bool leave) {
699 Console.WriteLine("RequestAdditionalWM_NCMessages({0}, {1}, {2}): Called", Window(handle), hover, leave);
701 driver.RequestAdditionalWM_NCMessages (handle, hover, leave);
704 internal static void RequestNCRecalc(IntPtr handle) {
706 Console.WriteLine("RequestNCRecalc({0}): Called", Window(handle));
708 driver.RequestNCRecalc(handle);
711 internal static void ResetMouseHover(IntPtr handle) {
713 Console.WriteLine("ResetMouseHover({0}): Called", Window(handle));
715 driver.ResetMouseHover(handle);
718 internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
720 Console.WriteLine("ScreenToClient({0}, {1}, {2}): Called", Window(handle), x, y);
722 driver.ScreenToClient (handle, ref x, ref y);
725 internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
727 Console.WriteLine("ScreenToMenu({0}, {1}, {2}): Called", Window(handle), x, y);
729 driver.ScreenToMenu(handle, ref x, ref y);
732 internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
734 Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}, {4}): Called", Window(handle), rectangle, XAmount, YAmount, with_children);
736 driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
739 internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
741 Console.WriteLine("ScrollWindow({0}, {2}, {3}, {4}): Called", Window(handle), XAmount, YAmount, with_children);
743 driver.ScrollWindow(handle, XAmount, YAmount, with_children);
746 internal static void SendAsyncMethod (AsyncMethodData data) {
748 Console.WriteLine("SendAsyncMethod({0}): Called", data);
750 driver.SendAsyncMethod (data);
753 internal static int SendInput (IntPtr hwnd, Queue keys) {
755 Console.WriteLine("SendInput({0}): Called", charCode);
757 return driver.SendInput (hwnd, keys);
760 internal static IntPtr SendMessage (IntPtr handle, Msg message, IntPtr wParam, IntPtr lParam) {
762 Console.WriteLine("SendMessage ({0}, {1}, {2:X}, {3:X}): Called", Window(handle), message, wParam.ToInt32(), lParam.ToInt32());
764 return driver.SendMessage (handle, message, wParam, lParam);
767 internal static void SendMessage (ref Message m) {
769 Console.WriteLine("SendMessage ({0}): Called", m);
771 m.Result = driver.SendMessage(m.HWnd, (Msg)m.Msg, m.WParam, m.LParam);
774 internal static void SetAllowDrop (IntPtr handle, bool value)
777 Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
779 driver.SetAllowDrop (handle, value);
782 internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
784 Console.WriteLine("SetBorderStyle({0}, {1}): Called", Window(handle), border_style);
786 driver.SetBorderStyle(handle, border_style);
789 internal static void SetCaretPos(IntPtr handle, int x, int y) {
791 Console.WriteLine("SetCaretPos({0}, {1}, {2}): Called", Window(handle), x, y);
793 driver.SetCaretPos(handle, x, y);
796 internal static void SetClipRegion(IntPtr handle, Region region) {
798 Console.WriteLine("SetClipRegion({0}, {1}): Called", Window(handle), region);
800 driver.SetClipRegion(handle, region);
803 internal static void SetCursor(IntPtr handle, IntPtr cursor) {
805 Console.WriteLine("SetCursor({0}, {1:X}): Called", Window(handle), cursor.ToInt32());
807 driver.SetCursor(handle, cursor);
810 internal static void SetCursorPos(IntPtr handle, int x, int y) {
812 Console.WriteLine("SetCursorPos({0}, {1}, {2}): Called", Window(handle), x, y);
814 driver.SetCursorPos(handle, x, y);
817 internal static void SetFocus(IntPtr handle) {
819 Console.WriteLine("SetFocus({0}): Called", Window(handle));
821 driver.SetFocus(handle);
824 internal static void SetIcon(IntPtr handle, Icon icon) {
826 Console.WriteLine("SetIcon({0}, {1}): Called", Window(handle), icon);
828 driver.SetIcon(handle, icon);
831 internal static void SetMenu(IntPtr handle, Menu menu) {
833 Console.WriteLine("SetMenu({0}, {1}): Called", Window(handle), menu);
835 driver.SetMenu(handle, menu);
838 internal static void SetModal(IntPtr handle, bool Modal) {
839 #if DriverDebug || DriverDebugState
840 Console.WriteLine("SetModal({0}, {1}): Called", Window(handle), Modal);
842 driver.SetModal(handle, Modal);
845 internal static IntPtr SetParent(IntPtr handle, IntPtr hParent) {
847 Console.WriteLine("SetParent({0}, {1:X}): Called", Window(handle), Window(hParent));
849 return driver.SetParent(handle, hParent);
852 internal static void SetTimer (Timer timer)
855 Console.WriteLine("SetTimer({0}): Called", timer);
857 driver.SetTimer (timer);
860 internal static bool SetTopmost(IntPtr handle, IntPtr hWndOwner, bool Enabled) {
862 Console.WriteLine("SetTopMost({0}, {1}, {2}): Called", Window(handle), Window(hWndOwner), Enabled);
864 return driver.SetTopmost(handle, hWndOwner, Enabled);
867 internal static bool SetVisible (IntPtr handle, bool visible, bool activate)
869 #if DriverDebug || DriverDebugState
870 Console.WriteLine("SetVisible({0}, {1}, {2}): Called", Window(handle), visible, activate);
872 return driver.SetVisible (handle, visible, activate);
875 internal static void SetWindowMinMax(IntPtr handle, Rectangle maximized, Size min, Size max) {
876 #if DriverDebug || DriverDebugState
877 Console.WriteLine("SetWindowMinMax({0}, {1}, {2}, {3}): Called", Window(handle), maximized, min, max);
879 driver.SetWindowMinMax(handle, maximized, min, max);
882 internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
884 Console.WriteLine("SetWindowPos({0}, {1}, {2}, {3}, {4}): Called", Window(handle), x, y, width, height);
886 driver.SetWindowPos(handle, x, y, width, height);
889 internal static void SetWindowState(IntPtr handle, FormWindowState state) {
890 #if DriverDebug || DriverDebugState
891 Console.WriteLine("SetWindowState({0} {1}): Called", Window(handle), state);
893 driver.SetWindowState(handle, state);
896 internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
898 Console.WriteLine("SetWindowStyle({0}): Called", Window(handle));
900 driver.SetWindowStyle(handle, cp);
903 internal static double GetWindowTransparency (IntPtr handle)
906 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
908 return driver.GetWindowTransparency(handle);
911 internal static void SetWindowTransparency(IntPtr handle, double transparency, Color key)
914 Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
916 driver.SetWindowTransparency(handle, transparency, key);
919 internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
921 Console.WriteLine("SetZOrder({0}, {1:X}, {2}, {3}): Called", Window(handle), Window(AfterhWnd), Top, Bottom);
923 return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
926 internal static void ShowCursor(bool show) {
928 Console.WriteLine("ShowCursor({0}): Called", show);
930 driver.ShowCursor(show);
933 internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
935 Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", Window(handle), data, allowedEffects);
937 return driver.StartDrag (handle, data, allowedEffects);
940 internal static object StartLoop(Thread thread) {
942 Console.WriteLine("StartLoop({0:X}): Called", thread.GetHashCode());
944 return driver.StartLoop(thread);
947 internal static TransparencySupport SupportsTransparency() {
949 Console.WriteLine("SupportsTransparency(): Called, result={0}", driver.SupportsTransparency());
951 return driver.SupportsTransparency();
954 internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
956 Console.WriteLine("SystrayAdd({0}, {1}): Called", Window(handle), tip);
958 return driver.SystrayAdd(handle, tip, icon, out tt);
961 internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
963 Console.WriteLine("SystrayChange({0}, {1}): Called", Window(handle), tip);
965 driver.SystrayChange(handle, tip, icon, ref tt);
968 internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
970 Console.WriteLine("SystrayRemove({0}): Called", Window(handle));
972 driver.SystrayRemove(handle, ref tt);
975 internal static bool Text(IntPtr handle, string text) {
977 Console.WriteLine("Text({0}, {1}): Called", Window(handle), text);
979 return driver.Text(handle, text);
982 internal static bool TranslateMessage(ref MSG msg) {
983 return driver.TranslateMessage(ref msg);
986 internal static void UngrabWindow(IntPtr handle) {
988 Console.WriteLine("UngrabWindow({0}): Called", Window(handle));
990 driver.UngrabWindow(handle);
993 internal static void UpdateWindow(IntPtr handle) {
995 Console.WriteLine("UpdateWindow({0}): Called", Window(handle));
997 driver.UpdateWindow(handle);
1001 internal static void CreateOffscreenDrawable (IntPtr handle,
1002 int width, int height,
1003 out object offscreen_drawable)
1006 Console.WriteLine("CreateOffscreenDrawable({2}, {0},{1}): Called", width, height, Window(handle));
1008 driver.CreateOffscreenDrawable (handle, width, height,
1009 out offscreen_drawable);
1012 internal static void DestroyOffscreenDrawable (object offscreen_drawable)
1015 Console.WriteLine("DestroyOffscreenDrawable(): Called");
1017 driver.DestroyOffscreenDrawable (offscreen_drawable);
1020 internal static Graphics GetOffscreenGraphics (object offscreen_drawable)
1023 Console.WriteLine("GetOffscreenGraphics(): Called");
1025 return driver.GetOffscreenGraphics (offscreen_drawable);
1028 internal static void BlitFromOffscreen (IntPtr dest_handle,
1030 object offscreen_drawable,
1031 Graphics offscreen_dc,
1035 Console.WriteLine("BlitFromOffscreen({0}): Called", Window(dest_handle));
1037 driver.BlitFromOffscreen (dest_handle, dest_dc, offscreen_drawable, offscreen_dc, r);
1041 // Santa's little helper
1042 internal static void Version() {
1043 Console.WriteLine("Xplat version $Revision: $");
1045 #endregion // Public Static Methods
1048 public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
1049 public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
1050 #endregion // Delegates