using System;
using System.Runtime.InteropServices;
using LPARAM = System.IntPtr;
using WPARAM = System.IntPtr;
namespace Vanara.PInvoke
{
public static partial class MSCTF
{
/// Specifies how the system language bar item should display the icon.
[PInvokeData("ctfutb.h")]
public enum TF_DTLBI : uint
{
/// The system language bar item should display a default icon for the item.
TF_DTLBI_NONE = 0,
/// The system language bar item should display the icon specified for the language profile.
TF_DTLBI_USEPROFILEICON = 0x00000001,
}
///
/// The TF_LBI_* constants are used with the ITfLangBarItemSink::OnUpdate method to indicate which language bar items changed.
///
// https://docs.microsoft.com/en-us/windows/win32/tsf/tf-lbi--constants
[PInvokeData("ctfutb.h")]
[Flags]
public enum TF_LBI : uint
{
/// The icon of the item has changed. The language bar calls ITfLangBarItemButton::GetIcon in response to this notification.
TF_LBI_ICON = 0x00000001,
///
/// The text of a button or bitmap button item has changed. The language bar calls ITfLangBarItemButton::GetText or
/// ITfLangBarItemBitmapButton::GetText, whichever is appropriate, in response to this notification.
///
TF_LBI_TEXT = 0x00000002,
///
/// The tooltip text of the item changed. The language bar calls ITfLangBarItem::GetTooltipString in response to this notification.
///
TF_LBI_TOOLTIP = 0x00000004,
///
/// The bitmap of a bitmap or bitmap button item changed. The language bar calls ITfLangBarItemBitmap::DrawBitmap or
/// ITfLangBarItemBitmapButton::DrawBitmap, whichever is appropriate, in response to this notification.
///
TF_LBI_BITMAP = 0x00000008,
///
/// The information for a balloon item changed. The language bar calls ITfLangBarItemBalloon::GetBalloonInfo in response to this notification.
///
TF_LBI_BALLOON = 0x00000010,
/// The item status changed. The language bar calls ITfLangBarItem::GetStatus in response to this notification.
TF_LBI_STATUS = 0x00010000,
/// Combines TF_LBI_BITMAP and TF_LBI_TOOLTIP.
TF_LBI_BMPALL = TF_LBI_BITMAP | TF_LBI_TOOLTIP,
/// Combines TF_LBI_BITMAP, TF_LBI_TEXT and TF_LBI_TOOLTIP.
TF_LBI_BMPBTNALL = TF_LBI_BITMAP | TF_LBI_TEXT | TF_LBI_TOOLTIP,
/// Combines TF_LBI_ICON, TF_LBI_TEXT and TF_LBI_TOOLTIP.
TF_LBI_BTNALL = TF_LBI_ICON | TF_LBI_TEXT | TF_LBI_TOOLTIP,
}
///
///
/// The TF_LBI_STATUS_* constants indicate the status of a language bar item. These values are used with the
/// ITfLangBarItem::GetStatus method.
///
///
///
/// Constant/value
/// Description
///
/// -
/// TF_LBI_STATUS_HIDDEN 0x00000001
/// The item is hidden. This style is ignored if the item does not include the TF_LBI_STYLE_HIDDENSTATUSCONTROL style.
///
/// -
/// TF_LBI_STATUS_DISABLED 0x00000002
/// The item is disabled.
///
/// -
/// TF_LBI_STATUS_BTN_TOGGLED 0x00010000
///
/// The item is in the toggled or pressed state. This style is ignored if the item does not include the TF_LBI_STYLE_BTN_TOGGLE style.
///
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/tsf/tf-lbi-status--constants
[PInvokeData("ctfutb.h")]
[Flags]
public enum TF_LBI_STATUS : uint
{
///
/// The item is hidden. This style is ignored if the item does not include the TF_LBI_STYLE_HIDDENSTATUSCONTROL style.
///
TF_LBI_STATUS_HIDDEN = 0x00000001,
/// The item is disabled.
TF_LBI_STATUS_DISABLED = 0x00000002,
///
/// The item is in the toggled or pressed state. This style is ignored if the item does not include the TF_LBI_STYLE_BTN_TOGGLE style.
///
TF_LBI_STATUS_BTN_TOGGLED = 0x00010000,
}
///
///
/// The TF_LBI_STYLE_* constants are used in the dwStyle member of the TF_LANGBARITEMINFO structure to specify the
/// style of a language bar item.
///
///
/// If this style is combined with TF_LBI_STYLE_BTN_BUTTON, a drop-down arrow will be displayed for the item in addition to the
/// text. The drop-down arrow functions as the menu button and clicking it will cause ITfLangBarItemButton::InitMenu to be
/// called. Clicking the text portion of the button will cause ITfLangBarItemButton::OnClick to be called.
///
///
// https://docs.microsoft.com/en-us/windows/win32/tsf/tf-lbi-style--constants
[PInvokeData("ctfutb.h")]
[Flags]
public enum TF_LBI_STYLE
{
///
/// The item can be hidden or shown dynamically using the TF_LBI_STATUS_HIDDEN value in the ITfLangBarItem::GetStatus method. If
/// this value is not present, the item cannot be hidden in this manner.
///
TF_LBI_STYLE_HIDDENSTATUSCONTROL = 0x00000001,
///
/// The item will be displayed in the notification icon tray in addition to the language bar. This flag is not currently supported.
///
TF_LBI_STYLE_SHOWNINTRAY = 0x00000002,
///
/// The language bar is hidden if all items in the language bar contain this style. If any item in the language bar does not
/// contain this style, the language bar is displayed.
///
TF_LBI_STYLE_HIDEONNOOTHERITEMS = 0x00000004,
///
/// The item will only be displayed in the notification icon tray and not in the language bar. This flag is not currently supported.
///
TF_LBI_STYLE_SHOWNINTRAYONLY = 0x00000008,
///
/// The item is not displayed in the toolbar until it is selected from the language bar options menu. This flag is ignored if
/// the TF_LBI_STYLE_HIDDENSTATUSCONTROL is set or the user has already changed the hidden/shown state using the language bar
/// options menu.
///
TF_LBI_STYLE_HIDDENBYDEFAULT = 0x00000010,
///
/// Any black pixel within the icon will be converted to the text color of the selected theme. The icon must be monochrome.
///
TF_LBI_STYLE_TEXTCOLORICON = 0x00000020,
/// The item is a push button. ITfLangBarItemButton::OnClick is called when the item is pressed.
TF_LBI_STYLE_BTN_BUTTON = 0x00010000,
///
/// The item is a menu. ITfLangBarItemButton::InitMenu is called when the item is pressed.
///
/// If this style is combined with TF_LBI_STYLE_BTN_BUTTON, a drop-down arrow will be displayed for the item in addition to the
/// text. The drop-down arrow functions as the menu button and clicking it will cause ITfLangBarItemButton::InitMenu to be
/// called. Clicking the text portion of the button will cause ITfLangBarItemButton::OnClick to be called.
///
///
TF_LBI_STYLE_BTN_MENU = 0x00020000,
///
/// The item is a toggle button and operates similar to a check box. ITfLangBarItemButton::OnClick is called when the item is pressed.
///
TF_LBI_STYLE_BTN_TOGGLE = 0x00040000,
}
///
/// The TF_LBMENUF_* constants are used in the ITfMenu::AddMenuItem method to specify the characteristics of a menu item in
/// the language bar.
///
// https://docs.microsoft.com/en-us/windows/win32/tsf/tf-lbmenuf--constants
[PInvokeData("ctfutb.h")]
[Flags]
public enum TF_LBMENUF : uint
{
/// The menu item is checked.
TF_LBMENUF_CHECKED = 0x01,
/// The menu item is a submenu.
TF_LBMENUF_SUBMENU = 0x02,
/// The menu item is a separator.
TF_LBMENUF_SEPARATOR = 0x04,
/// The menu item is a radio check mark.
TF_LBMENUF_RADIOCHECKED = 0x08,
/// The menu item is disabled.
TF_LBMENUF_GRAYED = 0x10,
}
///
/// The TF_SFT_* constants specify display settings of a floating language bar.
///
///
/// The ITfLangBarMgr::ShowFloating method sets the result of a logical OR operation on one or more of these constants to
/// specify the attributes of the language bar item.
///
// https://docs.microsoft.com/en-us/windows/win32/tsf/tf-sft--constants
[PInvokeData("ctfutb.h")]
[Flags]
public enum TF_SFT : uint
{
///
/// Display the language bar as a floating window. This constant cannot be combined with the TF_SFT_DOCK, TF_SFT_MINIMIZED,
/// TF_SFT_HIDDEN, or TF_SFT_DESKBAND constants.
///
TF_SFT_SHOWNORMAL = 0x00000001,
///
/// Dock the language bar in its own task pane. This constant cannot be combined with the TF_SFT_SHOWNORMAL, TF_SFT_MINIMIZED,
/// TF_SFT_HIDDEN, or TF_SFT_DESKBAND constants. Available only on Windows XP.
///
TF_SFT_DOCK = 0x00000002,
///
/// Display the language bar as a single icon in the system tray. This constant cannot be combined with the TF_SFT_SHOWNORMAL,
/// TF_SFT_DOCK, TF_SFT_HIDDEN, or TF_SFT_DESKBAND constants. In Windows XP, use TF_SFT_DESKBAND instead.
///
TF_SFT_MINIMIZED = 0x00000004,
///
/// Hide the language bar. This constant cannot be combined with the TF_SFT_SHOWNORMAL, TF_SFT_DOCK, TF_SFT_MINIMIZED, or
/// TF_SFT_DESKBAND constants.
///
TF_SFT_HIDDEN = 0x00000008,
/// Make the language bar opaque.
TF_SFT_NOTRANSPARENCY = 0x00000010,
/// Make the language bar partially transparent. Available only on Windows 2000 or later.
TF_SFT_LOWTRANSPARENCY = 0x00000020,
/// Make the language bar highly transparent. Available only on Windows 2000 or later.
TF_SFT_HIGHTRANSPARENCY = 0x00000040,
/// Display text labels next to language bar icons.
TF_SFT_LABELS = 0x00000080,
/// Hide language bar icon text labels.
TF_SFT_NOLABELS = 0x00000100,
/// Display text service icons on the taskbar when the language bar is minimized.
TF_SFT_EXTRAICONSONMINIMIZED = 0x00000200,
/// Hide text service icons on the taskbar when the language bar is minimized.
TF_SFT_NOEXTRAICONSONMINIMIZED = 0x00000400,
///
/// Dock the language bar in the righthand end of the system task bar (immediately left of the system tray/clock). This constant
/// cannot be combined with the TF_SFT_SHOWNORMAL, TF_SFT_DOCK, TF_SFT_MINIMIZED, or TF_SFT_HIDDEN constants. Available only on
/// Windows XP.
///
TF_SFT_DESKBAND = 0x00000800,
}
/// Elements of the TfLBBalloonStyle enumeration are used to specify a language bar balloon style.
///
/// The following image shows an example of a balloon with the TF_LB_BALLOON_RECO style.
/// The following image shows an example of a balloon with the TF_LB_BALLOON_SHOW style.
/// The following image shows an example of a balloon with the TF_LB_BALLOON_MISS style.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/ne-ctfutb-tflbballoonstyle
[PInvokeData("ctfutb.h", MSDNShortId = "NE:ctfutb.__MIDL_ITfLangBarItemBalloon_0001")]
[Guid("F399A969-9E97-4DDD-B974-2BFB934CFBC9")]
public enum TfLBBalloonStyle : uint
{
/// This balloon style is used to represent a reconversion operation.
TF_LB_BALLOON_RECO,
/// This is a normal balloon style.
TF_LB_BALLOON_SHOW,
/// This balloon style is used to indicate that a command was not recognized.
TF_LB_BALLOON_MISS,
}
/// Elements of the TfLBIClick enumeration specify which mouse button was used to click a toolbar item.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/ne-ctfutb-tflbiclick
[PInvokeData("ctfutb.h", MSDNShortId = "NE:ctfutb.__MIDL___MIDL_itf_ctfutb_0000_0010_0001")]
[Guid("8FB5F0CE-DFDD-4F0A-85B9-8988D8DD8FF2")]
public enum TfLBIClick : uint
{
/// The user right-clicked the button.
TF_LBI_CLK_RIGHT,
/// The user left-clicked the button.
TF_LBI_CLK_LEFT,
}
///
/// The ITfLangBarEventSink interface is implemented by an application or text service and used by the language bar to supply
/// notifications of certain events that occur in the language bar. The application or text service installs this event sink by
/// calling ITfLangBarMgr::AdviseEventSink.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbareventsink
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarEventSink")]
[ComImport, Guid("18A4E900-E0AE-11D2-AFDD-00105A2799B5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITfLangBarEventSink
{
/// Called when the thread the event sink was installed from receives the input focus.
/// Contains the current thread identifier. This is the same value returned from GetCurrentThreadId.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbareventsink-onsetfocus HRESULT OnSetFocus( DWORD
// dwThreadId );
[PreserveSig]
HRESULT OnSetFocus(uint dwThreadId);
/// Not currently used.
/// Not currently used.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbareventsink-onthreadterminate HRESULT
// OnThreadTerminate( DWORD dwThreadId );
[Obsolete("Not currently used.")]
[PreserveSig]
HRESULT OnThreadTerminate(uint dwThreadId);
/// Called when a language bar item changes.
/// Contains the current thread identifier. This is the same value returned from GetCurrentThreadId.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbareventsink-onthreaditemchange HRESULT
// OnThreadItemChange( DWORD dwThreadId );
[PreserveSig]
HRESULT OnThreadItemChange(uint dwThreadId);
/// Not currently used.
/// Not currently used.
/// Not currently used.
/// Not currently used.
/// Not currently used.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbareventsink-onmodalinput HRESULT OnModalInput(
// DWORD dwThreadId, UINT uMsg, WPARAM wParam, LPARAM lParam );
[Obsolete("Not currently used.")]
[PreserveSig]
HRESULT OnModalInput(uint dwThreadId, uint uMsg, [In] WPARAM wParam, [In] LPARAM lParam);
/// Called when ITfLangBarMgr::ShowFloating is called.
/// Contains the TF_SFT_* values passed to ITfLangBarMgr::ShowFloating.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbareventsink-showfloating HRESULT ShowFloating(
// DWORD dwFlags );
[PreserveSig]
HRESULT ShowFloating([In] TF_SFT dwFlags);
/// Not currently used.
/// Not currently used.
/// Not currently used.
/// Not currently used.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbareventsink-getitemfloatingrect HRESULT
// GetItemFloatingRect( DWORD dwThreadId, REFGUID rguid, RECT *prc );
[Obsolete("Not currently used.")]
[PreserveSig]
HRESULT GetItemFloatingRect(uint dwThreadId, in Guid rguid, out RECT prc);
}
///
/// The ITfLangBarItem interface is implemented by a language bar item provider and used by the language bar manager to
/// obtain detailed information about the language bar item. An instance of this interface is provided to the language bar manager
/// by the ITfLangBarItemMgr::AddItem method.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbaritem
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarItem")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("73540D69-EDEB-4EE9-96C9-23AA30B25916")]
public interface ITfLangBarItem
{
/// Obtains information about the language bar item.
/// Pointer to a TF_LANGBARITEMINFO structure that receives the language bar item information.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pInfo is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getinfo HRESULT GetInfo(
// TF_LANGBARITEMINFO *pInfo );
[PreserveSig]
HRESULT GetInfo(out TF_LANGBARITEMINFO pInfo);
/// Obtains the status of a language bar item.
///
/// Pointer to a DWORD that receives zero or a combination of one or more of the TF_LBI_STATUS_* values that indicate the
/// current status of the item.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pdwStatus is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getstatus HRESULT GetStatus( DWORD
// *pdwStatus );
[PreserveSig]
HRESULT GetStatus(out TF_LBI_STATUS pdwStatus);
/// Called to show or hide the language bar item.
///
/// Contains a BOOL that indicates if the item should be shown or hidden. Contains a nonzero value if the item should be
/// shown or zero otherwise.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support this method.
///
///
///
///
///
/// The language bar item implementation should update its visible status by modifying the value returned from
/// ITfLangBarItem::GetStatus to include or exclude the TF_LBI_STATUS_HIDDEN status flag. The implementation then prompts
/// language bar to obtain the new status value by calling ITfLangBarItemSink::OnUpdate with TF_LBI_STATUS.
///
///
/// This method is only useful when the item has the TF_LBI_STYLE_HIDDENSTATUSCONTROL style. Without this style, only the
/// language bar can show or hide the item.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-show HRESULT Show( BOOL fShow );
[PreserveSig]
HRESULT Show([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
/// Obtains the text to be displayed in the tooltip for the language bar item.
///
/// Pointer to a BSTR value that receives the tooltip string for the language bar item. This string must be allocated
/// using the SysAllocString function. The caller must free this buffer when it is no longer required by calling SysFreeString.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pbstrToolTip is invalid.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support tooltip text.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-gettooltipstring HRESULT GetTooltipString(
// BSTR *pbstrToolTip );
[PreserveSig]
HRESULT GetTooltipString([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrToolTip);
}
///
///
/// The ITfLangBarItemBalloon interface is implemented by an application or text service and is used by the language bar
/// manager to obtain information specific to a balloon item on the language bar.
///
///
/// The language bar manager obtains an instance of this interface by calling QueryInterface on the ITfLangBarItem passed to
/// ITfLangBarItemMgr::AddItem with IID_ITfLangBarItemBalloon.
///
///
/// A language bar balloon acts as a pop-up notification on the language bar.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbaritemballoon
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarItemBalloon")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("01C2D285-D3C7-4B7B-B5B5-D97411D0C283")]
public interface ITfLangBarItemBalloon : ITfLangBarItem
{
/// Obtains information about the language bar item.
/// Pointer to a TF_LANGBARITEMINFO structure that receives the language bar item information.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pInfo is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getinfo HRESULT GetInfo(
// TF_LANGBARITEMINFO *pInfo );
[PreserveSig]
new HRESULT GetInfo(out TF_LANGBARITEMINFO pInfo);
/// Obtains the status of a language bar item.
///
/// Pointer to a DWORD that receives zero or a combination of one or more of the TF_LBI_STATUS_* values that indicate the
/// current status of the item.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pdwStatus is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getstatus HRESULT GetStatus( DWORD
// *pdwStatus );
[PreserveSig]
new HRESULT GetStatus(out TF_LBI_STATUS pdwStatus);
/// Called to show or hide the language bar item.
///
/// Contains a BOOL that indicates if the item should be shown or hidden. Contains a nonzero value if the item should be
/// shown or zero otherwise.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support this method.
///
///
///
///
///
/// The language bar item implementation should update its visible status by modifying the value returned from
/// ITfLangBarItem::GetStatus to include or exclude the TF_LBI_STATUS_HIDDEN status flag. The implementation then prompts
/// language bar to obtain the new status value by calling ITfLangBarItemSink::OnUpdate with TF_LBI_STATUS.
///
///
/// This method is only useful when the item has the TF_LBI_STYLE_HIDDENSTATUSCONTROL style. Without this style, only the
/// language bar can show or hide the item.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-show HRESULT Show( BOOL fShow );
[PreserveSig]
new HRESULT Show([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
/// Obtains the text to be displayed in the tooltip for the language bar item.
///
/// Pointer to a BSTR value that receives the tooltip string for the language bar item. This string must be allocated
/// using the SysAllocString function. The caller must free this buffer when it is no longer required by calling SysFreeString.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pbstrToolTip is invalid.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support tooltip text.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-gettooltipstring HRESULT GetTooltipString(
// BSTR *pbstrToolTip );
[PreserveSig]
new HRESULT GetTooltipString([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrToolTip);
/// Not currently used.
/// Contains one of the TfLBIClick values that indicate which mouse button was used to click the balloon.
///
/// Pointer to a Point structure that contains the position of the mouse cursor, in screen coordinates, at the
/// time of the click event.
///
/// Pointer to a RECT structure that contains the bounding rectangle, in screen coordinates, of the balloon.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemballoon-onclick HRESULT OnClick( TfLBIClick
// click, Point pt, const RECT *prcArea );
[Obsolete("Not currently used.")]
[PreserveSig]
HRESULT OnClick([In] TfLBIClick click, [In] POINT pt, in RECT prcArea);
/// Obtains the preferred size,in pixels, of the balloon.
/// Pointer to a SIZE structure that contains the default size, in pixels, of the balloon.
///
/// Pointer to a SIZE structure that recevies the preferred balloon size, in pixels. The cy member of this
/// structure is ignored.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
///
///
///
/// This method is required. The balloon must supply the preferred size in response to this method.
///
/// To obtain the font used to draw the balloon, call GetStockObject with DEFAULT_GUI_FONT. This font can be used to calculate
/// the preferred balloon size at runtime.
///
///
/// If the ballon text will not fit into the preferred size obtained from this method, the language bar truncates the text and
/// adds an ellipses to the text.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemballoon-getpreferredsize HRESULT
// GetPreferredSize( const SIZE *pszDefault, SIZE *psz );
[PreserveSig]
HRESULT GetPreferredSize(in SIZE pszDefault, out SIZE psz);
/// Obtains information about the balloon.
/// Pointer to a TF_LBBALLOONINFO structure that receives the information about the balloon.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pInfo is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemballoon-getballooninfo HRESULT
// GetBalloonInfo( TF_LBBALLOONINFO *pInfo );
[PreserveSig]
HRESULT GetBalloonInfo(out TF_LBBALLOONINFO pInfo);
}
///
///
/// The ITfLangBarItemBitmap interface is implemented by an application or text service and used by the language bar manager
/// to obtain information specific to a bitmap item on the language bar.
///
///
/// The language bar manager obtains an instance of this interface by calling QueryInterface on the ITfLangBarItem passed to
/// ITfLangBarItemMgr::AddItem with IID_ITfLangBarItemBitmap.
///
///
/// A language bar bitmap functions as a static item on the language bar that displays a bitmap.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbaritembitmap
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarItemBitmap")]
[ComImport, Guid("73830352-D722-4179-ADA5-F045C98DF355"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITfLangBarItemBitmap : ITfLangBarItem
{
/// Obtains information about the language bar item.
/// Pointer to a TF_LANGBARITEMINFO structure that receives the language bar item information.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pInfo is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getinfo HRESULT GetInfo(
// TF_LANGBARITEMINFO *pInfo );
[PreserveSig]
new HRESULT GetInfo(out TF_LANGBARITEMINFO pInfo);
/// Obtains the status of a language bar item.
///
/// Pointer to a DWORD that receives zero or a combination of one or more of the TF_LBI_STATUS_* values that indicate the
/// current status of the item.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pdwStatus is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getstatus HRESULT GetStatus( DWORD
// *pdwStatus );
[PreserveSig]
new HRESULT GetStatus(out TF_LBI_STATUS pdwStatus);
/// Called to show or hide the language bar item.
///
/// Contains a BOOL that indicates if the item should be shown or hidden. Contains a nonzero value if the item should be
/// shown or zero otherwise.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support this method.
///
///
///
///
///
/// The language bar item implementation should update its visible status by modifying the value returned from
/// ITfLangBarItem::GetStatus to include or exclude the TF_LBI_STATUS_HIDDEN status flag. The implementation then prompts
/// language bar to obtain the new status value by calling ITfLangBarItemSink::OnUpdate with TF_LBI_STATUS.
///
///
/// This method is only useful when the item has the TF_LBI_STYLE_HIDDENSTATUSCONTROL style. Without this style, only the
/// language bar can show or hide the item.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-show HRESULT Show( BOOL fShow );
[PreserveSig]
new HRESULT Show([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
/// Obtains the text to be displayed in the tooltip for the language bar item.
///
/// Pointer to a BSTR value that receives the tooltip string for the language bar item. This string must be allocated
/// using the SysAllocString function. The caller must free this buffer when it is no longer required by calling SysFreeString.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pbstrToolTip is invalid.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support tooltip text.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-gettooltipstring HRESULT GetTooltipString(
// BSTR *pbstrToolTip );
[PreserveSig]
new HRESULT GetTooltipString([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrToolTip);
/// Not currently used.
/// Contains one of the TfLBIClick values that indicate which mouse button was used to click the bitmap.
///
/// Pointer to a Point structure that contains the position of the mouse cursor, in screen coordinates, at the
/// time of the click event.
///
/// Pointer to a RECT structure that contains the bounding rectangle, in screen coordinates, of the bitmap.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmap-onclick HRESULT OnClick( TfLBIClick
// click, Point pt, const RECT *prcArea );
[Obsolete("Not currently used.")]
[PreserveSig]
HRESULT OnClick([In] TfLBIClick click, [In] POINT pt, in RECT prcArea);
/// Obtains the preferred size, in pixels, of the bitmap.
/// Pointer to a SIZE structure that contains the default size, in pixels, of the bitmap.
///
/// Pointer to a SIZE structure that receives the preferred size, in pixels, of the bitmap. The cy member of this
/// structure is ignored.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmap-getpreferredsize HRESULT
// GetPreferredSize( const SIZE *pszDefault, SIZE *psz );
[PreserveSig]
HRESULT GetPreferredSize(in SIZE pszDefault, out SIZE psz);
/// Obtains the bitmap and mask for the bitmap item.
/// Contains the width, in pixels, of the bitmap item.
/// Contains the height, in pixels, of the bitmap item.
/// Not currently used.
/// Pointer to an HBITMAP value that receives the handle of the bitmap drawn for the bitmap item.
///
///
/// Pointer to an HBITMAP value that receives the handle of the mask bitmap. This is a monochrome bitmap that functions
/// as a mask for phbmp. Each black pixel in this bitmap will cause the cooresponding pixel in phbmp to be displayed in its
/// normal color. Every white pixel in this bitmap will cause the cooresponding pixel in phbmp to be displayed in the inverse of
/// its normal color.
///
///
/// To display the bitmap without any color conversion, create a monochrome bitmap the same size as phbmp and set each pixel to
/// black (RGB(0, 0, 0)).
///
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmap-drawbitmap HRESULT DrawBitmap( LONG
// bmWidth, LONG bmHeight, DWORD dwFlags, HBITMAP *phbmp, HBITMAP *phbmpMask );
[PreserveSig]
HRESULT DrawBitmap(int bmWidth, int bmHeight, uint dwFlags, out HBITMAP phbmp, out HBITMAP phbmpMask);
}
///
///
/// The ITfLangBarItemBitmapButton interface is implemented by a language bar bitmap button provider and is used by the
/// language bar manager to obtain information specific to a bitmap button item on the language bar.
///
///
/// The language bar manager obtains an instance of this interface by calling QueryInterface on the ITfLangBarItem passed to
/// ITfLangBarItemMgr::AddItem with IID_ITfLangBarItemBitmapButton.
///
///
///
/// A language bar bitmap button functions as a button item on the language bar that displays text and a small bitmap. The bitmap
/// displayed for the item should not be larger than the size of a small icon. Obtain these dimensions by calling GetSystemMetrics
/// with SM_CXSMICON for the width and SM_CYSMICON for the height.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbaritembitmapbutton
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarItemBitmapButton")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("A26A0525-3FAE-4FA0-89EE-88A964F9F1B5")]
public interface ITfLangBarItemBitmapButton : ITfLangBarItem
{
/// Obtains information about the language bar item.
/// Pointer to a TF_LANGBARITEMINFO structure that receives the language bar item information.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pInfo is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getinfo HRESULT GetInfo(
// TF_LANGBARITEMINFO *pInfo );
[PreserveSig]
new HRESULT GetInfo(out TF_LANGBARITEMINFO pInfo);
/// Obtains the status of a language bar item.
///
/// Pointer to a DWORD that receives zero or a combination of one or more of the TF_LBI_STATUS_* values that indicate the
/// current status of the item.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pdwStatus is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getstatus HRESULT GetStatus( DWORD
// *pdwStatus );
[PreserveSig]
new HRESULT GetStatus(out TF_LBI_STATUS pdwStatus);
/// Called to show or hide the language bar item.
///
/// Contains a BOOL that indicates if the item should be shown or hidden. Contains a nonzero value if the item should be
/// shown or zero otherwise.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support this method.
///
///
///
///
///
/// The language bar item implementation should update its visible status by modifying the value returned from
/// ITfLangBarItem::GetStatus to include or exclude the TF_LBI_STATUS_HIDDEN status flag. The implementation then prompts
/// language bar to obtain the new status value by calling ITfLangBarItemSink::OnUpdate with TF_LBI_STATUS.
///
///
/// This method is only useful when the item has the TF_LBI_STYLE_HIDDENSTATUSCONTROL style. Without this style, only the
/// language bar can show or hide the item.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-show HRESULT Show( BOOL fShow );
[PreserveSig]
new HRESULT Show([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
/// Obtains the text to be displayed in the tooltip for the language bar item.
///
/// Pointer to a BSTR value that receives the tooltip string for the language bar item. This string must be allocated
/// using the SysAllocString function. The caller must free this buffer when it is no longer required by calling SysFreeString.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pbstrToolTip is invalid.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support tooltip text.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-gettooltipstring HRESULT GetTooltipString(
// BSTR *pbstrToolTip );
[PreserveSig]
new HRESULT GetTooltipString([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrToolTip);
/// This method is not used if the button item does not have the TF_LBI_STYLE_BTN_BUTTON style.
/// Contains a TfLBIClick value that indicates which mouse button was used to click the button.
///
/// Pointer to a Point structure that contains the position, in screen coordinates, of the mouse cursor at the
/// time of the click event.
///
/// Pointer to a RECT structure that contains the bounding rectangle, in screen coordinates, of the button.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmapbutton-onclick HRESULT OnClick(
// TfLBIClick click, Point pt, const RECT *prcArea );
[PreserveSig]
HRESULT OnClick([In] TfLBIClick click, [In] POINT pt, in RECT prcArea);
/// This method is not used if the button item does not have the TF_LBI_STYLE_BTN_MENU style.
///
/// Pointer to an ITfMenu interface that the language bar bitmap button uses to add items to the menu that the language bar
/// displays for the button.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_FAIL
/// An unspecified error occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmapbutton-initmenu HRESULT InitMenu(
// ITfMenu *pMenu );
[PreserveSig]
HRESULT InitMenu([In] ITfMenu pMenu);
/// This method is not used if the button item does not have the TF_LBI_STYLE_BTN_MENU style.
/// Specifies the identifier of the menu item selected. This is the value passed for uId in ITfMenu::AddMenuItem.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_FAIL
/// An unspecified error occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmapbutton-onmenuselect HRESULT
// OnMenuSelect( UINT wID );
[PreserveSig]
HRESULT OnMenuSelect(uint wID);
/// Obtains the preferred size, in pixels, of the bitmap.
/// Pointer to a SIZE structure that contains the default size, in pixels, of the bitmap.
///
/// Pointer to a SIZE structure that recevies the preferred size, in pixels, of the bitmap. The cy member of this
/// structure is ignored.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
///
///
///
/// The results of this method are not currently used. The bitmap for a bitmap button item should not be larger than the size of
/// a small icon. Obtain these dimensions by calling GetSystemMetrics with SM_CXSMICON for the width and SM_CYSMICON for the height.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmapbutton-getpreferredsize HRESULT
// GetPreferredSize( const SIZE *pszDefault, SIZE *psz );
[PreserveSig]
HRESULT GetPreferredSize(in SIZE pszDefault, out SIZE psz);
/// Obtains the bitmap and mask for the bitmap button item.
/// Contains the width, in pixels, of the bitmap button item.
/// Contains the height, in pixels, of the bitmap button item.
/// Not currently used.
/// Pointer to an HBITMAP value that receives the handle of the bitmap drawn for the bitmap item.
///
///
/// Pointer to an HBITMAP value that receives the handle of the mask bitmap. This is a monochrome bitmap that functions
/// as a mask for phbmp. Each black pixel in this bitmap will cause the cooresponding pixel in phbmp to be displayed in its
/// normal color. Each white pixel in this bitmap will cause the cooresponding pixel in phbmp to be displayed in the inverse of
/// its normal color.
///
///
/// To display the bitmap without color conversion, create a monochrome bitmap the same size as phbmp and set each pixel to
/// black (RGB(0, 0, 0)).
///
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmapbutton-drawbitmap HRESULT DrawBitmap(
// LONG bmWidth, LONG bmHeight, DWORD dwFlags, HBITMAP *phbmp, HBITMAP *phbmpMask );
[PreserveSig]
HRESULT DrawBitmap(int bmWidth, int bmHeight, [Optional] uint dwFlags, out HBITMAP phbmp, out HBITMAP phbmpMask);
/// Obtains the text to be displayed for the bitmap button in the language bar.
///
/// Pointer to a BSTR value that receives the string for the language bar item. This string must be allocated using the
/// SysAllocString function. The caller must free this buffer when it is no longer required by calling SysFreeString.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pbstrText is invalid.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembitmapbutton-gettext HRESULT GetText( BSTR
// *pbstrText );
[PreserveSig]
HRESULT GetText([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrText);
}
///
///
/// The ITfLangBarItemButton interface is implemented by a language bar button provider and used by the language bar manager
/// to obtain information about a button item on the language bar.
///
///
/// The language bar manager obtains an instance of this interface by calling QueryInterface on the ITfLangBarItem passed to ITfLangBarItemMgr::AddItem.
///
///
///
/// A language bar button functions as a pushbutton, toggle button, or a menu on the language bar.
///
/// If the button has the TF_LBI_STYLE_BTN_BUTTON style, the button acts as a pushbutton that the user can click with the mouse.
/// When the user clicks the button, ITfLangBarItemButton::OnClick is called. ITfLangBarItemButton::InitMenu and
/// ITfLangBarItemButton::OnMenuSelect are not used.
///
///
/// If the button has the TF_LBI_STYLE_BTN_TOGGLE style, the button functions similar to a check box that the user can select or
/// deselect with the mouse. When the user clicks the button, ITfLangBarItemButton::OnClick is called.
/// ITfLangBarItemButton::InitMenu and ITfLangBarItemButton::OnMenuSelect are not used.
///
///
/// If the button has the TF_LBI_STYLE_BTN_MENU style, the button acts like a top-level menu item. When the user clicks the button,
/// ITfLangBarItemButton::InitMenu is called. If the user selects an item in the menu,
/// ITfLangBarItemButton::OnMenuSelect is called. ITfLangBarItemButton::OnClick is not used.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbaritembutton
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarItemButton")]
[ComImport, Guid("28C7F1D0-DE25-11D2-AFDD-00105A2799B5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITfLangBarItemButton : ITfLangBarItem
{
/// Obtains information about the language bar item.
/// Pointer to a TF_LANGBARITEMINFO structure that receives the language bar item information.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pInfo is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getinfo HRESULT GetInfo(
// TF_LANGBARITEMINFO *pInfo );
[PreserveSig]
new HRESULT GetInfo(out TF_LANGBARITEMINFO pInfo);
/// Obtains the status of a language bar item.
///
/// Pointer to a DWORD that receives zero or a combination of one or more of the TF_LBI_STATUS_* values that indicate the
/// current status of the item.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pdwStatus is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-getstatus HRESULT GetStatus( DWORD
// *pdwStatus );
[PreserveSig]
new HRESULT GetStatus(out TF_LBI_STATUS pdwStatus);
/// Called to show or hide the language bar item.
///
/// Contains a BOOL that indicates if the item should be shown or hidden. Contains a nonzero value if the item should be
/// shown or zero otherwise.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support this method.
///
///
///
///
///
/// The language bar item implementation should update its visible status by modifying the value returned from
/// ITfLangBarItem::GetStatus to include or exclude the TF_LBI_STATUS_HIDDEN status flag. The implementation then prompts
/// language bar to obtain the new status value by calling ITfLangBarItemSink::OnUpdate with TF_LBI_STATUS.
///
///
/// This method is only useful when the item has the TF_LBI_STYLE_HIDDENSTATUSCONTROL style. Without this style, only the
/// language bar can show or hide the item.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-show HRESULT Show( BOOL fShow );
[PreserveSig]
new HRESULT Show([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
/// Obtains the text to be displayed in the tooltip for the language bar item.
///
/// Pointer to a BSTR value that receives the tooltip string for the language bar item. This string must be allocated
/// using the SysAllocString function. The caller must free this buffer when it is no longer required by calling SysFreeString.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pbstrToolTip is invalid.
///
/// -
/// E_NOTIMPL
/// The language bar item does not support tooltip text.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritem-gettooltipstring HRESULT GetTooltipString(
// BSTR *pbstrToolTip );
[PreserveSig]
new HRESULT GetTooltipString([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrToolTip);
/// This method is not used if the button item does not have the TF_LBI_STYLE_BTN_BUTTON style.
/// Contains one of the TfLBIClick values that indicate which mouse button was used to click the button.
///
/// Pointer to a Point structure that contains the position of the mouse cursor, in screen coordinates, at the
/// time of the click event.
///
/// Pointer to a RECT structure that contains the bounding rectangle, in screen coordinates, of the button.
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembutton-onclick HRESULT OnClick( TfLBIClick
// click, Point pt, const RECT *prcArea );
[PreserveSig]
HRESULT OnClick([In] TfLBIClick click, [In] POINT pt, in RECT prcArea);
/// This method is not used if the button item does not have the TF_LBI_STYLE_BTN_MENU style.
///
/// Pointer to an ITfMenu interface that the language bar button uses to add items to the menu that the language bar displays
/// for the button.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_FAIL
/// An unspecified error occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembutton-initmenu HRESULT InitMenu( ITfMenu
// *pMenu );
[PreserveSig]
HRESULT InitMenu([In] ITfMenu pMenu);
/// This method is not used if the button item does not have the TF_LBI_STYLE_BTN_MENU style.
///
/// Specifies the identifier of the menu item selected. This is the value passed for the uId parameter in ITfMenu::AddMenuItem.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_FAIL
/// An unspecified error occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembutton-onmenuselect HRESULT OnMenuSelect(
// UINT wID );
[PreserveSig]
HRESULT OnMenuSelect(uint wID);
/// Obtains the icon to be displayed for the language bar button.
///
/// Pointer to an HICON value that receives the icon handle. Receives NULL if the button has no icon. The caller
/// must free this icon when it is no longer required by calling DestroyIcon.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// phIcon is invalid.
///
///
///
///
///
/// The ideal size of the icon can be obtained by calling GetSystemMetrics(SM_CXSMICON) for the icon width and
/// GetSystemMetrics(SM_CYSMICON) for the icon height.
///
/// If the button has the TF_LBI_STYLE_TEXTCOLORICON style, the icon obtained by this method should be a monochrome icon.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembutton-geticon HRESULT GetIcon( HICON
// *phIcon );
[PreserveSig]
HRESULT GetIcon(out HICON phIcon);
/// Obtains the text to be displayed for the button in the language bar.
///
/// Pointer to a BSTR that receives the string for the language bar item. This string must be allocated using the
/// SysAllocString function. The caller must free this buffer when it is no longer required by calling SysFreeString.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_INVALIDARG
/// pbstrText is invalid.
///
/// -
/// E_OUTOFMEMORY
/// A memory allocation failure occurred.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritembutton-gettext HRESULT GetText( BSTR
// *pbstrText );
[PreserveSig]
HRESULT GetText([Out, MarshalAs(UnmanagedType.BStr)] out string pbstrText);
}
///
///
/// The ITfLangBarItemMgr interface is implemented by the language bar and used by a text service to manage items in the
/// language bar.
///
///
/// A text service obtains an instance of this interface by calling ITfThreadMgr::QueryInterface with IID_ITfLangBarItemMgr. An
/// instance of this interface can also be created by calling CoCreateInstance with CLSID_TF_LangBarItemMgr.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbaritemmgr
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarItemMgr")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("BA468C55-9956-4FB1-A59D-52A7DD7CC6AA"), CoClass(typeof(TF_LangBarItemMgr))]
public interface ITfLangBarItemMgr
{
/// Obtains an enumerator that contains the items in the language bar.
/// Pointer to an IEnumTfLangBarItems interface pointer that receives the enumerator object.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-enumitems HRESULT EnumItems(
// IEnumTfLangBarItems **ppEnum );
IEnumTfLangBarItems EnumItems();
/// Obtains the ITfLangBarItem interface for an item in the language bar.
///
/// GUID that identifies the item to obtain. This is the item GUID that the item supplies in ITfLangBarItem::GetInfo. This
/// identifier can be a custom value or one of the predefined language bar items.
///
/// Pointer to an ITfLangBarItem interface pointer that receives the item interface.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-getitem HRESULT GetItem( REFGUID rguid,
// ITfLangBarItem **ppItem );
ITfLangBarItem GetItem(in Guid rguid);
/// Adds an item to the language bar.
/// Pointer to the ITfLangBarItem object to add to the language bar.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-additem HRESULT AddItem( ITfLangBarItem
// *punk );
void AddItem([In] ITfLangBarItem punk);
/// Removes an item from the language bar.
///
/// Pointer to the ITfLangBarItem object to remove from the language bar. The language bar will call ITfLangBarItem::GetInfo and
/// use the item GUID to identify the item to remove.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-removeitem HRESULT RemoveItem(
// ITfLangBarItem *punk );
void RemoveItem([In] ITfLangBarItem punk);
/// Installs a language bar item event sink for a language bar item.
/// Pointer to the ITfLangBarItemSink object to install.
///
/// Pointer to a DWORD that receives an advise sink identification cookie. This cookie identifies the advise sink when it
/// is removed with the ITfLangBarItemMgr::UnadviseItemSink or ITfLangBarItemMgr::UnadviseItemsSink method.
///
///
/// Contains the GUID that identifies the item to install the advise sink for. This is the item GUID that the item
/// supplies in ITfLangBarItem::GetInfo. This can be a custom value or one of the predefined language bar items.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-adviseitemsink HRESULT AdviseItemSink(
// ITfLangBarItemSink *punk, DWORD *pdwCookie, REFGUID rguidItem );
void AdviseItemSink([In] ITfLangBarItemSink punk, out uint pdwCookie, in Guid rguidItem);
/// Removes a language bar item event sink.
///
/// Contains a DWORD that identifies the advise sink to remove. This cookie is obtained when the advise sink is installed with
/// ITfLangBarItemMgr::AdviseItemSink or ITfLangBarItemMgr::AdviseItemsSink.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-unadviseitemsink HRESULT
// UnadviseItemSink( DWORD dwCookie );
void UnadviseItemSink(uint dwCookie);
/// Obtains the bounding rectangle of an item on the language bar.
/// Not currently used. Must be zero.
///
/// Contains the GUID that identifies the item to obtain the bounding rectangle for. This is the item GUID that
/// the item supplies in ITfLangBarItem::GetInfo. This can be a custom value or one of the predefined language bar items.
///
/// Pointer to a RECT structure that receives the bounding rectangle in screen coordinates.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-getitemfloatingrect HRESULT
// GetItemFloatingRect( DWORD dwThreadId, REFGUID rguid, RECT *prc );
RECT GetItemFloatingRect(uint dwThreadId, in Guid rguid);
/// Obtains the status of one or more items on the language bar.
/// Specifies the number of items to obtain the status for.
///
/// Pointer to an array of GUID s that identify the items obtain the status for. These are the item GUID s that
/// the item supplies in ITfLangBarItem::GetInfo. This array must be at least ulCount elements in length.
///
///
///
/// Pointer to an array of DWORD values that receive the status of each item. Each element in this array receives zero or
/// a combination of one or more of the TF_LBI_STATUS_* values. This array must be at least ulCount elements in length.
///
///
/// The index of each status value cooresponds to the index of the item identifier in prgguid. For example, the element 0 in
/// pdwStatus receives the for the item identified by element 0 of prgguid.
///
///
///
/// This method causes the ITfLangBarItem::GetStatus method of each language bar item identified by prgguid to be called.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-getitemsstatus HRESULT GetItemsStatus(
// ULONG ulCount, const GUID *prgguid, DWORD *pdwStatus );
void GetItemsStatus(uint ulCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] prgguid, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] pdwStatus);
/// Obtains the number of items in the language bar.
/// Pointer to a ULONG that receives the number of items in the language bar.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-getitemnum HRESULT GetItemNum( ULONG
// *pulCount );
uint GetItemNum();
/// Obtains the interface, information and status for one or more items in the language bar.
/// Specifies the number of items to obtain the status for.
///
/// Pointer to an array of ITfLangBarItem interface pointers that receive the item interfaces. This array must be at least
/// ulCount elements in length.
///
///
/// [in, out] Pointer to an array of TF_LANGBARITEMINFO structures that receive the information for each item. This array must
/// be at least ulCount elements in length.
///
///
/// [in, out] Pointer to an array of DWORD values that receive the status of each item. Each element in this array
/// receives zero or a combination of one or more of the TF_LBI_STATUS_* values. This array must be at least ulCount elements in length.
///
///
/// [in, out] Pointer to a ULONG that receives the number of items obtained by this method. This parameter can be NULL if
/// this information is not required.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-getitems HRESULT GetItems( ULONG
// ulCount, ITfLangBarItem **ppItem, TF_LANGBARITEMINFO *pInfo, DWORD *pdwStatus, ULONG *pcFetched );
void GetItems(uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ITfLangBarItem[] ppItem, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] TF_LANGBARITEMINFO[] pInfo,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] TF_LBI_STATUS[] pdwStatus, out uint pcFetched);
/// Installs one or more language bar item event sinks for one or more language bar items.
/// Contains the number of advise sinks to install.
///
/// Pointer to an array of ITfLangBarItemSink objects to install. This array must be at least ulCount elements in length.
///
///
/// Pointer to an array of GUID s that identify the items to install the advise sinks for. These are the item GUID
/// s that the item supplies in ITfLangBarItem::GetInfo. This array must be at least ulCount elements in length.
///
///
/// Pointer to an array of DWORD s that receive the cooresponding advise sink identification cookies. These cookies
/// identify the advise sinks when they are removed with the ITfLangBarItemMgr::UnadviseItemSink or
/// ITfLangBarItemMgr::UnadviseItemsSink method. This array must be at least ulCount elements in length.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-adviseitemssink HRESULT
// AdviseItemsSink( ULONG ulCount, ITfLangBarItemSink **ppunk, const GUID *pguidItem, DWORD *pdwCookie );
void AdviseItemsSink(uint ulCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ITfLangBarItemSink[] ppunk,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] pguidItem, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] pdwCookie);
/// Removes one or more language bar item event sinks.
/// Contains the number of advise sinks to install.
///
/// Pointer to an array of DWORD s that identify the advise sinks to remove. These cookies are obtained when the advise
/// sinks are installed with ITfLangBarItemMgr::AdviseItemSink or ITfLangBarItemMgr::AdviseItemsSink. This array must be at
/// least ulCount elements in length.
///
/// This method has no return values.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemmgr-unadviseitemssink HRESULT
// UnadviseItemsSink( ULONG ulCount, DWORD *pdwCookie );
void UnadviseItemsSink(uint ulCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] pdwCookie);
}
///
///
/// The ITfLangBarItemSink interface is implemented by the language bar and used by a language bar item provider to notify
/// the language bar of changes to a language bar item.
///
///
/// The language bar item provider obtains an instance of this interface when the language bar calls the provider's
/// ITfSource::AdviseSink with identifier IID_ITfLangBarItemSink.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbaritemsink
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarItemSink")]
[ComImport, Guid("57DBE1A0-DE25-11D2-AFDD-00105A2799B5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITfLangBarItemSink
{
/// Notifies the language bar of a change in a language bar item.
///
/// Contains a set of flags that indicate changes in the language bar item. This can be a combination of one or more of the
/// TF_LBI_* values.
///
///
/// This method can return one of these values.
///
///
/// Value
/// Description
///
/// -
/// S_OK
/// The method was successful.
///
/// -
/// E_FAIL
/// An unspecified error occurred.
///
///
///
///
/// A language bar item should call this method when the internal state of the item changes. TSF will update the language bar
/// user interface appropriately.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbaritemsink-onupdate HRESULT OnUpdate( DWORD
// dwFlags );
[PreserveSig]
HRESULT OnUpdate([In] TF_LBI dwFlags);
}
///
/// The ITfLangBarMgr interface is implemented by the TSF manager and used by text services to manage event sink notification
/// and configure floating language bar display settings. The interface ID is IID_ITfLangBarMgr.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itflangbarmgr
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfLangBarMgr")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("87955690-E627-11D2-8DDB-00105A2799B5"), CoClass(typeof(TF_LangBarMgr))]
public interface ITfLangBarMgr
{
/// The ITfLangBarMgr::AdviseEventSink method advises a sink about a language bar event.
/// Sink object to advise about the event.
/// Reserved; must be NULL.
/// Reserved; must be 0.
/// Pointer to an identifier for the connection.
///
/// pdwCookie receives an identifier that should be passed to ITfLangBarMgr::UnadviseEventSink when the event sink is no longer required.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-adviseeventsink HRESULT AdviseEventSink(
// ITfLangBarEventSink *pSink, HWND hwnd, DWORD dwFlags, DWORD *pdwCookie );
void AdviseEventSink([In] ITfLangBarEventSink pSink, [In] HWND hwnd, [Optional] uint dwFlags, out uint pdwCookie);
/// Uninstalls an advise event sink.
///
/// A DWORD value that identifies the advise event sink to uninstall. This value is provided by a previous call to ITfLangBarMgr::AdviseEventSink.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-unadviseeventsink HRESULT
// UnadviseEventSink( DWORD dwCookie );
void UnadviseEventSink(uint dwCookie);
/// Should not be used.
///
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-getthreadmarshalinterface HRESULT
// GetThreadMarshalInterface( DWORD dwThreadId, DWORD dwType, REFIID riid, IUnknown **ppunk );
[Obsolete("Should not be used.")]
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetThreadMarshalInterface(uint dwThreadId, uint dwType, in Guid riid);
/// Should not be used.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-getthreadlangbaritemmgr HRESULT
// GetThreadLangBarItemMgr( DWORD dwThreadId, ITfLangBarItemMgr **pplbi, DWORD *pdwThreadid );
[Obsolete("Should not be used.")]
void GetThreadLangBarItemMgr(uint dwThreadId, out ITfLangBarItemMgr pplbi, out uint pdwThreadid);
/// Should not be used.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-getinputprocessorprofiles HRESULT
// GetInputProcessorProfiles( DWORD dwThreadId, ITfInputProcessorProfiles **ppaip, DWORD *pdwThreadid );
[Obsolete("Should not be used.")]
void GetInputProcessorProfiles(uint dwThreadId, out ITfInputProcessorProfiles ppaip, out uint pdwThreadid);
/// Should not be used.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-restorelastfocus HRESULT RestoreLastFocus(
// DWORD *pdwThreadId, BOOL fPrev );
[Obsolete("Should not be used.")]
void RestoreLastFocus(out uint pdwThreadId, [In, MarshalAs(UnmanagedType.Bool)] bool fPrev);
/// Should not be used.
///
/// Should not be used.
/// Should not be used.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-setmodalinput HRESULT SetModalInput(
// ITfLangBarEventSink *pSink, DWORD dwThreadId, DWORD dwFlags );
[Obsolete("Should not be used.")]
void SetModalInput([In] ITfLangBarEventSink pSink, uint dwThreadId, uint dwFlags);
/// Configures display settings for the floating language bar.
///
/// Specifies language bar display settings.
///
///
/// Value
/// Meaning
///
/// -
/// TF_SFT_SHOWNORMAL
///
/// Display the language bar as a floating window. This constant cannot be combined with the TF_SFT_DOCK, TF_SFT_MINIMIZED,
/// TF_SFT_HIDDEN, or TF_SFT_DESKBAND constants.
///
///
/// -
/// TF_SFT_DOCK
///
/// Deprecated as of Windows Vista. Dock the language bar in its own task pane. This constant cannot be combined with the
/// TF_SFT_SHOWNORMAL, TF_SFT_MINIMIZED, TF_SFT_HIDDEN, or TF_SFT_DESKBAND constants. Available only on Windows XP.
///
///
/// -
/// TF_SFT_MINIMIZED
///
/// Deprecated as of Windows Vista. Display the language bar as a single icon in the system tray. This constant cannot be
/// combined with the TF_SFT_SHOWNORMAL, TF_SFT_DOCK, TF_SFT_HIDDEN, or TF_SFT_DESKBAND constants.
///
///
/// -
/// TF_SFT_HIDDEN
///
/// Hide the language bar. This constant cannot be combined with the TF_SFT_SHOWNORMAL, TF_SFT_DOCK, TF_SFT_MINIMIZED, or
/// TF_SFT_DESKBAND constants.
///
///
/// -
/// TF_SFT_NOTRANSPARENCY
/// Make the language bar opaque.
///
/// -
/// TF_SFT_LOWTRANSPARENCY
/// Make the language bar partially transparent. Available only on Windows 2000 or later.
///
/// -
/// TF_SFT_HIGHTRANSPARENCY
/// Make the language bar highly transparent. Available only on Windows 2000 or later.
///
/// -
/// TF_SFT_LABELS
/// Display text labels next to language bar icons.
///
/// -
/// TF_SFT_NOLABELS
/// Hide language bar icon text labels.
///
/// -
/// TF_SFT_EXTRAICONSONMINIMIZED
/// Display text service icons on the taskbar when the language bar is minimized.
///
/// -
/// TF_SFT_NOEXTRAICONSONMINIMIZED
/// Hide text service icons on the taskbar when the language bar is minimized.
///
/// -
/// TF_SFT_DESKBAND
///
/// Dock the language bar in the system task bar. This constant cannot be combined with the TF_SFT_SHOWNORMAL, TF_SFT_DOCK,
/// TF_SFT_MINIMIZED, or TF_SFT_HIDDEN constants. Available only on Windows XP.
///
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-showfloating HRESULT ShowFloating( DWORD
// dwFlags );
void ShowFloating([In] TF_SFT dwFlags);
/// Obtains current language bar display settings.
/// Indicates current language bar display settings. For a list of bitfield values, see ITfLangBarMgr::ShowFloating.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itflangbarmgr-getshowfloatingstatus HRESULT
// GetShowFloatingStatus( DWORD *pdwFlags );
TF_SFT GetShowFloatingStatus();
}
///
/// The ITfMenu interface is implemented by the language bar and used by a language bar button provider to add items to the
/// menu that the language bar will display for the button.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itfmenu
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfMenu")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6F8A98E4-AAA0-4F15-8C5B-07E0DF0A3DD8")]
public interface ITfMenu
{
/// Adds an item to the menu that the language bar will display for the button.
/// Contains the menu item identifier.
///
/// Contains zero or a combination of one or more of the TF_LBMENUF_* values that specify the type and state of the menu item.
///
///
/// Contains the handle of the bitmap drawn for the menu item. If this is NULL, no bitmap is displayed for the menu item.
///
///
///
/// Contains the handle of the mask bitmap. This is a monochrome bitmap that functions as a mask for hbmp. Each black pixel in
/// this bitmap will cause the corresponding pixel in hbmp to be displayed in its normal color. Each white pixel in this bitmap
/// will cause the corresponding pixel in hbmp to be displayed in the inverse of its normal color.
///
///
/// To have the bitmap displayed without any color conversion, create a monochrome bitmap the same size as hbmp and set each
/// pixel to black (RGB(0, 0, 0)).
///
/// If hbmp is NULL, this parameter is ignored.
///
///
/// Pointer to a WCHAR buffer that contains the text to be displayed for the menu item. The length of the text is
/// specified by cch.
///
/// Specifies the length, in WCHAR, of the menu item text in pch.
///
///
/// [in, out] Pointer to an ITfMenu interface pointer that receives the submenu object. This parameter is not used and must be
/// NULL if dwFlags does not contain TF_LBMENUF_SUBMENU.
///
///
/// If the submenu item is successfully created, this parameter receives an ITfMenu object that the caller uses to add items to
/// the submenu.
///
///
/// If dwFlags contains TF_LBMENUF_SUBMENU, this value must be initialized to NULL prior to calling this method
/// because, in most cases, this is a marshalled call. Not initializing this variable results in the marshaller attempting to
/// access random memory.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfmenu-addmenuitem HRESULT AddMenuItem( UINT uId, DWORD
// dwFlags, HBITMAP hbmp, HBITMAP hbmpMask, const WCHAR *pch, ULONG cch, ITfMenu **ppMenu );
void AddMenuItem(uint uId, [In] TF_LBMENUF dwFlags, [In] HBITMAP hbmp, [In] HBITMAP hbmpMask, [MarshalAs(UnmanagedType.LPWStr)] string pch,
uint cch, [MarshalAs(UnmanagedType.Interface), NullAllowed] out ITfMenu ppMenu);
}
///
/// The ITfSystemDeviceTypeLangBarItem interface is implemented by a system language bar item and used by an application or
/// text service to control how the system item displays its icon. The application or text service obtains an instance of this
/// interface by calling QueryInterface on the ITfLangBarItem object with IID_ITfSystemDeviceTypeLangBarItem.
///
/// Support for this interface is optional and must not be assumed.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itfsystemdevicetypelangbaritem
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfSystemDeviceTypeLangBarItem")]
[ComImport, Guid("45672EB9-9059-46A2-838D-4530355F6A77"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITfSystemDeviceTypeLangBarItem
{
/// Modifies the type of icon displayed for a system language bar item.
///
/// Specifies how the system language bar item should display the icon. This can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// 0
/// The system language bar item should display a default icon for the item.
///
/// -
/// TF_DTLBI_USEPROFILEICON
/// The system language bar item should display the icon specified for the language profile.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemdevicetypelangbaritem-seticonmode HRESULT
// SetIconMode( DWORD dwFlags );
void SetIconMode([In] TF_DTLBI dwFlags);
/// Obtains the current icon display mode for a system language bar item.
///
/// Pointer to a DWORD that receives the current icon display mode for a system language bar item. For more information
/// about possible values, see the dwFlags parameter in ITfSystemDeviceTypeLangBarItem::SetIconMode.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemdevicetypelangbaritem-geticonmode HRESULT
// GetIconMode( DWORD *pdwFlags );
TF_DTLBI GetIconMode();
}
///
/// The ITfSystemLangBarItem interface is implemented by a system language bar menu and is used by a system language bar
/// extension to modify the icon and/or tooltip string displayed for the menu. The extension can obtain an instance of this
/// interface by by calling QueryInterface on the ITfLangBarItem object with IID_ITfSystemLangBarItem.
///
///
/// A system language bar menu is an object on the language bar that supports menu items added to it by third-partyextensions. The
/// system item must support the ITfSource interface and support the IID_ITfSystemLangBarItemSink identifier in its
/// ITfSource::AdviseSink implementation. The system item should also implement the ITfSystemLangBarItem interface. The
/// system item uses the ITfSystemLangBarItemSink interface to enable the extension to add items.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itfsystemlangbaritem
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfSystemLangBarItem")]
[ComImport, Guid("1E13E9EC-6B33-4D4A-B5EB-8A92F029F356"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITfSystemLangBarItem
{
/// Modifies the icon displayed for the system language bar menu.
/// Contains the handle to the new icon.
///
/// In response to this method, the system language bar menu should call ITfLangBarItemSink::OnUpdate with TF_LBI_ICON to force
/// the language bar to obtain the new icon.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemlangbaritem-seticon HRESULT SetIcon( HICON hIcon );
void SetIcon(in HICON hIcon);
/// Modifies the tooltip text displayed for the system language bar menu.
/// A string that appears as a tooltip.
/// Size, in characters, of the string.
///
/// In response to this method, the system language bar menu should call ITfLangBarItemSink::OnUpdate with TF_LBI_TOOLTIP to
/// force the language bar to obtain the new tooltip text.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemlangbaritem-settooltipstring HRESULT
// SetTooltipString( WCHAR *pchToolTip, ULONG cch );
void SetTooltipString([In, MarshalAs(UnmanagedType.LPWStr)] string pchToolTip, uint cch);
}
///
/// The ITfSystemLangBarItemSink interface is implemented by a system language bar menu extension and used by a system
/// language bar menu (host) to allow menu items to be added to an existing system language bar menu. The extension obtains an
/// instance of this interface by calling QueryInterface on the ITfLangBarItem object with IID_ITfSystemLangBarItemSink. It can then
/// pass the object to the host by calling ITfSource::AdviseSink.
///
///
/// A system language bar menu is an object on the language bar that supports menu items added to it by third-partyextensions. The
/// system item must support the ITfSource interface and support the IID_ITfSystemLangBarItemSink identifier in its
/// ITfSource::AdviseSink implementation. The system item should also implement the ITfSystemLangBarItem interface. The
/// system item uses the ITfSystemLangBarItemSink interface to allow the extension to add its items.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itfsystemlangbaritemsink
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfSystemLangBarItemSink")]
[ComImport, Guid("1449D9AB-13CF-4687-AA3E-8D8B18574396"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITfSystemLangBarItemSink
{
/// Called to allow a system language bar item extension to add items to a system language bar menu.
///
/// Pointer to an ITfMenu interface that the system language bar item uses to add items to the system language bar menu.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemlangbaritemsink-initmenu HRESULT InitMenu(
// ITfMenu *pMenu );
void InitMenu([In] ITfMenu pMenu);
/// Called when the user selects an item in the system menu added by the system language bar menu extension.
/// Specifies the identifier of the menu item selected. This is the value passed for uId in ITfMenu::AddMenuItem.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemlangbaritemsink-onmenuselect HRESULT
// OnMenuSelect( UINT wID );
void OnMenuSelect(uint wID);
}
///
/// The ITfSystemLangBarItemText interface is implemented by a system language bar and is used by a system language bar
/// extension to modify the description displayed for the menu. The extension can obtain an instance of this interface by calling
/// the menu object QueryInterface method with IID_ITfSystemLangBarItem.
///
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nn-ctfutb-itfsystemlangbaritemtext
[PInvokeData("ctfutb.h", MSDNShortId = "NN:ctfutb.ITfSystemLangBarItemText")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5C4CE0E5-BA49-4B52-AC6B-3B397B4F701F")]
public interface ITfSystemLangBarItemText
{
///
/// The ITfSystemLangBarItemText::SetItemText method modifies the text displayed for the system language bar menu.
///
/// [in] A string that appears as a description.
/// [in] Size, in characters, of the string.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemlangbaritemtext-setitemtext HRESULT SetItemText(
// const WCHAR *pch, ULONG cch );
void SetItemText([In, MarshalAs(UnmanagedType.LPWStr)] string pch, uint cch);
///
/// The ITfSystemLangBarItemText::GetItemText method obtains the text displayed for the system language bar menu.
///
/// [out] A pointer to BSTR that contains the current description.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/nf-ctfutb-itfsystemlangbaritemtext-getitemtext HRESULT GetItemText(
// BSTR *pbstrText );
[return: MarshalAs(UnmanagedType.BStr)]
string GetItemText();
}
/// The TF_LANGBARITEMINFO structure is used to hold information about a language bar item.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/ns-ctfutb-tf_langbariteminfo typedef struct TF_LANGBARITEMINFO { CLSID
// clsidService; GUID guidItem; DWORD dwStyle; ULONG ulSort; WCHAR szDescription[32]; } TF_LANGBARITEMINFO;
[PInvokeData("ctfutb.h", MSDNShortId = "NS:ctfutb.TF_LANGBARITEMINFO")]
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode), Guid("12A1D29F-A065-440C-9746-EB2002C8BD19")]
public struct TF_LANGBARITEMINFO
{
///
/// Contains the CLSID of the text service that owns the language bar item. This can be CLSID_NULL if the item is not
/// provided by a text service.
///
public Guid clsidService;
/// Contains a GUID value that identifies the language bar item.
public Guid guidItem;
/// Contains a combination of one or more of the TF_LBI_STYLE_* values.
public TF_LBI_STYLE dwStyle;
///
///
/// Specifies the sort order of the language bar item, relative to other language bar items owned by the text service. A lower
/// number indicates that the item will be displayed prior to an item with a higher sort number.
///
///
/// This value is only used if clsidService identifies a registered text service. For more information about registering
/// a text service, see ITfInputProcessorProfiles::Register.
///
///
public uint ulSort;
///
/// Contains the description string for the item in Unicode format. The description string is displayed in the language bar
/// options menu for menu items. This buffer can hold up to TF_LBI_DESC_MAXLEN characters.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string szDescription;
}
/// The TF_LBBALLOONINFO structure contains information about a language bar balloon item.
// https://docs.microsoft.com/en-us/windows/win32/api/ctfutb/ns-ctfutb-tf_lbballooninfo typedef struct TF_LBBALLOONINFO {
// TfLBBalloonStyle style; BSTR bstrText; } TF_LBBALLOONINFO;
[PInvokeData("ctfutb.h", MSDNShortId = "NS:ctfutb.TF_LBBALLOONINFO")]
[StructLayout(LayoutKind.Sequential, Pack = 4), Guid("37574483-5C50-4092-A55C-922E3A67E5B8")]
public struct TF_LBBALLOONINFO
{
/// Contains one of the TfLBBalloonStyle values that specify the type of balloon to display.
public TfLBBalloonStyle style;
///
/// Contains a BSTR that contains the string for the balloon. This string must be allocated using the SysAllocString
/// function. The caller free this buffer when it is no longer required by calling SysFreeString.
///
[MarshalAs(UnmanagedType.BStr)]
public string bstrText;
}
}
}