mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-29 03:49:19 +01:00
IME implementation
This commit is contained in:
parent
ee44e6885a
commit
3e3757d30c
10 changed files with 1131 additions and 2 deletions
|
|
@ -48,6 +48,92 @@ namespace Dalamud
|
|||
TimerNoFG = 12,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IDC_* from winuser.
|
||||
/// </summary>
|
||||
public enum CursorType
|
||||
{
|
||||
/// <summary>
|
||||
/// Standard arrow and small hourglass.
|
||||
/// </summary>
|
||||
AppStarting = 32650,
|
||||
|
||||
/// <summary>
|
||||
/// Standard arrow.
|
||||
/// </summary>
|
||||
Arrow = 32512,
|
||||
|
||||
/// <summary>
|
||||
/// Crosshair.
|
||||
/// </summary>
|
||||
Cross = 32515,
|
||||
|
||||
/// <summary>
|
||||
/// Hand.
|
||||
/// </summary>
|
||||
Hand = 32649,
|
||||
|
||||
/// <summary>
|
||||
/// Arrow and question mark.
|
||||
/// </summary>
|
||||
Help = 32651,
|
||||
|
||||
/// <summary>
|
||||
/// I-beam.
|
||||
/// </summary>
|
||||
IBeam = 32513,
|
||||
|
||||
/// <summary>
|
||||
/// Obsolete for applications marked version 4.0 or later.
|
||||
/// </summary>
|
||||
Icon = 32641,
|
||||
|
||||
/// <summary>
|
||||
/// Slashed circle.
|
||||
/// </summary>
|
||||
No = 32648,
|
||||
|
||||
/// <summary>
|
||||
/// Obsolete for applications marked version 4.0 or later.Use IDC_SIZEALL.
|
||||
/// </summary>
|
||||
Size = 32640,
|
||||
|
||||
/// <summary>
|
||||
/// Four-pointed arrow pointing north, south, east, and west.
|
||||
/// </summary>
|
||||
SizeAll = 32646,
|
||||
|
||||
/// <summary>
|
||||
/// Double-pointed arrow pointing northeast and southwest.
|
||||
/// </summary>
|
||||
SizeNeSw = 32643,
|
||||
|
||||
/// <summary>
|
||||
/// Double-pointed arrow pointing north and south.
|
||||
/// </summary>
|
||||
SizeNS = 32645,
|
||||
|
||||
/// <summary>
|
||||
/// Double-pointed arrow pointing northwest and southeast.
|
||||
/// </summary>
|
||||
SizeNwSe = 32642,
|
||||
|
||||
/// <summary>
|
||||
/// Double-pointed arrow pointing west and east.
|
||||
/// </summary>
|
||||
SizeWE = 32644,
|
||||
|
||||
/// <summary>
|
||||
/// Vertical arrow.
|
||||
/// </summary>
|
||||
UpArrow = 32516,
|
||||
|
||||
/// <summary>
|
||||
/// Hourglass.
|
||||
/// </summary>
|
||||
Wait = 32514,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MB_* from winuser.
|
||||
/// </summary>
|
||||
|
|
@ -235,6 +321,329 @@ namespace Dalamud
|
|||
ServiceNotification = 0x200000,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GWL_* from winuser.
|
||||
/// </summary>
|
||||
public enum WindowLongType
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets a new extended window style.
|
||||
/// </summary>
|
||||
ExStyle = -20,
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new application instance handle.
|
||||
/// </summary>
|
||||
HInstance = -6,
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new identifier of the child window.The window cannot be a top-level window.
|
||||
/// </summary>
|
||||
Id = -12,
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new window style.
|
||||
/// </summary>
|
||||
Style = -16,
|
||||
|
||||
/// <summary>
|
||||
/// Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
|
||||
/// </summary>
|
||||
UserData = -21,
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new address for the window procedure.
|
||||
/// </summary>
|
||||
WndProc = -4,
|
||||
|
||||
// The following values are also available when the hWnd parameter identifies a dialog box.
|
||||
|
||||
// /// <summary>
|
||||
// /// Sets the new pointer to the dialog box procedure.
|
||||
// /// </summary>
|
||||
// DWLP_DLGPROC = DWLP_MSGRESULT + sizeof(LRESULT),
|
||||
|
||||
/// <summary>
|
||||
/// Sets the return value of a message processed in the dialog box procedure.
|
||||
/// </summary>
|
||||
MsgResult = 0,
|
||||
|
||||
// /// <summary>
|
||||
// /// Sets new extra information that is private to the application, such as handles or pointers.
|
||||
// /// </summary>
|
||||
// DWLP_USER = DWLP_DLGPROC + sizeof(DLGPROC),
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WM_* from winuser.
|
||||
/// These are spread throughout multiple files, find the documentation manually if you need it.
|
||||
/// https://gist.github.com/amgine/2395987.
|
||||
/// </summary>
|
||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "No documentation available.")]
|
||||
public enum WindowsMessage
|
||||
{
|
||||
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_ENABLE = 0x000A,
|
||||
WM_SETREDRAW = 0x000B,
|
||||
WM_SETTEXT = 0x000C,
|
||||
WM_GETTEXT = 0x000D,
|
||||
WM_GETTEXTLENGTH = 0x000E,
|
||||
WM_PAINT = 0x000F,
|
||||
WM_CLOSE = 0x0010,
|
||||
WM_QUERYENDSESSION = 0x0011,
|
||||
WM_QUERYOPEN = 0x0013,
|
||||
WM_ENDSESSION = 0x0016,
|
||||
WM_QUIT = 0x0012,
|
||||
WM_ERASEBKGND = 0x0014,
|
||||
WM_SYSCOLORCHANGE = 0x0015,
|
||||
WM_SHOWWINDOW = 0x0018,
|
||||
WM_WININICHANGE = 0x001A,
|
||||
WM_SETTINGCHANGE = WM_WININICHANGE,
|
||||
WM_DEVMODECHANGE = 0x001B,
|
||||
WM_ACTIVATEAPP = 0x001C,
|
||||
WM_FONTCHANGE = 0x001D,
|
||||
WM_TIMECHANGE = 0x001E,
|
||||
WM_CANCELMODE = 0x001F,
|
||||
WM_SETCURSOR = 0x0020,
|
||||
WM_MOUSEACTIVATE = 0x0021,
|
||||
WM_CHILDACTIVATE = 0x0022,
|
||||
WM_QUEUESYNC = 0x0023,
|
||||
WM_GETMINMAXINFO = 0x0024,
|
||||
WM_PAINTICON = 0x0026,
|
||||
WM_ICONERASEBKGND = 0x0027,
|
||||
WM_NEXTDLGCTL = 0x0028,
|
||||
WM_SPOOLERSTATUS = 0x002A,
|
||||
WM_DRAWITEM = 0x002B,
|
||||
WM_MEASUREITEM = 0x002C,
|
||||
WM_DELETEITEM = 0x002D,
|
||||
WM_VKEYTOITEM = 0x002E,
|
||||
WM_CHARTOITEM = 0x002F,
|
||||
WM_SETFONT = 0x0030,
|
||||
WM_GETFONT = 0x0031,
|
||||
WM_SETHOTKEY = 0x0032,
|
||||
WM_GETHOTKEY = 0x0033,
|
||||
WM_QUERYDRAGICON = 0x0037,
|
||||
WM_COMPAREITEM = 0x0039,
|
||||
WM_GETOBJECT = 0x003D,
|
||||
WM_COMPACTING = 0x0041,
|
||||
WM_COMMNOTIFY = 0x0044,
|
||||
WM_WINDOWPOSCHANGING = 0x0046,
|
||||
WM_WINDOWPOSCHANGED = 0x0047,
|
||||
WM_POWER = 0x0048,
|
||||
WM_COPYDATA = 0x004A,
|
||||
WM_CANCELJOURNAL = 0x004B,
|
||||
WM_NOTIFY = 0x004E,
|
||||
WM_INPUTLANGCHANGEREQUEST = 0x0050,
|
||||
WM_INPUTLANGCHANGE = 0x0051,
|
||||
WM_TCARD = 0x0052,
|
||||
WM_HELP = 0x0053,
|
||||
WM_USERCHANGED = 0x0054,
|
||||
WM_NOTIFYFORMAT = 0x0055,
|
||||
WM_CONTEXTMENU = 0x007B,
|
||||
WM_STYLECHANGING = 0x007C,
|
||||
WM_STYLECHANGED = 0x007D,
|
||||
WM_DISPLAYCHANGE = 0x007E,
|
||||
WM_GETICON = 0x007F,
|
||||
WM_SETICON = 0x0080,
|
||||
WM_NCCREATE = 0x0081,
|
||||
WM_NCDESTROY = 0x0082,
|
||||
WM_NCCALCSIZE = 0x0083,
|
||||
WM_NCHITTEST = 0x0084,
|
||||
WM_NCPAINT = 0x0085,
|
||||
WM_NCACTIVATE = 0x0086,
|
||||
WM_GETDLGCODE = 0x0087,
|
||||
WM_SYNCPAINT = 0x0088,
|
||||
|
||||
WM_NCMOUSEMOVE = 0x00A0,
|
||||
WM_NCLBUTTONDOWN = 0x00A1,
|
||||
WM_NCLBUTTONUP = 0x00A2,
|
||||
WM_NCLBUTTONDBLCLK = 0x00A3,
|
||||
WM_NCRBUTTONDOWN = 0x00A4,
|
||||
WM_NCRBUTTONUP = 0x00A5,
|
||||
WM_NCRBUTTONDBLCLK = 0x00A6,
|
||||
WM_NCMBUTTONDOWN = 0x00A7,
|
||||
WM_NCMBUTTONUP = 0x00A8,
|
||||
WM_NCMBUTTONDBLCLK = 0x00A9,
|
||||
WM_NCXBUTTONDOWN = 0x00AB,
|
||||
WM_NCXBUTTONUP = 0x00AC,
|
||||
WM_NCXBUTTONDBLCLK = 0x00AD,
|
||||
|
||||
WM_INPUT_DEVICE_CHANGE = 0x00FE,
|
||||
WM_INPUT = 0x00FF,
|
||||
|
||||
WM_KEYFIRST = WM_KEYDOWN,
|
||||
WM_KEYDOWN = 0x0100,
|
||||
WM_KEYUP = 0x0101,
|
||||
WM_CHAR = 0x0102,
|
||||
WM_DEADCHAR = 0x0103,
|
||||
WM_SYSKEYDOWN = 0x0104,
|
||||
WM_SYSKEYUP = 0x0105,
|
||||
WM_SYSCHAR = 0x0106,
|
||||
WM_SYSDEADCHAR = 0x0107,
|
||||
WM_UNICHAR = 0x0109,
|
||||
WM_KEYLAST = WM_UNICHAR,
|
||||
|
||||
WM_IME_STARTCOMPOSITION = 0x010D,
|
||||
WM_IME_ENDCOMPOSITION = 0x010E,
|
||||
WM_IME_COMPOSITION = 0x010F,
|
||||
WM_IME_KEYLAST = WM_IME_COMPOSITION,
|
||||
|
||||
WM_INITDIALOG = 0x0110,
|
||||
WM_COMMAND = 0x0111,
|
||||
WM_SYSCOMMAND = 0x0112,
|
||||
WM_TIMER = 0x0113,
|
||||
WM_HSCROLL = 0x0114,
|
||||
WM_VSCROLL = 0x0115,
|
||||
WM_INITMENU = 0x0116,
|
||||
WM_INITMENUPOPUP = 0x0117,
|
||||
WM_MENUSELECT = 0x011F,
|
||||
WM_MENUCHAR = 0x0120,
|
||||
WM_ENTERIDLE = 0x0121,
|
||||
WM_MENURBUTTONUP = 0x0122,
|
||||
WM_MENUDRAG = 0x0123,
|
||||
WM_MENUGETOBJECT = 0x0124,
|
||||
WM_UNINITMENUPOPUP = 0x0125,
|
||||
WM_MENUCOMMAND = 0x0126,
|
||||
|
||||
WM_CHANGEUISTATE = 0x0127,
|
||||
WM_UPDATEUISTATE = 0x0128,
|
||||
WM_QUERYUISTATE = 0x0129,
|
||||
|
||||
WM_CTLCOLORMSGBOX = 0x0132,
|
||||
WM_CTLCOLOREDIT = 0x0133,
|
||||
WM_CTLCOLORLISTBOX = 0x0134,
|
||||
WM_CTLCOLORBTN = 0x0135,
|
||||
WM_CTLCOLORDLG = 0x0136,
|
||||
WM_CTLCOLORSCROLLBAR = 0x0137,
|
||||
WM_CTLCOLORSTATIC = 0x0138,
|
||||
MN_GETHMENU = 0x01E1,
|
||||
|
||||
WM_MOUSEFIRST = WM_MOUSEMOVE,
|
||||
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_XBUTTONDOWN = 0x020B,
|
||||
WM_XBUTTONUP = 0x020C,
|
||||
WM_XBUTTONDBLCLK = 0x020D,
|
||||
WM_MOUSEHWHEEL = 0x020E,
|
||||
|
||||
WM_PARENTNOTIFY = 0x0210,
|
||||
WM_ENTERMENULOOP = 0x0211,
|
||||
WM_EXITMENULOOP = 0x0212,
|
||||
|
||||
WM_NEXTMENU = 0x0213,
|
||||
WM_SIZING = 0x0214,
|
||||
WM_CAPTURECHANGED = 0x0215,
|
||||
WM_MOVING = 0x0216,
|
||||
|
||||
WM_POWERBROADCAST = 0x0218,
|
||||
|
||||
WM_DEVICECHANGE = 0x0219,
|
||||
|
||||
WM_MDICREATE = 0x0220,
|
||||
WM_MDIDESTROY = 0x0221,
|
||||
WM_MDIACTIVATE = 0x0222,
|
||||
WM_MDIRESTORE = 0x0223,
|
||||
WM_MDINEXT = 0x0224,
|
||||
WM_MDIMAXIMIZE = 0x0225,
|
||||
WM_MDITILE = 0x0226,
|
||||
WM_MDICASCADE = 0x0227,
|
||||
WM_MDIICONARRANGE = 0x0228,
|
||||
WM_MDIGETACTIVE = 0x0229,
|
||||
|
||||
WM_MDISETMENU = 0x0230,
|
||||
WM_ENTERSIZEMOVE = 0x0231,
|
||||
WM_EXITSIZEMOVE = 0x0232,
|
||||
WM_DROPFILES = 0x0233,
|
||||
WM_MDIREFRESHMENU = 0x0234,
|
||||
|
||||
WM_IME_SETCONTEXT = 0x0281,
|
||||
WM_IME_NOTIFY = 0x0282,
|
||||
WM_IME_CONTROL = 0x0283,
|
||||
WM_IME_COMPOSITIONFULL = 0x0284,
|
||||
WM_IME_SELECT = 0x0285,
|
||||
WM_IME_CHAR = 0x0286,
|
||||
WM_IME_REQUEST = 0x0288,
|
||||
WM_IME_KEYDOWN = 0x0290,
|
||||
WM_IME_KEYUP = 0x0291,
|
||||
|
||||
WM_MOUSEHOVER = 0x02A1,
|
||||
WM_MOUSELEAVE = 0x02A3,
|
||||
WM_NCMOUSEHOVER = 0x02A0,
|
||||
WM_NCMOUSELEAVE = 0x02A2,
|
||||
|
||||
WM_WTSSESSION_CHANGE = 0x02B1,
|
||||
|
||||
WM_TABLET_FIRST = 0x02c0,
|
||||
WM_TABLET_LAST = 0x02df,
|
||||
|
||||
WM_CUT = 0x0300,
|
||||
WM_COPY = 0x0301,
|
||||
WM_PASTE = 0x0302,
|
||||
WM_CLEAR = 0x0303,
|
||||
WM_UNDO = 0x0304,
|
||||
WM_RENDERFORMAT = 0x0305,
|
||||
WM_RENDERALLFORMATS = 0x0306,
|
||||
WM_DESTROYCLIPBOARD = 0x0307,
|
||||
WM_DRAWCLIPBOARD = 0x0308,
|
||||
WM_PAINTCLIPBOARD = 0x0309,
|
||||
WM_VSCROLLCLIPBOARD = 0x030A,
|
||||
WM_SIZECLIPBOARD = 0x030B,
|
||||
WM_ASKCBFORMATNAME = 0x030C,
|
||||
WM_CHANGECBCHAIN = 0x030D,
|
||||
WM_HSCROLLCLIPBOARD = 0x030E,
|
||||
WM_QUERYNEWPALETTE = 0x030F,
|
||||
WM_PALETTEISCHANGING = 0x0310,
|
||||
WM_PALETTECHANGED = 0x0311,
|
||||
WM_HOTKEY = 0x0312,
|
||||
|
||||
WM_PRINT = 0x0317,
|
||||
WM_PRINTCLIENT = 0x0318,
|
||||
|
||||
WM_APPCOMMAND = 0x0319,
|
||||
|
||||
WM_THEMECHANGED = 0x031A,
|
||||
|
||||
WM_CLIPBOARDUPDATE = 0x031D,
|
||||
|
||||
WM_DWMCOMPOSITIONCHANGED = 0x031E,
|
||||
WM_DWMNCRENDERINGCHANGED = 0x031F,
|
||||
WM_DWMCOLORIZATIONCOLORCHANGED = 0x0320,
|
||||
WM_DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
|
||||
|
||||
WM_GETTITLEBARINFOEX = 0x033F,
|
||||
|
||||
WM_HANDHELDFIRST = 0x0358,
|
||||
WM_HANDHELDLAST = 0x035F,
|
||||
|
||||
WM_AFXFIRST = 0x0360,
|
||||
WM_AFXLAST = 0x037F,
|
||||
|
||||
WM_PENWINFIRST = 0x0380,
|
||||
WM_PENWINLAST = 0x038F,
|
||||
|
||||
WM_APP = 0x8000,
|
||||
|
||||
WM_USER = 0x0400,
|
||||
|
||||
WM_REFLECT = WM_USER + 0x1C00,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the current application has focus, false otherwise.
|
||||
/// </summary>
|
||||
|
|
@ -254,6 +663,38 @@ namespace Dalamud
|
|||
return activeProcId == Environment.ProcessId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Passes message information to the specified window procedure.
|
||||
/// </summary>
|
||||
/// <param name="lpPrevWndFunc">
|
||||
/// The previous window procedure. If this value is obtained by calling the GetWindowLong function with the nIndex parameter set to
|
||||
/// GWL_WNDPROC or DWL_DLGPROC, it is actually either the address of a window or dialog box procedure, or a special internal value
|
||||
/// meaningful only to CallWindowProc.
|
||||
/// </param>
|
||||
/// <param name="hWnd">
|
||||
/// A handle to the window procedure to receive the message.
|
||||
/// </param>
|
||||
/// <param name="msg">
|
||||
/// The message.
|
||||
/// </param>
|
||||
/// <param name="wParam">
|
||||
/// Additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.
|
||||
/// </param>
|
||||
/// <param name="lParam">
|
||||
/// More additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Use the CallWindowProc function for window subclassing. Usually, all windows with the same class share one window procedure. A
|
||||
/// subclass is a window or set of windows with the same class whose messages are intercepted and processed by another window procedure
|
||||
/// (or procedures) before being passed to the window procedure of the class.
|
||||
/// The SetWindowLong function creates the subclass by changing the window procedure associated with a particular window, causing the
|
||||
/// system to call the new window procedure instead of the previous one.An application must pass any messages not processed by the new
|
||||
/// window procedure to the previous window procedure by calling CallWindowProc.This allows the application to create a chain of window
|
||||
/// procedures.
|
||||
/// </returns>
|
||||
[DllImport("user32.dll")]
|
||||
public static extern long CallWindowProcW(IntPtr lpPrevWndFunc, IntPtr hWnd, uint msg, ulong wParam, long lParam);
|
||||
|
||||
/// <summary>
|
||||
/// See https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindowex.
|
||||
/// Flashes the specified window. It does not change the active state of the window.
|
||||
|
|
@ -326,6 +767,31 @@ namespace Dalamud
|
|||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
public static extern int MessageBoxW(IntPtr hWnd, string text, string caption, MessageBoxType type);
|
||||
|
||||
/// <summary>
|
||||
/// Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.
|
||||
/// </summary>
|
||||
/// <param name="hWnd">
|
||||
/// A handle to the window and, indirectly, the class to which the window belongs. The SetWindowLongPtr function fails if the
|
||||
/// process that owns the window specified by the hWnd parameter is at a higher process privilege in the UIPI hierarchy than the
|
||||
/// process the calling thread resides in.
|
||||
/// </param>
|
||||
/// <param name="nIndex">
|
||||
/// The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window
|
||||
/// memory, minus the size of a LONG_PTR. To set any other value, specify one of the values.
|
||||
/// </param>
|
||||
/// <param name="dwNewLong">
|
||||
/// The replacement value.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// If the function succeeds, the return value is the previous value of the specified offset. If the function fails, the return
|
||||
/// value is zero.To get extended error information, call GetLastError. If the previous value is zero and the function succeeds,
|
||||
/// the return value is zero, but the function does not clear the last error information. To determine success or failure, clear
|
||||
/// the last error information by calling SetLastError with 0, then call SetWindowLongPtr.Function failure will be indicated by
|
||||
/// a return value of zero and a GetLastError result that is nonzero.
|
||||
/// </returns>
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern IntPtr SetWindowLongPtrW(IntPtr hWnd, WindowLongType nIndex, IntPtr dwNewLong);
|
||||
|
||||
/// <summary>
|
||||
/// See https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-flashwinfo.
|
||||
/// Contains the flash status for a window and the number of times the system should flash the window.
|
||||
|
|
@ -361,6 +827,308 @@ namespace Dalamud
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Native imm32 functions.
|
||||
/// </summary>
|
||||
internal static partial class NativeFunctions
|
||||
{
|
||||
/// <summary>
|
||||
/// GCS_* from imm32.
|
||||
/// These values are used with ImmGetCompositionString and WM_IME_COMPOSITION.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum IMEComposition
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve or update the attribute of the composition string.
|
||||
/// </summary>
|
||||
CompAttr = 0x0010,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update clause information of the composition string.
|
||||
/// </summary>
|
||||
CompClause = 0x0020,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the attributes of the reading string of the current composition.
|
||||
/// </summary>
|
||||
CompReadAttr = 0x0002,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the clause information of the reading string of the composition string.
|
||||
/// </summary>
|
||||
CompReadClause = 0x0004,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the reading string of the current composition.
|
||||
/// </summary>
|
||||
CompReadStr = 0x0001,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the current composition string.
|
||||
/// </summary>
|
||||
CompStr = 0x0008,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the cursor position in composition string.
|
||||
/// </summary>
|
||||
CursorPos = 0x0080,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the starting position of any changes in composition string.
|
||||
/// </summary>
|
||||
DeltaStart = 0x0100,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update clause information of the result string.
|
||||
/// </summary>
|
||||
ResultClause = 0x1000,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update clause information of the reading string.
|
||||
/// </summary>
|
||||
ResultReadClause = 0x0400,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the reading string.
|
||||
/// </summary>
|
||||
ResultReadStr = 0x0200,
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve or update the string of the composition result.
|
||||
/// </summary>
|
||||
ResultStr = 0x0800,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IMN_* from imm32.
|
||||
/// Input Method Manager Commands, this enum is not exhaustive.
|
||||
/// </summary>
|
||||
public enum IMECommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Notifies the application when an IME is about to change the content of the candidate window.
|
||||
/// </summary>
|
||||
ChangeCandidate = 0x0003,
|
||||
|
||||
/// <summary>
|
||||
/// Notifies an application when an IME is about to close the candidates window.
|
||||
/// </summary>
|
||||
CloseCandidate = 0x0004,
|
||||
|
||||
/// <summary>
|
||||
/// Notifies an application when an IME is about to open the candidate window.
|
||||
/// </summary>
|
||||
OpenCandidate = 0x0005,
|
||||
|
||||
/// <summary>
|
||||
/// Notifies an application when the conversion mode of the input context is updated.
|
||||
/// </summary>
|
||||
SetConversionMode = 0x0006,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the input context associated with the specified window.
|
||||
/// </summary>
|
||||
/// <param name="hWnd">Unnamed parameter 1.</param>
|
||||
/// <returns>
|
||||
/// Returns the handle to the input context.
|
||||
/// </returns>
|
||||
[DllImport("imm32.dll")]
|
||||
public static extern IntPtr ImmGetContext(IntPtr hWnd);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves information about the composition string.
|
||||
/// </summary>
|
||||
/// <param name="hImc">
|
||||
/// Unnamed parameter 1.
|
||||
/// </param>
|
||||
/// <param name="arg2">
|
||||
/// Unnamed parameter 2.
|
||||
/// </param>
|
||||
/// <param name="lpBuf">
|
||||
/// Pointer to a buffer in which the function retrieves the composition string information.
|
||||
/// </param>
|
||||
/// <param name="dwBufLen">
|
||||
/// Size, in bytes, of the output buffer, even if the output is a Unicode string. The application sets this parameter to 0
|
||||
/// if the function is to return the size of the required output buffer.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Returns the number of bytes copied to the output buffer. If dwBufLen is set to 0, the function returns the buffer size,
|
||||
/// in bytes, required to receive all requested information, excluding the terminating null character. The return value is
|
||||
/// always the size, in bytes, even if the requested data is a Unicode string.
|
||||
/// This function returns one of the following negative error codes if it does not succeed:
|
||||
/// - IMM_ERROR_NODATA.Composition data is not ready in the input context.
|
||||
/// - IMM_ERROR_GENERAL.General error detected by IME.
|
||||
/// </returns>
|
||||
[DllImport("imm32.dll")]
|
||||
public static extern long ImmGetCompositionStringW(IntPtr hImc, IMEComposition arg2, IntPtr lpBuf, uint dwBufLen);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a candidate list.
|
||||
/// </summary>
|
||||
/// <param name="hImc">
|
||||
/// Unnamed parameter 1.
|
||||
/// </param>
|
||||
/// <param name="deIndex">
|
||||
/// Zero-based index of the candidate list.
|
||||
/// </param>
|
||||
/// <param name="lpCandList">
|
||||
/// Pointer to a CANDIDATELIST structure in which the function retrieves the candidate list.
|
||||
/// </param>
|
||||
/// <param name="dwBufLen">
|
||||
/// Size, in bytes, of the buffer to receive the candidate list. The application can specify 0 for this parameter if the
|
||||
/// function is to return the required size of the output buffer only.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Returns the number of bytes copied to the candidate list buffer if successful. If the application has supplied 0 for
|
||||
/// the dwBufLen parameter, the function returns the size required for the candidate list buffer. The function returns 0
|
||||
/// if it does not succeed.
|
||||
/// </returns>
|
||||
[DllImport("imm32.dll")]
|
||||
public static extern long ImmGetCandidateListW(IntPtr hImc, uint deIndex, IntPtr lpCandList, uint dwBufLen);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the position of the composition window.
|
||||
/// </summary>
|
||||
/// <param name="hImc">
|
||||
/// Unnamed parameter 1.
|
||||
/// </param>
|
||||
/// <param name="frm">
|
||||
/// Pointer to a COMPOSITIONFORM structure that contains the new position and other related information about
|
||||
/// the composition window.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Returns a nonzero value if successful, or 0 otherwise.
|
||||
/// </returns>
|
||||
[DllImport("imm32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern bool ImmSetCompositionWindow(IntPtr hImc, ref CompositionForm frm);
|
||||
|
||||
/// <summary>
|
||||
/// Releases the input context and unlocks the memory associated in the input context. An application must call this
|
||||
/// function for each call to the ImmGetContext function.
|
||||
/// </summary>
|
||||
/// <param name="hwnd">
|
||||
/// Unnamed parameter 1.
|
||||
/// </param>
|
||||
/// <param name="hImc">
|
||||
/// Unnamed parameter 2.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Returns a nonzero value if successful, or 0 otherwise.
|
||||
/// </returns>
|
||||
[DllImport("imm32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern bool ImmReleaseContext(IntPtr hwnd, IntPtr hImc);
|
||||
|
||||
/// <summary>
|
||||
/// Contains information about a candidate list.
|
||||
/// </summary>
|
||||
public struct CandidateList
|
||||
{
|
||||
/// <summary>
|
||||
/// Size, in bytes, of the structure, the offset array, and all candidate strings.
|
||||
/// </summary>
|
||||
public int Size;
|
||||
|
||||
/// <summary>
|
||||
/// Candidate style values. This member can have one or more of the IME_CAND_* values.
|
||||
/// </summary>
|
||||
public int Style;
|
||||
|
||||
/// <summary>
|
||||
/// Number of candidate strings.
|
||||
/// </summary>
|
||||
public int Count;
|
||||
|
||||
/// <summary>
|
||||
/// Index of the selected candidate string.
|
||||
/// </summary>
|
||||
public int Selection;
|
||||
|
||||
/// <summary>
|
||||
/// Index of the first candidate string in the candidate window. This varies as the user presses the PAGE UP and PAGE DOWN keys.
|
||||
/// </summary>
|
||||
public int PageStart;
|
||||
|
||||
/// <summary>
|
||||
/// Number of candidate strings to be shown in one page in the candidate window. The user can move to the next page by pressing IME-defined keys, such as the PAGE UP or PAGE DOWN key. If this number is 0, an application can define a proper value by itself.
|
||||
/// </summary>
|
||||
public int PageSize;
|
||||
|
||||
// /// <summary>
|
||||
// /// Offset to the start of the first candidate string, relative to the start of this structure. The offsets
|
||||
// /// for subsequent strings immediately follow this member, forming an array of 32-bit offsets.
|
||||
// /// </summary>
|
||||
// public IntPtr Offset; // manually handle
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains style and position information for a composition window.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct CompositionForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Position style. This member can be one of the CFS_* values.
|
||||
/// </summary>
|
||||
public int Style;
|
||||
|
||||
/// <summary>
|
||||
/// A POINT structure containing the coordinates of the upper left corner of the composition window.
|
||||
/// </summary>
|
||||
public Point CurrentPos;
|
||||
|
||||
/// <summary>
|
||||
/// A RECT structure containing the coordinates of the upper left and lower right corners of the composition window.
|
||||
/// </summary>
|
||||
public Rect Area;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains coordinates for a point.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Point
|
||||
{
|
||||
/// <summary>
|
||||
/// The X position.
|
||||
/// </summary>
|
||||
public int X;
|
||||
|
||||
/// <summary>
|
||||
/// The Y position.
|
||||
/// </summary>
|
||||
public int Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains dimensions for a rectangle.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rect
|
||||
{
|
||||
/// <summary>
|
||||
/// The left position.
|
||||
/// </summary>
|
||||
public int Left;
|
||||
|
||||
/// <summary>
|
||||
/// The top position.
|
||||
/// </summary>
|
||||
public int Top;
|
||||
|
||||
/// <summary>
|
||||
/// The right position.
|
||||
/// </summary>
|
||||
public int Right;
|
||||
|
||||
/// <summary>
|
||||
/// The bottom position.
|
||||
/// </summary>
|
||||
public int Bottom;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Native kernel32 functions.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue