Merge pull request #268 from pcc/menudeactivate
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / XplatUIStructs.cs
index c4701a0ab2479727fb98cdc459f6cd277a4bf002..21b2515477c0e817cb78b1ab59dc70c5f2119416 100644 (file)
@@ -22,7 +22,7 @@
 // Authors:
 //     Peter Bartok    pbartok@novell.com
 //
-
+// *** When you make some changes to this file, dont forget to update Tests/TestHelper class ***
 
 // NOT COMPLETE
 
@@ -30,9 +30,19 @@ using System;
 using System.Drawing;
 using System.Runtime.InteropServices;
 
-namespace System.Windows.Forms {
+#if PUBLIC_TYPES
+namespace Mono.Winforms 
+#else
+namespace System.Windows.Forms
+#endif
+{
        [Flags]
-       internal enum WindowStyles : int {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum WindowStyles : int {
                WS_OVERLAPPED           = 0x00000000,
                WS_POPUP                = unchecked((int)0x80000000),
                WS_CHILD                = 0x40000000,
@@ -42,7 +52,7 @@ namespace System.Windows.Forms {
                WS_CLIPSIBLINGS         = 0x04000000,
                WS_CLIPCHILDREN         = 0x02000000,
                WS_MAXIMIZE             = 0x01000000,
-               WS_CAPTION              = 0x00C00000,
+               WS_CAPTION              = 0x00C00000, // == WS_BORDER | WS_DLGFRAME
                WS_BORDER               = 0x00800000,
                WS_DLGFRAME             = 0x00400000,
                WS_VSCROLL              = 0x00200000,
@@ -63,7 +73,12 @@ namespace System.Windows.Forms {
        }
 
        [Flags]
-       internal enum WindowExStyles : int {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum WindowExStyles : int {
                // Extended Styles
                WS_EX_DLGMODALFRAME     = 0x00000001,
                WS_EX_DRAGDETECT        = 0x00000002,
@@ -98,7 +113,25 @@ namespace System.Windows.Forms {
                WS_EX_PALETTEWINDOW     = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST
        }
 
-       internal enum Msg {
+       [Flags]
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum ToolBarStyles : int {
+               TBSTYLE_TOOLTIPS    = 0x100,
+               TBSTYLE_FLAT        = 0x800,
+               TBSTYLE_LIST        = 0x1000,
+               TBSTYLE_TRANSPARENT = 0x8000
+       }
+
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum Msg {
                WM_NULL                   = 0x0000,
                WM_CREATE                 = 0x0001,
                WM_DESTROY                = 0x0002,
@@ -234,9 +267,10 @@ namespace System.Windows.Forms {
                WM_MENUGETOBJECT          = 0x0124,
                WM_UNINITMENUPOPUP        = 0x0125,
                WM_MENUCOMMAND            = 0x0126,
-               //              public const uint WM_CHANGEUISTATE    = 0x0127;
-               //              public const uint WM_UPDATEUISTATE    = 0x0128;
-               //              public const uint WM_QUERYUISTATE     = 0x0129;
+               
+               WM_CHANGEUISTATE          = 0x0127,
+               WM_UPDATEUISTATE          = 0x0128,
+               WM_QUERYUISTATE           = 0x0129,
 
                //              public const uint WM_LBTRACKPOINT     = 0x0131;
                WM_CTLCOLORMSGBOX         = 0x0132,
@@ -338,69 +372,29 @@ namespace System.Windows.Forms {
 
                // Our "private" ones
                WM_MOUSE_ENTER            = 0x0401,
-               WM_MOUSE_LEAVE            = 0x0402,
                WM_ASYNC_MESSAGE          = 0x0403,
                WM_REFLECT                = WM_USER + 0x1c00,
-               WM_CLOSE_INTERNAL         = WM_USER + 0x1c01
-       }
+               WM_CLOSE_INTERNAL         = WM_USER + 0x1c01,
 
-#if notdef
-       internal enum Msg {
-               WM_NULL                 = 0x0000,
-               WM_CREATE               = 0x0001,
-               WM_DESTROY              = 0x0002,
-               WM_MOVE                 = 0x0003,
-               WM_SIZE                 = 0x0005,
-               WM_ACTIVATE             = 0x0006,
-               WM_SETFOCUS             = 0x0007,
-               WM_KILLFOCUS            = 0x0008,
-               WM_SETVISIBLE           = 0x0009,
-               WM_ENABLE               = 0x000A,
-               // ...
-               WM_PAINT                = 0x000F,
-               WM_CLOSE                = 0x0010,
-               WM_QUERYENDSESSION      = 0x0011,
-               WM_QUIT                 = 0x0012,
-               WM_QUERYOPEN            = 0x0013,
-               WM_ERASEBKGND           = 0x0014,
-               WM_SYSCOLORCHANGE       = 0x0015,
-
-               // ...
-               WM_WINDOWPOSCHANGED     = 0x0046,
-
-               // ...
-               WM_KEYFIRST             = 0x0100,
-               WM_KEYDOWN              = 0x0100,
-               WM_KEYUP                = 0x0101,
-               WM_CHAR                 = 0x0102,
-               WM_DEADCHAR             = 0x0103,
-               WM_SYSKEYDOWN           = 0x0104,
-               WM_SYSKEYUP             = 0x0105,
-               WM_SYS1CHAR             = 0x0106,
-               WM_SYSDEADCHAR          = 0x0107,
-               WM_KEYLAST              = 0x0108,
-
-               // ...
-               WM_MOUSEFIRST           = 0x0200,
-               WM_MOUSEMOVE            = 0x0200,
-               WM_LBUTTONDOWN          = 0x0201,
-               WM_LBUTTONUP            = 0x0202,
-               WM_LBUTTONDBLCLK        = 0x0203,
-               WM_RBUTTONDOWN          = 0x0204,
-               WM_RBUTTONUP            = 0x0205,
-               WM_RBUTTONDBLCLK        = 0x0206,
-               WM_MBUTTONDOWN          = 0x0207,
-               WM_MBUTTONUP            = 0x0208,
-               WM_MBUTTONDBLCLK        = 0x0209,
-               WM_MOUSEWHEEL           = 0x020A,
-               WM_MOUSELAST            = 0x020D,
-               // ...
-               WM_MOUSEHOVER           = 0x02A1,
-               WM_MOUSELEAVE           = 0x02A3,
+               // private messages to support on-the-spot IME editing.
+               WM_XIM_PREEDITSTART               = WM_USER + 0x1d00,
+               WM_XIM_PREEDITDONE                = WM_USER + 0x1d01,
+               WM_XIM_PREEDITDRAW                = WM_USER + 0x1d02,
+               WM_XIM_PREEDITCARET               = WM_USER + 0x1d03,
+
+               // NotifyIcon (Systray) Balloon messages 
+               NIN_BALLOONSHOW           = WM_USER + 0x0002,
+               NIN_BALLOONHIDE           = WM_USER + 0x0003,
+               NIN_BALLOONTIMEOUT        = WM_USER + 0x0004,
+               NIN_BALLOONUSERCLICK      = WM_USER + 0x0005 
        }
-#endif
 
-       internal enum MsgButtons {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum MsgButtons {
                MK_LBUTTON              = 0x0001,
                MK_RBUTTON              = 0x0002,
                MK_SHIFT                = 0x0004,
@@ -410,14 +404,54 @@ namespace System.Windows.Forms {
                MK_XBUTTON2             = 0x0040,
        }
 
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum MsgUIState {
+               UIS_SET        = 1,
+               UIS_CLEAR      = 2,
+               UIS_INITIALIZE = 3,
+               UISF_HIDEFOCUS = 0x1,
+               UISF_HIDEACCEL = 0x2,
+               UISF_ACTIVE    = 0x4
+       }
+
        [StructLayout(LayoutKind.Sequential)]
-       internal struct POINT {
-               internal int x;
-               internal int y;
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       struct POINT {
+               public int x;
+               public int y;
+
+               public POINT (int x, int y)
+               {
+                       this.x = x;
+                       this.y = y;
+               }
+
+               public Point ToPoint ()
+               {
+                       return new Point (x, y);
+               }
+
+               public override string ToString ()
+               {
+                       return "Point {" + x.ToString () + ", " + y.ToString () + "}";
+               }
        }
        
        [StructLayout(LayoutKind.Sequential)] 
-       internal struct MSG {
+#if PUBLIC_TYPES
+        public
+#else
+       internal
+#endif
+       struct MSG {
                internal IntPtr hwnd;
                internal Msg    message;
                internal IntPtr wParam; 
@@ -425,21 +459,54 @@ namespace System.Windows.Forms {
                internal uint   time;  
                internal POINT  pt;
                internal object refobject;
+
+               public override string ToString ()
+               {
+                       return String.Format ("msg=0x{0:x} ({1}) hwnd=0x{2:x} wparam=0x{3:x} lparam=0x{4:x} pt={5}", (int) message, message.ToString (), hwnd.ToInt32 (), wParam.ToInt32 (), lParam.ToInt32 (), pt);
+               }
+       }
+
+       [Flags]
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum TransparencySupport {
+               None = 0x00,
+               Get = 0x01,
+               Set = 0x02,
+               GetSet = 0x03
        }
 
-       internal enum WindowActiveFlags {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum WindowActiveFlags {
                WA_INACTIVE             = 0,
                WA_ACTIVE               = 1,
                WA_CLICKACTIVE          = 2
        }
 
-       internal enum KeybdEventFlags {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum KeybdEventFlags {
                None                    = 0,
                ExtendedKey             = 0x0001,
                KeyUp                   = 0x0002
        }
 
-       internal enum VirtualKeys {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum VirtualKeys {
                VK_LBUTTON              = 0x01,
                VK_RBUTTON              = 0x02,
                VK_CANCEL               = 0x03,
@@ -456,6 +523,8 @@ namespace System.Windows.Forms {
                VK_PAUSE                = 0x13,
                VK_CAPITAL              = 0x14,
                VK_ESCAPE               = 0x1B,
+               VK_CONVERT              = 0x1C,
+               VK_NONCONVERT   = 0x1D,
                VK_SPACE                = 0x20,
                VK_PRIOR                = 0x21,
                VK_NEXT                 = 0x22,
@@ -576,6 +645,11 @@ namespace System.Windows.Forms {
                VK_ICO_HELP             = 0xE3,
                VK_ICO_00               = 0xE4,
                VK_PROCESSKEY           = 0xE5,
+               VK_OEM_ATTN             = 0xF0,
+               VK_OEM_COPY             = 0xF2,
+               VK_OEM_AUTO             = 0xF3,
+               VK_OEM_ENLW             = 0xF4,
+               VK_OEM_BACKTAB          = 0xF5,
                VK_ATTN                 = 0xF6,
                VK_CRSEL                = 0xF7,
                VK_EXSEL                = 0xF8,
@@ -587,7 +661,12 @@ namespace System.Windows.Forms {
                VK_OEM_CLEAR            = 0xFE,
        }
 
-       internal enum TtyKeys {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum TtyKeys {
                XK_BackSpace            = 0xff08,  /* Back space, back char */
                XK_Tab                  = 0xff09,
                XK_Linefeed             = 0xff0a,  /* Linefeed, LF */
@@ -600,7 +679,12 @@ namespace System.Windows.Forms {
                XK_Delete               = 0xffff  /* Delete, rubout */
        }
 
-       internal enum MiscKeys {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum MiscKeys {
                XK_ISO_Lock             = 0xfe01,
                XK_ISO_Last_Group_Lock  = 0xfe0f,
                XK_Select               = 0xff60,
@@ -619,7 +703,12 @@ namespace System.Windows.Forms {
                XK_Num_Lock             = 0xff7f
        }
 
-       internal enum KeypadKeys {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum KeypadKeys {
                XK_KP_Space             = 0xff80,
                XK_KP_Tab               = 0xff89,
                XK_KP_Enter             = 0xff8d,  /* Enter */
@@ -660,7 +749,12 @@ namespace System.Windows.Forms {
                XK_KP_9                 = 0xffb9
        }
 
-        internal enum DeadKeys {
+#if PUBLIC_TYPES
+       public
+#else
+        internal
+#endif
+       enum DeadKeys {
                 XK_dead_grave           = 0xfe50,
                 XK_dead_acute           = 0xfe51,
                 XK_dead_circumflex      = 0xfe52,
@@ -684,7 +778,12 @@ namespace System.Windows.Forms {
         }
 
        [StructLayout(LayoutKind.Sequential)]
-       internal struct HELPINFO {
+#if PUBLIC_TYPES
+        public
+#else
+       internal
+#endif
+       struct HELPINFO {
                internal uint           cbSize;
                internal int            iContextType;
                internal int            iCtrlId;
@@ -693,13 +792,23 @@ namespace System.Windows.Forms {
                internal POINT          MousePos;
        }
 
-       internal enum PeekMessageFlags {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum PeekMessageFlags {
                PM_NOREMOVE                     = 0x00000000,
                PM_REMOVE                       = 0x00000001,
                PM_NOYIELD                      = 0x00000002
        }
 
-       internal enum StdCursor {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum StdCursor {
                Default                         = 0,
                AppStarting                     = 1,
                Arrow                           = 2,
@@ -730,7 +839,12 @@ namespace System.Windows.Forms {
                WaitCursor                      = 27
        }
 
-       internal enum HitTest {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum HitTest {
                HTERROR                         = -2,
                HTTRANSPARENT                   = -1,
                HTNOWHERE                       = 0,
@@ -762,14 +876,24 @@ namespace System.Windows.Forms {
                HTHELP                          = 21
        }
 
-       internal enum TitleStyle {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum TitleStyle {
                None                            = 0,
                Normal                          = 1,
                Tool                            = 2
        }
 
        [StructLayout(LayoutKind.Sequential)]
-       internal struct BITMAPINFOHEADER {
+#if PUBLIC_TYPES
+        public
+#else
+       internal
+#endif
+       struct BITMAPINFOHEADER {
                internal uint     biSize;
                internal int      biWidth;
                internal int      biHeight;
@@ -783,7 +907,12 @@ namespace System.Windows.Forms {
                internal uint     biClrImportant;
        }
 
-       internal enum ClipboardFormats : ushort {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum ClipboardFormats : ushort {
                CF_TEXT                         = 1,
                CF_BITMAP                       = 2,
                CF_METAFILEPICT                 = 3,
@@ -804,7 +933,12 @@ namespace System.Windows.Forms {
        }
 
        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
-       internal struct MINMAXINFO {
+#if PUBLIC_TYPES
+        public
+#else
+       internal
+#endif
+       struct MINMAXINFO {
                internal POINT                  ptReserved;
                internal POINT                  ptMaxSize;
                internal POINT                  ptMaxPosition;
@@ -812,7 +946,26 @@ namespace System.Windows.Forms {
                internal POINT                  ptMaxTrackSize;
        }
 
-       internal enum ScrollBarCommands {
+       [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+#if PUBLIC_TYPES
+        public
+#else
+       internal
+#endif
+       struct KeyFilterData {
+                       internal bool Down;
+                       internal int keycode;
+                       internal int keysym;
+                       internal Keys ModifierKeys;
+                       internal String str;
+               }
+
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum ScrollBarCommands {
                SB_LINEUP               = 0,
                SB_LINELEFT             = 0,
                SB_LINEDOWN             = 1,
@@ -830,7 +983,12 @@ namespace System.Windows.Forms {
                SB_ENDSCROLL            = 8
        }
 
-       internal enum ClipCombineMode {
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum ClipCombineMode {
                RGN_AND = 1,
                RGN_OR,
                RGN_XOR,
@@ -840,5 +998,45 @@ namespace System.Windows.Forms {
                RGN_MIN = RGN_AND,
                RGN_MAX = RGN_COPY
        }
+
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum SystemCommands {
+               SC_SIZE         = 0xF000,
+               SC_MOVE         = 0xF010,
+               SC_MINIMIZE     = 0xF020,
+               SC_MAXIMIZE     = 0xF030,
+               SC_NEXTWINDOW   = 0xF040,
+               SC_PREVWINDOW   = 0xF050,
+               SC_CLOSE        = 0xF060,
+               SC_VSCROLL      = 0xF070,
+               SC_HSCROLL      = 0xF080,
+               SC_MOUSEMENU    = 0xF090,
+               SC_KEYMENU      = 0xF100,
+               SC_ARRANGE      = 0xF110,
+               SC_RESTORE      = 0xF120,
+               SC_TASKLIST     = 0xF130,
+               SC_SCREENSAVE   = 0xF140,
+               SC_HOTKEY       = 0xF150,
+               SC_DEFAULT      = 0xF160,
+               SC_MONITORPOWER = 0xF170,
+               SC_CONTEXTHELP  = 0xF180
+       }
+
+#if PUBLIC_TYPES
+       public
+#else
+       internal
+#endif
+       enum AlertType {
+               Default         = 1,
+               Error           = 2,
+               Question        = 3,
+               Warning         = 4,
+               Information     = 5
+       }
 }