diff --git a/PInvoke/ComCtl32/CommCtrl.ListView.cs b/PInvoke/ComCtl32/CommCtrl.ListView.cs index cb013317..c27f1038 100644 --- a/PInvoke/ComCtl32/CommCtrl.ListView.cs +++ b/PInvoke/ComCtl32/CommCtrl.ListView.cs @@ -11,19 +11,34 @@ namespace Vanara.PInvoke { public static partial class ComCtl32 { + /// + /// Specifies that the size of the column array and the array itself (puColumns) are obtained by sending a LVN_GETDISPINFO notification. + /// public const int I_COLUMNSCALLBACK = -1; + + /// The listview control sends the parent an LVN_GETDISPINFO notification code to retrieve the index of the group. public const int I_GROUPIDCALLBACK = -1; + + /// The item does not belong to a group. public const int I_GROUPIDNONE = -2; private const uint LVM_FIRST = 0x1000; private const int LVN_FIRST = -0x100; - [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] + /// Values that specify alignment for LVM_ARRANGE. + [PInvokeData("Commctrl.h")] public enum ListViewArrange { + /// Aligns items according to the list-view control's current alignment styles (the default value). LVA_DEFAULT = 0x0000, + + /// Not implemented. Apply the LVS_ALIGNLEFT style instead. LVA_ALIGNLEFT = 0x0001, + + /// Not implemented. Apply the LVS_ALIGNTOP style instead. LVA_ALIGNTOP = 0x0002, + + /// Snaps all icons to the nearest grid position. LVA_SNAPTOGRID = 0x0005, } @@ -58,9 +73,9 @@ namespace Vanara.PInvoke /// /// Specify the coordinates of the first tile. This flag is valid only if the LVBKIF_STYLE_TILE flag is also specified. If this - /// flag is not specified, the first tile begins at the upper-left corner of the client area. If you use ComCtl32.dll Version 6.0 - /// the xOffsetPercent and yOffsetPercent fields contain pixels, not percentage values, to specify the coordinates of the first - /// tile. Comctl32.dll version 6 is not redistributable but it is included in Windows or later. Also, you must specify + /// flag is not specified, the first tile begins at the upper-left corner of the client area. If you use ComCtl32.dll Version + /// 6.0 the xOffsetPercent and yOffsetPercent fields contain pixels, not percentage values, to specify the coordinates of the + /// first tile. Comctl32.dll version 6 is not redistributable but it is included in Windows or later. Also, you must specify /// Comctl32.dll version 6 in a manifest. For more information on manifests, see Enabling Visual Styles. /// LVBKIF_FLAG_TILEOFFSET = 0X00000100, @@ -112,8 +127,8 @@ namespace Vanara.PInvoke } /// - /// Alignment of the column header and the subitem text in the column. The alignment of the leftmost column is always LVCFMT_LEFT; it - /// cannot be changed. This member can be a combination of the following values. Note that not all combinations are valid. + /// Alignment of the column header and the subitem text in the column. The alignment of the leftmost column is always LVCFMT_LEFT; + /// it cannot be changed. This member can be a combination of the following values. Note that not all combinations are valid. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774743")] [Flags] @@ -172,8 +187,8 @@ namespace Vanara.PInvoke LVCFMT_TILE_PLACEMENTMASK = LVCFMT_LINE_BREAK | LVCFMT_FILL, /// - /// Version 6.00 and Windows Vista. Column is a split button (same as HDF_SPLITBUTTON). The header of the column displays a split - /// button (same as HDF_SPLITBUTTON). + /// Version 6.00 and Windows Vista. Column is a split button (same as HDF_SPLITBUTTON). The header of the column displays a + /// split button (same as HDF_SPLITBUTTON). /// LVCFMT_SPLITBUTTON = 0X1000000, } @@ -207,21 +222,36 @@ namespace Vanara.PInvoke LVFI_WRAP = 0X0020, /// - /// Finds the item nearest to the position specified in the pt member, in the direction specified by the vkDirection member. This - /// flag is supported only by large icon and small icon modes. If LVFI_NEARESTXY is specified, all other flags are ignored. + /// Finds the item nearest to the position specified in the pt member, in the direction specified by the vkDirection member. + /// This flag is supported only by large icon and small icon modes. If LVFI_NEARESTXY is specified, all other flags are ignored. /// LVFI_NEARESTXY = 0X0040, } + /// + /// Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one of + /// the header flags. Footer flags are optional. + /// [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewGroupAlignment { + /// Header text is aligned at the left of the window. LVGA_HEADER_LEFT = 0x00000001, + + /// Header text is centered horizontally in the window. LVGA_HEADER_CENTER = 0x00000002, + + /// Header text is aligned at the right of the window. LVGA_HEADER_RIGHT = 0x00000004, // Don't forget to validate exclusivity + + /// Footer text is aligned at the left of the window. LVGA_FOOTER_LEFT = 0x00000008, + + /// Footer text is centered horizontally in the window. LVGA_FOOTER_CENTER = 0x00000010, + + /// Footer text is aligned at the right of the window. LVGA_FOOTER_RIGHT = 0x00000020, // Don't forget to validate exclusivity } @@ -294,13 +324,26 @@ namespace Vanara.PInvoke LVGMF_TEXTCOLOR = 0x00000004, } + /// Value used in LVM_GETGROUPRECT lparam value to specify coordinates of the rectangle to get. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewGroupRect { - LVGGR_GROUP = 0, // Entire expanded group - LVGGR_HEADER = 1, // Header only (collapsed group) - LVGGR_LABEL = 2, // Label only - LVGGR_SUBSETLINK = 3, // subset link only + /// Coordinates of the entire expanded group. + LVGGR_GROUP = 0, + + /// Coordinates of the header only (collapsed group). + LVGGR_HEADER = 1, + + /// Coordinates of the label only. + LVGGR_LABEL = 2, + + /// + /// Coordinates of the subset link only (markup subset). A list-view control can limit the number of visible items displayed in + /// each group. A link is presented to the user to allow the user to expand the group. This flag will return the bounding + /// rectangle of the subset link if the group is a subset (group state of LVGS_SUBSETED, see structure LVGROUP, member state). + /// This flag is provided so that accessibility applications can located the link. + /// + LVGGR_SUBSETLINK = 3, } /// @@ -399,12 +442,20 @@ namespace Vanara.PInvoke LVHT_EX_FOOTER = 0X08000000, } + /// Type of image list. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewImageList { + /// Image list with large icons. LVSIL_NORMAL, + + /// Image list with small icons. LVSIL_SMALL, + + /// Image list with state images. LVSIL_STATE, + + /// Image list for group header. LVSIL_GROUPHEADER } @@ -539,6 +590,7 @@ namespace Vanara.PInvoke [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewMessage : uint { +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member LVM_SETUNICODEFORMAT = 0X2005, // CCM_SETUNICODEFORMAT, LVM_GETUNICODEFORMAT = 0X2006, // CCM_GETUNICODEFORMAT, LVM_GETBKCOLOR = LVM_FIRST + 0, @@ -668,112 +720,377 @@ namespace Vanara.PInvoke LVM_SETPRESERVEALPHA = LVM_FIRST + 212, /*LVM_SetBkImage = SETBKIMAGEW, LVM_GetBkImage = GETBKIMAGEW,*/ +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } + /// Specifies the relationship to the item listed in parameter wParam in LVM_GETNEXTITEMINDEX. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewNextItemFlag { + /// Searches for a subsequent item by index, the default value. LVNI_ALL = 0X0000, + + /// The item has the LVIS_FOCUSED state flag set. LVNI_FOCUSED = 0X0001, + + /// The item has the LVIS_SELECTED state flag set. LVNI_SELECTED = 0X0002, + + /// The item has the LVIS_CUT state flag set. LVNI_CUT = 0X0004, + + /// The item has the LVIS_DROPHILITED state flag set LVNI_DROPHILITED = 0X0008, + + /// + /// Windows Vista and later: A state flag mask with value as follows: LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED. + /// LVNI_STATEMASK = LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED, + + /// Windows Vista and later: Search the visible order. LVNI_VISIBLEORDER = 0X0010, + + /// + /// Windows Vista and later: Searches for an item that is ordered before the item specified in wParam. The LVNI_PREVIOUS flag is + /// not directional (LVNI_ABOVE will find the item positioned above, while LVNI_PREVIOUS will find the item ordered before.) The + /// LVNI_PREVIOUS flag basically reverses the logic of the search performed by the LVM_GETNEXTITEM or LVM_GETNEXTITEMINDEX messages. + /// LVNI_PREVIOUS = 0X0020, + + /// Windows Vista and later: Search the visible items. LVNI_VISIBLEONLY = 0X0040, + + /// Windows Vista and later: Search the current group. LVNI_SAMEGROUPONLY = 0X0080, + + /// Searches for an item that is above the specified item. LVNI_ABOVE = 0X0100, + + /// Searches for an item that is below the specified item. LVNI_BELOW = 0X0200, + + /// Searches for an item to the left of the specified item. LVNI_TOLEFT = 0X0400, + + /// Searches for an item to the right of the specified item. LVNI_TORIGHT = 0X0800, + + /// + /// Windows Vista and later: A directional flag mask with value as follows: LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT. + /// LVNI_DIRECTIONMASK = LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT, } + /// ListView notification identifiers. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] public enum ListViewNotification { - LVN_BEGINDRAG = -109, - LVN_BEGINLABELEDIT = -175, - LVN_BEGINRDRAG = -111, - LVN_COLUMNCLICK = -108, - LVN_ENDLABELEDIT = -176, - LVN_GETDISPINFO = -177, - LVN_GETINFOTIP = -158, - LVN_ITEMACTIVATE = -114, - LVN_ITEMCHANGED = -101, - LVN_ITEMCHANGING = -100, - LVN_KEYDOWN = -155, - LVN_ODCACHEHINT = -113, - LVN_ODFINDITEM = -179, - LVN_ODSTATECHANGED = -115, - LVN_SETDISPINFO = -178, - LVN_COLUMNDROPDOWN = -164, +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + LVN_BEGINDRAG = (LVN_FIRST - 9), + LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITW, + LVN_BEGINLABELEDITA = (LVN_FIRST - 5), + LVN_BEGINLABELEDITW = (LVN_FIRST - 75), + LVN_BEGINRDRAG = (LVN_FIRST - 11), + LVN_BEGINSCROLL = (LVN_FIRST - 80), + LVN_COLUMNCLICK = (LVN_FIRST - 8), + LVN_COLUMNDROPDOWN = (LVN_FIRST - 64), + LVN_COLUMNOVERFLOWCLICK = (LVN_FIRST - 66), + LVN_DELETEALLITEMS = (LVN_FIRST - 4), + LVN_DELETEITEM = (LVN_FIRST - 3), + LVN_ENDLABELEDIT = LVN_ENDLABELEDITW, + LVN_ENDLABELEDITA = (LVN_FIRST - 6), + LVN_ENDLABELEDITW = (LVN_FIRST - 76), + LVN_ENDSCROLL = (LVN_FIRST - 81), + LVN_GETDISPINFO = LVN_GETDISPINFOW, + LVN_GETDISPINFOA = (LVN_FIRST - 50), + LVN_GETDISPINFOW = (LVN_FIRST - 77), + LVN_GETEMPTYMARKUP = (LVN_FIRST - 87), + LVN_GETINFOTIP = LVN_GETINFOTIPW, + LVN_GETINFOTIPA = (LVN_FIRST - 57), + LVN_GETINFOTIPW = (LVN_FIRST - 58), + LVN_HOTTRACK = (LVN_FIRST - 21), + LVN_INCREMENTALSEARCH = LVN_INCREMENTALSEARCHW, + LVN_INCREMENTALSEARCHA = (LVN_FIRST - 62), + LVN_INCREMENTALSEARCHW = (LVN_FIRST - 63), + LVN_INSERTITEM = (LVN_FIRST - 2), + LVN_ITEMACTIVATE = (LVN_FIRST - 14), + LVN_ITEMCHANGED = (LVN_FIRST - 1), + LVN_ITEMCHANGING = (LVN_FIRST - 0), + LVN_KEYDOWN = (LVN_FIRST - 55), + LVN_LINKCLICK = (LVN_FIRST - 84), + LVN_MARQUEEBEGIN = (LVN_FIRST - 56), + LVN_ODCACHEHINT = (LVN_FIRST - 13), + LVN_ODFINDITEM = LVN_ODFINDITEMW, + LVN_ODFINDITEMA = (LVN_FIRST - 52), + LVN_ODFINDITEMW = (LVN_FIRST - 79), + LVN_ODSTATECHANGED = (LVN_FIRST - 15), + LVN_SETDISPINFO = LVN_SETDISPINFOW, + LVN_SETDISPINFOA = (LVN_FIRST - 51), + LVN_SETDISPINFOW = (LVN_FIRST - 78), +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } + /// The following window styles are specific to list-view controls. [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] - public enum ListViewStyle + public enum ListViewStyle : uint { - LVS_ICON = 0x0000, - LVS_REPORT = 0x0001, - LVS_SMALLICON = 0x0002, - LVS_LIST = 0x0003, - LVS_TYPEMASK = 0x0003, - LVS_SINGLESEL = 0x0004, - LVS_SHOWSELALWAYS = 0x0008, - LVS_SORTASCENDING = 0x0010, - LVS_SORTDESCENDING = 0x0020, - LVS_SHAREIMAGELISTS = 0x0040, - LVS_NOLABELWRAP = 0x0080, - LVS_AUTOARRANGE = 0x0100, - LVS_EDITLABELS = 0x0200, - LVS_OWNERDATA = 0x1000, - LVS_NOSCROLL = 0x2000, - LVS_TYPESTYLEMASK = 0xfc00, - LVS_ALIGNTOP = 0x0000, + /// Items are left-aligned in icon and small icon view. LVS_ALIGNLEFT = 0x0800, + + /// The control's current alignment. LVS_ALIGNMASK = 0x0c00, - LVS_OWNERDRAWFIXED = 0x0400, + + /// Items are aligned with the top of the list-view control in icon and small icon view. + LVS_ALIGNTOP = 0x0000, + + /// Icons are automatically kept arranged in icon and small icon view. + LVS_AUTOARRANGE = 0x0100, + + /// Item text can be edited in place. The parent window must process the LVN_ENDLABELEDIT notification code. + LVS_EDITLABELS = 0x0200, + + /// This style specifies icon view. + LVS_ICON = 0x0000, + + /// This style specifies list view. + LVS_LIST = 0x0003, + + /// Column headers are not displayed in report view. By default, columns have headers in report view. LVS_NOCOLUMNHEADER = 0x4000, + + /// Item text is displayed on a single line in icon view. By default, item text may wrap in icon view. + LVS_NOLABELWRAP = 0x0080, + + /// + /// Scrolling is disabled. All items must be within the client area. This style is not compatible with the LVS_LIST or + /// LVS_REPORT styles. See Knowledge Base Article Q137520 for further discussion. + /// + LVS_NOSCROLL = 0x2000, + + /// + /// Column headers do not work like buttons. This style can be used if clicking a column header in report view does not carry + /// out an action, such as sorting. + /// LVS_NOSORTHEADER = 0x8000, + + /// + /// Version 4.70. This style specifies a virtual list-view control. For more information about this list control style, see + /// About List-View Controls. + /// + LVS_OWNERDATA = 0x1000, + + /// + /// The owner window can paint items in report view. The list-view control sends a WM_DRAWITEM message to paint each item; it + /// does not send separate messages for each subitem. The iItemData member of the DRAWITEMSTRUCT structure contains the item + /// data for the specified list-view item. + /// + LVS_OWNERDRAWFIXED = 0x0400, + + /// + /// This style specifies report view. When using the LVS_REPORT style with a list-view control, the first column is always + /// left-aligned. You cannot use LVCFMT_RIGHT to change this alignment. See LVCOLUMN for further information on column alignment. + /// + LVS_REPORT = 0x0001, + + /// + /// The image list will not be deleted when the control is destroyed. This style enables the use of the same image lists with + /// multiple list-view controls. + /// + LVS_SHAREIMAGELISTS = 0x0040, + + /// The selection, if any, is always shown, even if the control does not have the focus. + LVS_SHOWSELALWAYS = 0x0008, + + /// Only one item at a time can be selected. By default, multiple items may be selected. + LVS_SINGLESEL = 0x0004, + + /// This style specifies small icon view. + LVS_SMALLICON = 0x0002, + + /// Item indexes are sorted based on item text in ascending order. + LVS_SORTASCENDING = 0x0010, + + /// Item indexes are sorted based on item text in descending order. + LVS_SORTDESCENDING = 0x0020, + + /// Determines the control's current window style. + LVS_TYPEMASK = 0x0003, + + /// Determines the window styles that control item alignment and header appearance and behavior. + LVS_TYPESTYLEMASK = 0xfc00, } + /// + /// Extended List-View Styles. Use the LVM_SETEXTENDEDLISTVIEWSTYLE message or one of the ListView_SetExtendedListViewStyle or + /// ListView_SetExtendedListViewStyleEx macros to employ these extended list-view control styles. + /// [PInvokeData("Commctrl.h", MSDNShortId = "bb761385")] [Flags] public enum ListViewStyleEx : uint { - LVS_EX_GRIDLINES = 0X00000001, - LVS_EX_SUBITEMIMAGES = 0X00000002, - LVS_EX_CHECKBOXES = 0X00000004, - LVS_EX_TRACKSELECT = 0X00000008, - LVS_EX_HEADERDRAGDROP = 0X00000010, - LVS_EX_FULLROWSELECT = 0X00000020, - LVS_EX_ONECLICKACTIVATE = 0X00000040, - LVS_EX_TWOCLICKACTIVATE = 0X00000080, - LVS_EX_FLATSB = 0X00000100, - LVS_EX_REGIONAL = 0X00000200, - LVS_EX_INFOTIP = 0X00000400, - LVS_EX_UNDERLINEHOT = 0X00000800, - LVS_EX_UNDERLINECOLD = 0X00001000, - LVS_EX_MULTIWORKAREAS = 0X00002000, - LVS_EX_LABELTIP = 0X00004000, - LVS_EX_BORDERSELECT = 0X00008000, - LVS_EX_DOUBLEBUFFER = 0X00010000, - LVS_EX_HIDELABELS = 0X00020000, - LVS_EX_SINGLEROW = 0X00040000, - LVS_EX_SNAPTOGRID = 0X00080000, - LVS_EX_SIMPLESELECT = 0X00100000, - LVS_EX_JUSTIFYCOLUMNS = 0X00200000, - LVS_EX_TRANSPARENTBKGND = 0X00400000, - LVS_EX_TRANSPARENTSHADOWTEXT = 0X00800000, + /// Windows Vista and later. Automatically arrange icons if no icon positions have been set (Similar to LVS_AUTOARRANGE). LVS_EX_AUTOAUTOARRANGE = 0X01000000, - LVS_EX_HEADERINALLVIEWS = 0X02000000, + + /// Windows Vista and later. Automatically select check boxes on single click. LVS_EX_AUTOCHECKSELECT = 0X08000000, + + /// Windows Vista and later. Automatically size listview columns. LVS_EX_AUTOSIZECOLUMNS = 0X10000000, - LVS_EX_COLUMNSNAPPOINTS = 0X40000000, + + /// Version 4.71 and later. Changes border color when an item is selected, instead of highlighting the item. + LVS_EX_BORDERSELECT = 0X00008000, + + /// + /// Version 4.70. Enables check boxes for items in a list-view control. When set to this style, the control creates and sets a + /// state image list with two images using DrawFrameControl. State image 1 is the unchecked box, and state image 2 is the + /// checked box. Setting the state image to zero removes the check box. + /// + /// Version 6.00 and later Check boxes are visible and functional with all list view modes except the tile view mode introduced + /// in ComCtl32.dll version 6. Clicking a checkbox in tile view mode only selects the item; the state does not change. + /// + /// + /// You can obtain the state of the check box for a given item with ListView_GetCheckState. To set the check state, use + /// ListView_SetCheckState. If this style is set, the list-view control automatically toggles the check state when the user + /// clicks the check box or presses the space bar. + /// + /// + LVS_EX_CHECKBOXES = 0X00000004, + + /// + /// Indicates that an overflow button should be displayed in icon/tile view if there is not enough client width to display the + /// complete set of header items. The list-view control sends the LVN_COLUMNOVERFLOWCLICK notification when the overflow button + /// is clicked. This flag is only valid when LVS_EX_HEADERINALLVIEWS is also specified. + /// LVS_EX_COLUMNOVERFLOW = 0X80000000, + + /// Windows Vista and later. Snap to minimum column width when the user resizes a column. + LVS_EX_COLUMNSNAPPOINTS = 0X40000000, + + /// + /// Version 6.00 and later. Paints via double-buffering, which reduces flicker. This extended style also enables alpha-blended + /// marquee selection on systems where it is supported. + /// + LVS_EX_DOUBLEBUFFER = 0X00010000, + + /// + /// Enables flat scroll bars in the list view. If you need more control over the appearance of the list view's scroll bars, you + /// should manipulate the list view's scroll bars directly using the Flat Scroll Bar APIs. If the system metrics change, you are + /// responsible for adjusting the scroll bar metrics with FlatSB_SetScrollProp. See Flat Scroll Bars for further details. + /// + LVS_EX_FLATSB = 0X00000100, + + /// + /// When an item is selected, the item and all its subitems are highlighted. This style is available only in conjunction with + /// the LVS_REPORT style. + /// + LVS_EX_FULLROWSELECT = 0X00000020, + + /// + /// Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style. + /// + LVS_EX_GRIDLINES = 0X00000001, + + /// + /// Enables drag-and-drop reordering of columns in a list-view control. This style is only available to list-view controls that + /// use the LVS_REPORT style. + /// + LVS_EX_HEADERDRAGDROP = 0X00000010, + + /// Windows Vista and later. Show column headers in all view modes. + LVS_EX_HEADERINALLVIEWS = 0X02000000, + + /// Version 6.00 and later. Hides the labels in icon and small icon view. + LVS_EX_HIDELABELS = 0X00020000, + + /// + /// When a list-view control uses the LVS_EX_INFOTIP style, the LVN_GETINFOTIP notification code is sent to the parent window + /// before displaying an item's tooltip. + /// + LVS_EX_INFOTIP = 0X00000400, + + /// Windows Vista and later. Icons are lined up in columns that use up the whole view. + LVS_EX_JUSTIFYCOLUMNS = 0X00200000, + + /// + /// If a partially hidden label in any list view mode lacks tooltip text, the list-view control will unfold the label. If this + /// style is not set, the list-view control will unfold partly hidden labels only for the large icon mode. + /// + LVS_EX_LABELTIP = 0X00004000, + + /// + /// If the list-view control has the LVS_AUTOARRANGE style, the control will not autoarrange its icons until one or more work + /// areas are defined (see LVM_SETWORKAREAS). To be effective, this style must be set before any work areas are defined and any + /// items have been added to the control. + /// + LVS_EX_MULTIWORKAREAS = 0X00002000, + + /// + /// The list-view control sends an LVN_ITEMACTIVATE notification code to the parent window when the user clicks an item. This + /// style also enables hot tracking in the list-view control. Hot tracking means that when the cursor moves over an item, it is + /// highlighted but not selected. See the Extended List-View Styles Remarks section for a discussion of item activation. + /// + LVS_EX_ONECLICKACTIVATE = 0X00000040, + + /// + /// Version 4.71 through Version 5.80 only. Not supported on Windows Vista and later. Sets the list view window region to + /// include only the item icons and text using SetWindowRgn. Any area that is not part of an item is excluded from the window + /// region. This style is only available to list-view controls that use the LVS_ICON style. + /// + LVS_EX_REGIONAL = 0X00000200, + + /// + /// Version 6.00 and later. In icon view, moves the state image of the control to the top right of the large icon rendering. In + /// views other than icon view there is no change. When the user changes the state by using the space bar, all selected items + /// cycle over, not the item with the focus. + /// + LVS_EX_SIMPLESELECT = 0X00100000, + + /// Version 6.00 and later. Not used. + LVS_EX_SINGLEROW = 0X00040000, + + /// Version 6.00 and later. In icon view, icons automatically snap into a grid. + LVS_EX_SNAPTOGRID = 0X00080000, + + /// + /// Allows images to be displayed for subitems. This style is available only in conjunction with the LVS_REPORT style. + /// + LVS_EX_SUBITEMIMAGES = 0X00000002, + + /// + /// Enables hot-track selection in a list-view control. Hot track selection means that an item is automatically selected when + /// the cursor remains over the item for a certain period of time. The delay can be changed from the default system setting with + /// a LVM_SETHOVERTIME message. This style applies to all styles of list-view control. You can check whether hot-track selection + /// is enabled by calling SystemParametersInfo. + /// + LVS_EX_TRACKSELECT = 0X00000008, + + /// Windows Vista and later. Background is painted by the parent via WM_PRINTCLIENT. + LVS_EX_TRANSPARENTBKGND = 0X00400000, + + /// Windows Vista and later. Enable shadow text on transparent backgrounds only. + LVS_EX_TRANSPARENTSHADOWTEXT = 0X00800000, + + /// + /// The list-view control sends an LVN_ITEMACTIVATE notification code to the parent window when the user double-clicks an item. + /// This style also enables hot tracking in the list-view control. Hot tracking means that when the cursor moves over an item, + /// it is highlighted but not selected. See the Extended List-View Styles Remarks section for a discussion of item activation. + /// + LVS_EX_TWOCLICKACTIVATE = 0X00000080, + + /// + /// Causes those non-hot items that may be activated to be displayed with underlined text. This style requires that + /// LVS_EX_TWOCLICKACTIVATE be set also. See the Extended List-View Styles Remarks section for a discussion of item activation. + /// + LVS_EX_UNDERLINECOLD = 0X00001000, + + /// + /// Causes those hot items that may be activated to be displayed with underlined text. This style requires that + /// LVS_EX_ONECLICKACTIVATE or LVS_EX_TWOCLICKACTIVATE also be set. See the Extended List-View Styles Remarks section for a + /// discussion of item activation. + /// + LVS_EX_UNDERLINEHOT = 0X00000800, } /// Flags that determines how the tiles are sized in tile view. @@ -858,9 +1175,7 @@ namespace Vanara.PInvoke /// /// /// - /// - /// A Rectangle structure to receive the coordinates. - /// + /// A Rectangle structure to receive the coordinates. /// /// Returns TRUE if successful, or FALSE otherwise. /// @@ -991,22 +1306,46 @@ namespace Vanara.PInvoke /// /// /// Returns TRUE if successful, or FALSE otherwise. - // BOOL ListView_GetNextItemIndex( [in] HWND hwnd, [in, out] LVITEMINDEX *plvii, LPARAM flags); - // https://msdn.microsoft.com/en-us/library/windows/desktop/bb774986(v=vs.85).aspx + // BOOL ListView_GetNextItemIndex( [in] HWND hwnd, [in, out] LVITEMINDEX *plvii, LPARAM flags); https://msdn.microsoft.com/en-us/library/windows/desktop/bb774986(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb774986")] public static bool ListView_GetNextItemIndex(HWND hwnd, in LVITEMINDEX plvii, ListViewNextItemFlag flags) => SendMessage(hwnd, (uint)ListViewMessage.LVM_GETNEXTITEMINDEX, (IntPtr)SafeCoTaskMemHandle.CreateFromStructure(plvii), (IntPtr)(int)flags) != IntPtr.Zero; - /// Sets the state of a specified list-view item. Use this macro or send the LVM_SETITEMINDEXSTATE message explicitly.Type: HWNDA handle to the list-view control.Type: LVITEMINDEX*A pointer to an LVITEMINDEX structure for the item. The caller is responsible for allocating this structure and setting the members.Type: UINTThe state to set on the item as one or more (as a bitwise combination) of the List-View Item States flags.Type: UINTThe valid bits of the state specified by parameter data. For more information, see the stateMask member of the LVITEM) structure.None - // https://docs.microsoft.com/en-us/windows/desktop/api/commctrl/nf-commctrl-listview_setitemindexstate - // void ListView_SetItemIndexState( hwndLV, plvii, data, mask ); + /// + /// Sets the state of a specified list-view item. Use this macro or send the LVM_SETITEMINDEXSTATE message explicitly. + /// + /// + /// Type: HWND + /// A handle to the list-view control. + /// + /// + /// Type: LVITEMINDEX* + /// + /// A pointer to an LVITEMINDEX structure for the item. The caller is responsible for allocating this structure and setting the members. + /// + /// + /// + /// Type: UINT + /// The state to set on the item as one or more (as a bitwise combination) of the List-View Item States flags. + /// + /// + /// Type: UINT + /// + /// The valid bits of the state specified by parameter data. For more information, see the stateMask member of the LVITEM) structure. + /// + /// + /// + /// None + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/commctrl/nf-commctrl-listview_setitemindexstate void + // ListView_SetItemIndexState( hwndLV, plvii, data, mask ); [PInvokeData("commctrl.h", MSDNShortId = "listview_setitemindexstate")] public static HRESULT ListView_SetItemIndexState(HWND hwndLV, in LVITEMINDEX plvii, uint data, ListViewItemState mask) => new HRESULT(SendMessage(hwndLV, (uint)ListViewMessage.LVM_SETITEMINDEXSTATE, in plvii, new LVITEM(0) { stateMask = mask, state = data }).ToInt32()); /// - /// Contains information used when searching for a list-view item. This structure is identical to LV_FINDINFO but has been renamed to - /// fit standard naming conventions. + /// Contains information used when searching for a list-view item. This structure is identical to LV_FINDINFO but has been renamed + /// to fit standard naming conventions. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774745")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] @@ -1330,8 +1669,8 @@ namespace Vanara.PInvoke } /// - /// Contains information about a list-view notification message. This structure is the same as the NM_LISTVIEW structure but has been - /// renamed to fit standard naming conventions. + /// Contains information about a list-view notification message. This structure is the same as the NM_LISTVIEW structure but has + /// been renamed to fit standard naming conventions. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb774773")] [StructLayout(LayoutKind.Sequential)] @@ -1404,17 +1743,17 @@ namespace Vanara.PInvoke /// /// Percentage of the control's client area that the image should be offset horizontally. For example, at 0 percent, the image - /// will be displayed against the left edge of the control's client area. At 50 percent, the image will be displayed horizontally - /// centered in the control's client area. At 100 percent, the image will be displayed against the right edge of the control's - /// client area. This member is valid only when LVBKIF_STYLE_NORMAL is specified in ulFlags. If both LVBKIF_FLAG_TILEOFFSET and - /// LVBKIF_STYLE_TILE are specified in ulFlags, then the value specifies the pixel, not percentage offset, of the first tile. - /// Otherwise, the value is ignored. + /// will be displayed against the left edge of the control's client area. At 50 percent, the image will be displayed + /// horizontally centered in the control's client area. At 100 percent, the image will be displayed against the right edge of + /// the control's client area. This member is valid only when LVBKIF_STYLE_NORMAL is specified in ulFlags. If both + /// LVBKIF_FLAG_TILEOFFSET and LVBKIF_STYLE_TILE are specified in ulFlags, then the value specifies the pixel, not percentage + /// offset, of the first tile. Otherwise, the value is ignored. /// public int xOffset; /// - /// Percentage of the control's client area that the image should be offset vertically. For example, at 0 percent, the image will - /// be displayed against the top edge of the control's client area. At 50 percent, the image will be displayed vertically + /// Percentage of the control's client area that the image should be offset vertically. For example, at 0 percent, the image + /// will be displayed against the top edge of the control's client area. At 50 percent, the image will be displayed vertically /// centered in the control's client area. At 100 percent, the image will be displayed against the bottom edge of the control's /// client area. This member is valid only when LVBKIF_STYLE_NORMAL is specified in ulFlags. If both LVBKIF_FLAG_TILEOFFSET and /// LVBKIF_STYLE_TILE are specified in ulFlags, then the value specifies the pixel, not percentage offset, of the first tile. @@ -1516,8 +1855,8 @@ namespace Vanara.PInvoke /// /// If column information is being set, this member is the address of a null-terminated string that contains the column header - /// text. If the structure is receiving information about a column, this member specifies the address of the buffer that receives - /// the column header text. + /// text. If the structure is receiving information about a column, this member specifies the address of the buffer that + /// receives the column header text. /// public StrPtrAuto pszText; @@ -1647,26 +1986,26 @@ namespace Vanara.PInvoke public ListViewGroupMask mask; /// - /// Pointer to a null-terminated string that contains the header text when item information is being set. If group information is - /// being retrieved, this member specifies the address of the buffer that receives the header text. + /// Pointer to a null-terminated string that contains the header text when item information is being set. If group information + /// is being retrieved, this member specifies the address of the buffer that receives the header text. /// public StrPtrAuto pszHeader; /// - /// Size in TCHARs of the buffer pointed to by the pszHeader member. If the structure is not receiving information about a group, - /// this member is ignored. + /// Size in TCHARs of the buffer pointed to by the pszHeader member. If the structure is not receiving information about a + /// group, this member is ignored. /// public uint cchHeader; /// - /// Pointer to a null-terminated string that contains the footer text when item information is being set. If group information is - /// being retrieved, this member specifies the address of the buffer that receives the footer text. + /// Pointer to a null-terminated string that contains the footer text when item information is being set. If group information + /// is being retrieved, this member specifies the address of the buffer that receives the footer text. /// public StrPtrAuto pszFooter; /// - /// Size in TCHARs of the buffer pointed to by the pszFooter member. If the structure is not receiving information about a group, - /// this member is ignored. + /// Size in TCHARs of the buffer pointed to by the pszFooter member. If the structure is not receiving information about a + /// group, this member is ignored. /// public uint cchFooter; @@ -1942,10 +2281,10 @@ namespace Vanara.PInvoke /// Indicates the item's state, state image, and overlay image. The stateMask member indicates the valid bits of this member. /// Bits 0 through 7 of this member contain the item state flags. This can be one or more of the item state values. /// - /// Bits 8 through 11 of this member specify the one-based overlay image index. Both the full-sized icon image list and the small - /// icon image list can have overlay images. The overlay image is superimposed over the item's icon image. If these bits are - /// zero, the item has no overlay image. To isolate these bits, use the LVIS_OVERLAYMASK mask. To set the overlay image index in - /// this member, you should use the INDEXTOOVERLAYMASK macro. The image list's overlay images are set with the + /// Bits 8 through 11 of this member specify the one-based overlay image index. Both the full-sized icon image list and the + /// small icon image list can have overlay images. The overlay image is superimposed over the item's icon image. If these bits + /// are zero, the item has no overlay image. To isolate these bits, use the LVIS_OVERLAYMASK mask. To set the overlay image + /// index in this member, you should use the INDEXTOOVERLAYMASK macro. The image list's overlay images are set with the /// ImageList_SetOverlayImage function. /// /// @@ -1962,9 +2301,9 @@ namespace Vanara.PInvoke /// Value specifying which bits of the state member will be retrieved or modified. For example, setting this member to /// LVIS_SELECTED will cause only the item's selection state to be retrieved. /// - /// This member allows you to modify one or more item states without having to retrieve all of the item states first.For example, - /// setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but none of the - /// other states will be affected. + /// This member allows you to modify one or more item states without having to retrieve all of the item states first.For + /// example, setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but + /// none of the other states will be affected. /// /// To retrieve or modify all of the states, set this member to(UINT)-1. /// You can use the macro ListView_SetItemState both to set and to clear bits. @@ -1981,7 +2320,8 @@ namespace Vanara.PInvoke /// /// /// If the value of pszText is LPSTR_TEXTCALLBACK, the item is a callback item.If the callback text changes, you must explicitly - /// set pszText to LPSTR_TEXTCALLBACK and notify the list-view control of the change by sending an LVM_SETITEM or LVM_SETITEMTEXT message. + /// set pszText to LPSTR_TEXTCALLBACK and notify the list-view control of the change by sending an LVM_SETITEM or + /// LVM_SETITEMTEXT message. /// /// /// Do not set pszText to LPSTR_TEXTCALLBACK if the list-view control has the LVS_SORTASCENDING or LVS_SORTDESCENDING style. @@ -2017,8 +2357,8 @@ namespace Vanara.PInvoke /// /// Version 4.70. Number of image widths to indent the item. A single indentation equals the width of an item image. Therefore, - /// the value 1 indents the item by the width of one image, the value 2 indents by two images, and so on. Note that this field is - /// supported only for items. Attempting to set subitem indentation will cause the calling function to fail. + /// the value 1 indents the item by the width of one image, the value 2 indents by two images, and so on. Note that this field + /// is supported only for items. Attempting to set subitem indentation will cause the calling function to fail. /// public int iIndent; @@ -2031,7 +2371,8 @@ namespace Vanara.PInvoke /// /// Version 6.0 Number of data columns (subitems) to display for this item in tile view. The maximum value is 20. If this value - /// is I_COLUMNSCALLBACK, the size of the column array and the array itself (puColumns) are obtained by sending a LVN_GETDISPINFO notification. + /// is I_COLUMNSCALLBACK, the size of the column array and the array itself (puColumns) are obtained by sending a + /// LVN_GETDISPINFO notification. /// public uint cColumns; diff --git a/PInvoke/ComCtl32/CommCtrl.TreeView.cs b/PInvoke/ComCtl32/CommCtrl.TreeView.cs index da922aff..076c60e4 100644 --- a/PInvoke/ComCtl32/CommCtrl.TreeView.cs +++ b/PInvoke/ComCtl32/CommCtrl.TreeView.cs @@ -9,7 +9,10 @@ namespace Vanara.PInvoke { public static partial class ComCtl32 { + /// public const int I_CHILDRENAUTO = -2; + + /// public const int I_CHILDRENCALLBACK = -1; /// TreeView's custom draw return meaning don't draw images. valid on CDRF_NOTIFYITEMPREPAINT @@ -326,9 +329,13 @@ namespace Vanara.PInvoke TVIS_EX_HWND = 0x0004, } + /// + /// Tree View Messages + /// [PInvokeData("Commctrl.h", MSDNShortId = "ff486106")] public enum TreeViewMessage { +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member TVM_DELETEITEM = TV_FIRST + 1, TVM_EXPAND = TV_FIRST + 2, TVM_GETITEMRECT = TV_FIRST + 4, @@ -380,11 +387,14 @@ namespace Vanara.PInvoke TVM_GETSELECTEDCOUNT = TV_FIRST + 70, TVM_SHOWINFOTIP = TV_FIRST + 71, TVM_GETITEMPARTRECT = TV_FIRST + 72, +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } + /// Tree View Notifications [PInvokeData("Commctrl.h", MSDNShortId = "ff486107")] public enum TreeViewNotification { +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member TVN_ASYNCDRAW = TVN_FIRST - 20, TVN_BEGINDRAG = TVN_FIRST - 56, TVN_BEGINLABELEDIT = TVN_FIRST - 59, @@ -402,6 +412,7 @@ namespace Vanara.PInvoke TVN_SELCHANGING = TVN_FIRST - 50, TVN_SETDISPINFO = TVN_FIRST - 53, TVN_SINGLEEXPAND = TVN_FIRST - 15, +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } /// Used as return values to the TVN_SINGLEEXPAND notification. @@ -652,7 +663,7 @@ namespace Vanara.PInvoke public static bool operator ==(HTREEITEM h1, HTREEITEM h2) => h1.Equals(h2); /// - public override bool Equals(object obj) => obj is HTREEITEM h ? handle == h.handle : false; + public override bool Equals(object obj) => obj is HTREEITEM h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode();