2007-08-28 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / XplatUIDriver.cs
index 7e6323f02e0ec28799136aa9fd9abcfdfaa23cff..a766d76bbdbd1b6c6d38f3db5022125397d0a7f1 100644 (file)
@@ -38,6 +38,8 @@ namespace System.Windows.Forms {
 
 
                #region XplatUI Driver Properties
+               internal virtual int ActiveWindowTrackingDelay { get { return 0; } }
+
                internal virtual Color ForeColor {
                        get {
                                return ThemeEngine.Current.DefaultWindowForeColor;
@@ -50,12 +52,72 @@ namespace System.Windows.Forms {
                        }
                }
 
+               internal virtual Size Border3DSize {
+                       get {
+                               return new Size (2, 2);
+                       }
+               }
+
+               internal virtual Size BorderSize {
+                       get {
+                               return new Size (1, 1);
+                       }
+               }
+
+               internal virtual Size CaptionButtonSize {
+                       get {
+                               return new Size (18, 18);
+                       }
+               }
+
+               internal virtual int CaretBlinkTime { get { return 530; } }
+               internal virtual int CaretWidth { get { return 10; } }
+               
+               internal virtual Size DoubleClickSize {
+                       get {
+                               return new Size (4, 4);
+                       }
+               }
+
+               internal virtual int DoubleClickTime {
+                       get {
+                               return 500;
+                       }
+               }
+
+               internal virtual Size FixedFrameBorderSize {
+                       get {
+                               return new Size (3, 3);
+                       }
+               }
+
                internal virtual Font Font {
                        get {
                                return ThemeEngine.Current.DefaultFont;
                        }
                }
 
+               internal virtual int FontSmoothingContrast { get { return 1400; } }
+               internal virtual int FontSmoothingType { get { return 1; } }
+               internal virtual int HorizontalResizeBorderThickness { get { return 8; } }
+               internal virtual bool IsActiveWindowTrackingEnabled { get { return false; } }
+               internal virtual bool IsComboBoxAnimationEnabled { get { return false; } }
+               internal virtual bool IsDropShadowEnabled { get { return false; } }
+               internal virtual bool IsFontSmoothingEnabled { get { return true; } }
+               internal virtual bool IsHotTrackingEnabled { get { return false; } }
+               internal virtual bool IsIconTitleWrappingEnabled { get { return true; } }
+               internal virtual bool IsKeyboardPreferred { get { return false; } }
+               internal virtual bool IsListBoxSmoothScrollingEnabled { get { return true; } }
+               internal virtual bool IsMenuAnimationEnabled { get { return false; } }
+               internal virtual bool IsMenuFadeEnabled { get { return true; } }
+               internal virtual bool IsMinimizeRestoreAnimationEnabled { get { return false; } }
+               internal virtual bool IsSelectionFadeEnabled { get { return false; } }
+               internal virtual bool IsSnapToDefaultEnabled { get { return false; } }
+               internal virtual bool IsTitleBarGradientEnabled { get { return false; } }
+               internal virtual bool IsToolTipAnimationEnabled { get { return false; } }
+               internal virtual Size MenuBarButtonSize { get { return new Size (19, 19); } }
+               internal virtual int MenuShowDelay { get { return 0; } }
+               
                internal virtual Keys ModifierKeys {
                        get {
                                return Keys.None;
@@ -80,6 +142,16 @@ namespace System.Windows.Forms {
                        }
                }
 
+               internal virtual int MouseSpeed {
+                       get { return 10; }
+               }
+               
+               internal virtual int MouseWheelScrollDelta {
+                       get {
+                               return 120;
+                       }
+               }
+               
                internal virtual Point MousePosition {
                        get {
                                return Point.Empty;
@@ -92,6 +164,28 @@ namespace System.Windows.Forms {
                        }
                }
 
+               internal virtual LeftRightAlignment PopupMenuAlignment {
+                       get { return LeftRightAlignment.Left; }
+               }
+               
+#if NET_2_0
+               internal virtual PowerStatus PowerStatus {
+                       get { throw new NotImplementedException ("Has not been implemented yet for this platform."); }
+               }
+#endif
+
+               internal virtual int SizingBorderWidth {
+                       get { return 4; }
+               }
+               
+               internal virtual Size SmallCaptionButtonSize {
+                       get { return new Size (17, 17); }
+               }
+               
+               internal virtual bool UIEffectsEnabled {
+                       get { return false; }
+               }
+               
                internal virtual bool DropTarget {
                        get {
                                return false;
@@ -113,19 +207,22 @@ namespace System.Windows.Forms {
                        }
                }
 
+               internal virtual int VerticalResizeBorderThickness { get { return 8; } }
+
                internal virtual int VerticalScrollBarWidth {
                        get {
                                return 16;
                        }
                }
 
-               internal abstract int Caption { get; }
+               internal abstract int CaptionHeight { get; }
                internal abstract Size CursorSize { get; }
                internal abstract bool DragFullWindows { get; }
                internal abstract Size DragSize { get; }
                internal abstract Size FrameBorderSize { get; }
                internal abstract Size IconSize { get; }
                internal abstract Size MaxWindowTrackSize { get; }
+               internal abstract bool MenuAccessKeysUnderlined { get; }
                internal abstract Size MinimizedWindowSize { get; }
                internal abstract Size MinimizedWindowSpacingSize { get; }
                internal abstract Size MinimumWindowSize { get; }
@@ -140,7 +237,7 @@ namespace System.Windows.Forms {
 
                #endregion      // XplatUI Driver Properties
 
-                internal abstract event EventHandler Idle;
+               internal abstract event EventHandler Idle;
 
                #region XplatUI Driver Methods
                internal abstract void AudibleAlert();
@@ -159,8 +256,9 @@ namespace System.Windows.Forms {
 
                internal abstract void SetWindowStyle(IntPtr handle, CreateParams cp);
 
+               internal abstract double GetWindowTransparency(IntPtr handle);
                internal abstract void SetWindowTransparency(IntPtr handle, double transparency, Color key);
-               internal abstract bool SupportsTransparency();
+               internal abstract TransparencySupport SupportsTransparency();
 
                internal virtual void SetAllowDrop (IntPtr handle, bool value)
                {
@@ -179,15 +277,16 @@ namespace System.Windows.Forms {
 
                internal abstract bool GetText(IntPtr handle, out string text);
                internal abstract bool Text(IntPtr handle, string text);
-               internal abstract bool SetVisible(IntPtr handle, bool visible);
+               internal abstract bool SetVisible(IntPtr handle, bool visible, bool activate);
                internal abstract bool IsVisible(IntPtr handle);
                internal abstract bool IsEnabled(IntPtr handle);
+               internal virtual bool IsKeyLocked (VirtualKeys key) { return false; }
                internal abstract IntPtr SetParent(IntPtr handle, IntPtr parent);
                internal abstract IntPtr GetParent(IntPtr handle);
 
                internal abstract void UpdateWindow(IntPtr handle);
-               internal abstract PaintEventArgs PaintEventStart(IntPtr handle, bool client);
-               internal abstract void PaintEventEnd(IntPtr handle, bool client);
+               internal abstract PaintEventArgs PaintEventStart (ref Message msg, IntPtr handle, bool client);
+               internal abstract void PaintEventEnd (ref Message msg, IntPtr handle, bool client);
 
                internal abstract void SetWindowPos(IntPtr handle, int x, int y, int width, int height);
                internal abstract 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);
@@ -195,6 +294,7 @@ namespace System.Windows.Forms {
                internal abstract void EnableWindow(IntPtr handle, bool Enable);
                internal abstract void SetModal(IntPtr handle, bool Modal);
                internal abstract void Invalidate(IntPtr handle, Rectangle rc, bool clear);
+               internal abstract void InvalidateNC(IntPtr handle);
                internal abstract IntPtr DefWndProc(ref Message msg);
                internal abstract void HandleException(Exception e);
                internal abstract void DoEvents();
@@ -205,9 +305,10 @@ namespace System.Windows.Forms {
                internal abstract IntPtr DispatchMessage(ref MSG msg);
 
                internal abstract bool SetZOrder(IntPtr hWnd, IntPtr AfterhWnd, bool Top, bool Bottom);
-               internal abstract bool SetTopmost(IntPtr hWnd, IntPtr hWndOwner, bool Enabled);
+               internal abstract bool SetTopmost(IntPtr hWnd, bool Enabled);
+               internal abstract bool SetOwner(IntPtr hWnd, IntPtr hWndOwner);
 
-               internal abstract bool CalculateWindowRect(ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect);
+               internal abstract bool CalculateWindowRect(ref Rectangle ClientRect, CreateParams cp, Menu menu, out Rectangle WindowRect);
 
                internal abstract Region GetClipRegion(IntPtr hwnd);
                internal abstract void SetClipRegion(IntPtr hwnd, Region region);
@@ -217,6 +318,7 @@ namespace System.Windows.Forms {
                internal abstract void OverrideCursor(IntPtr cursor);
                internal abstract IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot);
                internal abstract IntPtr DefineStdCursor(StdCursor id);
+               internal abstract Bitmap DefineStdCursorBitmap(StdCursor id);
                internal abstract void DestroyCursor(IntPtr cursor);
                internal abstract void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y);
 
@@ -251,6 +353,9 @@ namespace System.Windows.Forms {
                internal abstract bool SystrayAdd(IntPtr hwnd, string tip, Icon icon, out ToolTip tt);
                internal abstract bool SystrayChange(IntPtr hwnd, string tip, Icon icon, ref ToolTip tt);
                internal abstract void SystrayRemove(IntPtr hwnd, ref ToolTip tt);
+#if NET_2_0            
+               internal abstract void SystrayBalloon(IntPtr hwnd, int timeout, string title, string text, ToolTipIcon icon);
+#endif
 
                internal abstract Point GetMenuOrigin(IntPtr hwnd);
                internal abstract void MenuToScreen(IntPtr hwnd, ref int x, ref int y);
@@ -265,23 +370,63 @@ namespace System.Windows.Forms {
                internal abstract int[] ClipboardAvailableFormats(IntPtr handle);
                internal abstract object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter);
 
+               internal abstract void DrawReversibleLine(Point start, Point end, Color backColor);
                internal abstract void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width);
+               internal abstract void FillReversibleRectangle (Rectangle rectangle, Color backColor);
+               internal abstract void DrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style);
 
                internal abstract SizeF GetAutoScaleSize(Font font);
 
                internal abstract IntPtr SendMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam);
                internal abstract bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam);
+               internal abstract int SendInput(IntPtr hwnd, System.Collections.Queue keys);
 
                internal abstract object StartLoop(Thread thread);
                internal abstract void EndLoop(Thread thread);
 
                internal abstract void RequestNCRecalc(IntPtr hwnd);
                internal abstract void ResetMouseHover(IntPtr hwnd);
+               internal abstract void RequestAdditionalWM_NCMessages(IntPtr hwnd, bool hover, bool leave);
 
+               internal abstract void RaiseIdle (EventArgs e);
+               
                // System information
                internal abstract int KeyboardSpeed { get; } 
                internal abstract int KeyboardDelay { get; } 
 
+
+               // Double buffering
+               internal virtual void CreateOffscreenDrawable (IntPtr handle,
+                                                              int width, int height,
+                                                              out object offscreen_drawable)
+               {
+                       Bitmap bmp = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+
+                       offscreen_drawable = bmp;
+               }
+
+               internal virtual void DestroyOffscreenDrawable (object offscreen_drawable)
+               {
+                       Bitmap bmp = (Bitmap)offscreen_drawable;
+
+                       bmp.Dispose ();
+               }
+               
+               internal virtual Graphics GetOffscreenGraphics (object offscreen_drawable)
+               {
+                       Bitmap bmp = (Bitmap)offscreen_drawable;
+                       return Graphics.FromImage (bmp);
+               }
+
+               internal virtual void BlitFromOffscreen (IntPtr dest_handle,
+                                                        Graphics dest_dc,
+                                                        object offscreen_drawable,
+                                                        Graphics offscreen_dc,
+                                                        Rectangle r)
+               {
+                       dest_dc.DrawImage ((Bitmap)offscreen_drawable, r, r, GraphicsUnit.Pixel);
+               }
+
 #endregion     // XplatUI Driver Methods
        }