X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FManaged.Windows.Forms%2FSystem.Windows.Forms%2FXplatUI.cs;h=903f7d9a21be41dc1d88ac3070442b895d43b661;hb=c39145af2464b19374fac41b252e07480ae1a197;hp=2d427de123b2f9b3dbc96083eb4d2191723c6b57;hpb=cb5d22f5c3b06eb13fb8f17f6cde8e06f61226e0;p=mono.git diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs index 2d427de123b..903f7d9a21b 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs @@ -21,74 +21,7 @@ // // Authors: // Peter Bartok pbartok@novell.com -// -// -// $Revision: 1.19 $ -// $Modtime: $ -// $Log: XplatUI.cs,v $ -// Revision 1.19 2004/08/23 19:39:30 pbartok -// - Added method to move mouse cursor -// -// Revision 1.18 2004/08/21 20:51:27 pbartok -// - Added method to get default display size -// -// Revision 1.17 2004/08/21 20:23:56 pbartok -// - Added method to query current grab state -// - Added argument to allow confining a grab to a window -// -// Revision 1.16 2004/08/20 20:03:20 pbartok -// - Added method for setting the window background -// -// Revision 1.15 2004/08/20 19:14:35 jackson -// Expose functionality to send async messages through the driver -// -// Revision 1.14 2004/08/13 21:42:15 pbartok -// - Changed signature for GetCursorPos -// -// Revision 1.13 2004/08/13 19:00:15 jordi -// implements PointToClient (ScreenToClient) -// -// Revision 1.12 2004/08/13 18:53:14 pbartok -// - Changed GetWindowPos to also provide client area size -// -// Revision 1.11 2004/08/12 22:59:03 pbartok -// - Implemented method to get current mouse position -// -// Revision 1.10 2004/08/11 22:20:59 pbartok -// - Signature fixes -// -// Revision 1.9 2004/08/11 19:19:44 pbartok -// - We had SetWindowPos and MoveWindow to set window positions and size, -// removed MoveWindow. We have GetWindowPos, so it made sense to keep -// SetWindowPos as matching counterpart -// - Added some X11 sanity checking -// -// Revision 1.8 2004/08/11 18:55:46 pbartok -// - Added method to calculate difference between decorated window and raw -// client area -// -// Revision 1.7 2004/08/10 17:39:22 pbartok -// - Added GetWindowPos method -// -// Revision 1.6 2004/08/09 20:55:59 pbartok -// - Removed Run method, was only required for initial development -// -// Revision 1.5 2004/08/09 20:51:25 pbartok -// - Implemented GrabWindow/ReleaseWindow methods to allow pointer capture -// -// Revision 1.4 2004/08/09 17:02:29 jackson -// Get default window properties from the theme -// -// Revision 1.3 2004/08/09 15:56:44 jackson -// Remove defaults, these are handled by the theme now. -// -// Revision 1.2 2004/08/04 20:11:24 pbartok -// - Added Invalidate handling -// -// Revision 1.1 2004/07/09 05:21:25 pbartok -// - Initial check-in -// -// + // NOT COMPLETE @@ -99,19 +32,6 @@ using System.Collections; using System.Diagnostics; using System.Runtime.InteropServices; -// -// Random architecture notes -// We need -// * windows -// - create -// - set location/size -// - define cursor -// - destroy -// - reparent? -// - show/hide -// * Keyboard -// * Mouse -// /// X11 Version namespace System.Windows.Forms { @@ -151,6 +71,7 @@ namespace System.Windows.Forms { driver.DropTarget=value; } } + } #endregion // Subclasses @@ -160,7 +81,10 @@ namespace System.Windows.Forms { default_class_name="SWFClass"; if (Environment.OSVersion.Platform == (PlatformID)128) { - driver=XplatUIX11.GetInstance(); + if (Environment.GetEnvironmentVariable ("MONO_MWF_USE_QUARTZ_BACKEND") != null) + driver=XplatUIOSX.GetInstance(); + else + driver=XplatUIX11.GetInstance(); } else { driver=XplatUIWin32.GetInstance(); } @@ -183,8 +107,107 @@ namespace System.Windows.Forms { default_class_name=value; } } + + static public Size CursorSize { + get { + return driver.CursorSize; + } + } + + static public bool DragFullWindows { + get { + return driver.DragFullWindows; + } + } + + static public Size DragSize { + get { + return driver.DragSize; + } + } + + static public Size IconSize { + get { + return driver.IconSize; + } + } + + static public Size MaxWindowTrackSize { + get { + return driver.MaxWindowTrackSize; + } + } + + static public Size MinimizedWindowSize { + get { + return driver.MinimizedWindowSize; + } + } + + static public Size MinimizedWindowSpacingSize { + get { + return driver.MinimizedWindowSpacingSize; + } + } + + static public Size MinimumWindowSize { + get { + return driver.MinimumWindowSize; + } + } + + static public Size MinWindowTrackSize { + get { + return driver.MinWindowTrackSize; + } + } + + static public Size SmallIconSize { + get { + return driver.SmallIconSize; + } + } + + static public int MouseButtonCount { + get { + return driver.MouseButtonCount; + } + } + + static public bool MouseButtonsSwapped { + get { + return driver.MouseButtonsSwapped; + } + } + + static public bool MouseWheelPresent { + get { + return driver.MouseWheelPresent; + } + } + + static public Rectangle VirtualScreen { + get { + return driver.VirtualScreen; + } + } + + static public Rectangle WorkingArea { + get { + return driver.WorkingArea; + } + } #endregion // Public Static Properties + internal static event EventHandler Idle { + add { + driver.Idle += value; + } + remove { + driver.Idle -= value; + } + } + #region Public Static Methods internal static void Exit() { driver.Exit(); @@ -202,6 +225,10 @@ namespace System.Windows.Forms { return driver.Text(hWnd, text); } + internal static bool GetText(IntPtr hWnd, out string text) { + return driver.GetText(hWnd, out text); + } + internal static bool SetVisible(IntPtr hWnd, bool visible) { return driver.SetVisible(hWnd, visible); } @@ -234,8 +261,20 @@ namespace System.Windows.Forms { driver.DestroyWindow(handle); } - internal static void RefreshWindow(IntPtr handle) { - driver.RefreshWindow(handle); + internal static FormWindowState GetWindowState(IntPtr handle) { + return driver.GetWindowState(handle); + } + + internal static void SetWindowState(IntPtr handle, FormWindowState state) { + driver.SetWindowState(handle, state); + } + + internal static void SetWindowStyle(IntPtr handle, CreateParams cp) { + driver.SetWindowStyle(handle, cp); + } + + internal static void UpdateWindow(IntPtr handle) { + driver.UpdateWindow(handle); } internal static void SetWindowBackground(IntPtr handle, Color color) { @@ -254,8 +293,8 @@ namespace System.Windows.Forms { driver.SetWindowPos(handle, x, y, width, height); } - internal static void GetWindowPos(IntPtr handle, out int x, out int y, out int width, out int height, out int client_width, out int client_height) { - driver.GetWindowPos(handle, out x, out y, out width, out height, out client_width, out client_height); + 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) { + driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height); } internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) { @@ -266,6 +305,14 @@ namespace System.Windows.Forms { driver.Activate(handle); } + internal static void EnableWindow(IntPtr handle, bool Enable) { + driver.EnableWindow(handle, Enable); + } + + internal static void SetModal(IntPtr handle, bool Modal) { + driver.SetModal(handle, Modal); + } + internal static IntPtr DefWndProc(ref Message msg) { return driver.DefWndProc(ref msg); } @@ -290,7 +337,7 @@ namespace System.Windows.Forms { return driver.TranslateMessage(ref msg); } - internal static bool DispatchMessage(ref MSG msg) { + internal static IntPtr DispatchMessage(ref MSG msg) { return driver.DispatchMessage(ref msg); } @@ -306,10 +353,46 @@ namespace System.Windows.Forms { driver.ReleaseWindow(hWnd); } + internal static bool SetZOrder(IntPtr hWnd, IntPtr AfterhWnd, bool Top, bool Bottom) { + return driver.SetZOrder(hWnd, AfterhWnd, Top, Bottom); + } + + internal static bool SetTopmost(IntPtr hWnd, IntPtr hWndOwner, bool Enabled) { + return driver.SetTopmost(hWnd, hWndOwner, Enabled); + } + internal static bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, bool HasMenu, out Rectangle WindowRect) { return driver.CalculateWindowRect(hWnd, ref ClientRect, Style, HasMenu, out WindowRect); } + internal static void SetCursor(IntPtr hwnd, IntPtr cursor) { + driver.SetCursor(hwnd, cursor); + } + + internal static void ShowCursor(bool show) { + driver.ShowCursor(show); + } + + internal static void OverrideCursor(IntPtr cursor) { + driver.OverrideCursor(cursor); + } + + internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) { + return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot); + } + + internal static IntPtr DefineStdCursor(StdCursor id) { + return driver.DefineStdCursor(id); + } + + internal static void DestroyCursor(IntPtr cursor) { + driver.DestroyCursor(cursor); + } + + internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) { + driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y); + } + internal static void SetCursorPos(IntPtr handle, int x, int y) { driver.SetCursorPos(handle, x, y); } @@ -322,10 +405,85 @@ namespace System.Windows.Forms { driver.ScreenToClient (handle, ref x, ref y); } + internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) { + driver.ClientToScreen(handle, ref x, ref y); + } + internal static void SendAsyncMethod (AsyncMethodData data) { driver.SendAsyncMethod (data); } + internal static void CreateCaret(IntPtr hwnd, int width, int height) { + driver.CreateCaret(hwnd, width, height); + } + + internal static void DestroyCaret(IntPtr hwnd) { + driver.DestroyCaret(hwnd); + } + + internal static void SetCaretPos(IntPtr hwnd, int x, int y) { + driver.SetCaretPos(hwnd, x, y); + } + + internal static void CaretVisible(IntPtr hwnd, bool visible) { + driver.CaretVisible(hwnd, visible); + } + + internal static void SetFocus(IntPtr hwnd) { + driver.SetFocus(hwnd); + } + + internal static IntPtr GetActive() { + return driver.GetActive(); + } + + internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) { + return driver.GetFontMetrics(g, font, out ascent, out descent); + } + + internal static void SetTimer (Timer timer) + { + driver.SetTimer (timer); + } + + internal static void KillTimer (Timer timer) + { + driver.KillTimer (timer); + } + + internal static int KeyboardSpeed { + get { + return driver.KeyboardSpeed; + } + } + + internal static int KeyboardDelay { + get { + return driver.KeyboardSpeed; + } + } + + internal static void ScrollWindow(IntPtr hwnd, Rectangle rectangle, int XAmount, int YAmount, bool clear) { + driver.ScrollWindow(hwnd, rectangle, XAmount, YAmount, clear); + } + + internal static void ScrollWindow(IntPtr hwnd, int XAmount, int YAmount, bool clear) { + driver.ScrollWindow(hwnd, XAmount, YAmount, clear); + } + + internal static bool SystrayAdd(IntPtr hwnd, string tip, Icon icon, out ToolTip tt) { + return driver.SystrayAdd(hwnd, tip, icon, out tt); + } + + internal static void SystrayChange(IntPtr hwnd, string tip, Icon icon, ref ToolTip tt) { + driver.SystrayChange(hwnd, tip, icon, ref tt); + } + + internal static void SystrayRemove(IntPtr hwnd, ref ToolTip tt) { + driver.SystrayRemove(hwnd, ref tt); + } + + // Santa's little helper internal static void Where() { Console.WriteLine("Here: {0}", new StackTrace().ToString());