13#if !defined(OWL_LISTVIEWCTRL_H)
14#define OWL_LISTVIEWCTRL_H
16#if defined(BI_HAS_PRAGMA_ONCE)
58 auto SetWrap(
bool wrap =
true) -> void;
59 auto SetData(LPARAM param) -> void;
77 :
public LVHITTESTINFO
105 { *
static_cast<LVHITTESTINFO*
>(
this) = info; }
155 { pt.x = p.x; pt.y = p.y; }
165 iItem = iSubItem = iGroup = -1;
213 explicit TLvItem(
uint mask_ = lvifAll,
bool allocTextBuffer =
true,
int bufferSize = 1000);
223 auto operator =(
const LVITEM& item) ->
TLvItem&;
230 auto GetText() const -> LPCTSTR;
231 auto GetText(LPTSTR buffer,
size_t bufferSize) const ->
void;
232 auto SetTextBuffer(LPTSTR buffer,
int bufferSize) ->
void;
233 auto SetText(const
tstring& text) ->
void;
239 auto GetIndex() const ->
int;
240 auto SetIndex(
int index) ->
void;
246 auto GetSubItem() const ->
int;
247 auto SetSubItem(
int subitemIndex) ->
void;
253 auto GetItemData() const -> LPARAM;
254 auto SetItemData(LPARAM param) ->
void;
260 auto GetImageIndex() const ->
int;
261 auto SetImageIndex(
int image) ->
void;
267 auto GetState() const ->
int;
268 auto SetState(TListState state) ->
void;
274 auto GetStateImage() const ->
int;
275 auto SetStateImage(
int stateIndex) ->
void;
281 auto GetIndent() const ->
int;
282 auto SetIndent(
int indent) ->
void;
329 explicit TLvColumn(
uint mask_ = lvcfAll,
int subitemIndex = 0,
int bufferSize = 1000);
330 TLvColumn(
const tstring& text,
int width, TFormat how = Left,
int subitemIndex = 0);
339 auto operator =(
const LVCOLUMN& column) ->
TLvColumn&;
346 auto SetTextBuffer(LPTSTR buffer,
int bufferSize) -> void;
347 auto SetText(
const tstring& text) -> void;
348 auto SetFormat(TFormat how) -> void;
349 auto SetWidth(
int width,
const tstring& text =
tstring()) -> void;
350 auto SetSubItem(
int subitemIndex) -> void;
356 auto GetText() const -> LPCTSTR;
357 auto GetFormat() const -> TFormat;
358 auto GetWidth() const ->
int;
359 auto GetSubItem() const ->
int;
365 auto GetImage() const ->
int;
366 auto SetImage(
int image) ->
void;
367 auto GetOrder() const ->
int;
368 auto SetOrder(
int order) ->
void;
390 : public LVTILEVIEWINFO
421 auto SetTileSize(
const TSize& size) -> void;
422 auto SetSizeAutomatic() -> void;
423 auto SetSizeFixed(
const TSize& size, TTileSize fixedSize) -> void;
424 auto SetMaxTextLines(
int lines) -> void;
425 auto RemoveMaxTextLines() -> void;
426 auto SetLabelMargin(
const TRect& labelMargin) -> void;
427 auto RemoveLabelMargin() -> void;
439 {
return dwFlags == LVTVIF_AUTOSIZE; }
447 {
return dwFlags ==
static_cast<DWORD
>(
FixedWidth); }
455 {
return dwFlags ==
static_cast<DWORD
>(
FixedHeight); }
463 {
return dwFlags ==
static_cast<DWORD
>(
FixedSize); }
475 {
return rcLabelMargin; }
503 :
public LVFOOTERINFO
515 { memset(
static_cast<LVFOOTERINFO*
>(
this), 0,
sizeof(LVFOOTERINFO)); }
523 { *
static_cast<LVFOOTERINFO*
>(
this) = info; }
537 :
public LVFOOTERITEM
558 { memset(
static_cast<LVFOOTERITEM*
>(
this), 0,
sizeof(LVFOOTERITEM)); }
566 { *
static_cast<LVFOOTERITEM*
>(
this) = item; }
704 virtual int Compare(LPARAM item1, LPARAM item2, LPARAM lParam)
const = 0;
729 auto GetItem(
TLvItem& item,
int index = -1,
int subitemIndex = -1) const ->
bool;
730 auto
GetItem(
int index = -1,
int subitemIndex = -1) const ->
TLvItem;
731 auto
SetItem(const
TLvItem& item,
int index = -1,
int subitemIndex = -1) ->
bool;
744 auto
GetItemText(
int index,
int subitemIndex, LPTSTR buffer,
int bufferSize) const ->
int;
747 auto
SetItemText(
int index,
int subitemIndex, LPCTSTR text) ->
bool;
781 auto
GetSelStrings(
tchar** strs,
int maxCount,
int maxChars,
int subitemIndex = 0) const ->
int;
782 auto
SetSel(
int index,
bool select) ->
bool;
783 auto
SetSelIndexes(
int* indexes,
int numSelections,
bool select) ->
bool;
822 auto
Update(
int index) ->
bool;
825 auto
Scroll(
int dx,
int dy) ->
bool;
834 auto
RedrawItems(
int startIndex,
int endIndex) ->
bool;
838 auto
SetFocusItem(
int index,
bool focused = true) ->
bool;
852 auto GetColumnOrder(
int count,
int* array)
const -> bool;
853 auto SetColumnOrder(
int count,
const int* array) -> bool;
854 auto GetExtStyle() const ->
uint32;
856 auto GetHeaderCtrl() const -> HWND;
857 auto GetHotCursor() const -> HCURSOR;
858 auto SetHotCursor(HCURSOR cur) -> HCURSOR;
859 auto GetHotItem() const ->
int;
860 auto SetHotItem(
int index) ->
int;
861 auto GetSubItemRect(
TRect& rect,
int subitemIndex = 0,
int index = 0, TItemRectType type = Bounds) const ->
bool;
864 auto GetItemSpacing(
bool smallIcon) const ->
TSize;
865 auto SetIconSpacing(
int x,
int y) ->
TSize;
885 auto GetBkImage(
TLvBkImage& bkimg)
const -> bool;
886 auto SetBkImage(
const TLvBkImage& bkimg) -> bool;
887 auto GetHoverTime() const ->
uint32;
889 auto GetNumOfWorkAreas() const ->
uint;
890 auto GetWorkAreas(
int count,
TRect* areas) const ->
void;
891 auto SetWorkAreas(
int count,
TRect* areas) ->
void;
892 auto GetSelectionMark() const ->
int;
893 auto SetSelectionMark(
int index) ->
int;
899 auto GetItemIndexRect(
int index,
int group,
int subitemIndex,
TRect& rect, TItemRectType type) const ->
bool;
900 auto GetNextItemIndex(
int index,
int group,
uint flags = TNextItemCode::All) const ->
int;
901 auto SetItemIndexState(const
TLvItem& item,
int index,
int group) ->
bool;
902 auto GetEmptyText() const ->
tstring;
904 auto GetFooterItems() const ->
int;
905 auto GetFooterItem(
int index,
TLvFooterItem& item) const ->
bool;
906 auto GetFooterItemText(
int index) const -> std::wstring;
908 auto GetFooterItemRect(
int index,
TRect& rect) const ->
bool;
909 auto GetFooterItemRect(
int index) const ->
TRect;
910 auto GetFooterRect(
TRect& rect) const ->
bool;
911 auto GetFooterRect() const ->
TRect;
912 auto GetGroupInfo(
int groupId,
uint mask = 0xFFFFFFFF) -> LVGROUP;
918 auto GetUnicodeFormat() const ->
bool;
919 auto SetUnicodeFormat(
bool useUnicode = true) ->
bool;
939 auto
SetInfoTip(LPCWSTR text,
int index,
int subitemIndex = 0) ->
bool;
940 auto
SetInfoTip(LPCSTR text,
int index,
int subitemIndex = 0) ->
bool;
954 auto
GetTileInfo(PLVTILEINFO lvTileInfo) const ->
void;
955 auto
GetTileInfo(LVTILEINFO& lvTileInfo) const ->
void;
970#if defined(OWL5_COMPAT)
974 auto GetColumn(
int index, LVCOLUMN* column)
const -> bool;
977 auto DeleteAnItem(
int index) ->
bool {
return DeleteItem(index); }
978 auto FindItem(
int index,
const TLvFindInfo* findInfo)
const -> int;
Class wrapper for management of color values.
TControl(TWindow *parent, int id, LPCTSTR title, int x, int y, int w, int h, TModule *module=nullptr)
Invokes TWindow's constructor, passing it parent (parent window), title (caption text),...
virtual void DeleteItem(DELETEITEMSTRUCT &deleteInfo)
Function called when a WM_DELETEITEM is sent to parent on our behalf.
Pure virtual base class for comparing sort items.
virtual int Compare(LPARAM item1, LPARAM item2, LPARAM lParam) const =0
Performs a comparison of two items.
Encapsulates the ListView control, a window that displays a collection of items, each item consisting...
auto GetNextItem(int index, uint flags=TNextItemCode::All) const -> int
Searches for a list-view item that has the specified properties and bears the specified relationship ...
auto EditLabel(int index) -> HWND
Begins in-place editing of the list-view item's text.
auto DeleteAllItems() -> bool
Deletes all items from the list.
auto GetFocusItem() -> int
Retrieves the item index of the item that has the focus.
auto GetTopIndex() const -> int
Retrieves the topmost visible item index when in list or report view.
auto GetNextSelIndex(int index=-1) const -> int
Searches for the next selected item after a given index.
auto SetSelIndexes(int *indexes, int numSelections, bool select) -> bool
Selects or deselects items.
auto CalculateColumnWidth(LPCTSTR text, int padding=12) const -> int
Calculates a suitable column pixel width for the given string.
auto DeleteItem(int index) -> bool
Deletes an item from the list.
auto GetApproxRect(int x=-1, int y=-1, int count=-1) const -> TSize
Calculates the approximate width and height required to display a given number of items.
auto IsItemVisible(int index) const -> bool
Queries whether an item is visible.
auto GetSelIndexes(int *indexes, int maxCount) const -> int
Retrieves the indexes of the selected items.
auto GetViewRect(TRect &rect) const -> bool
Retrieves the bounding rectangle of all items in the list-view control when in icon or small icon vie...
auto ResetIconSpacing() -> TSize
Resets the icon spacing to the default spacing.
auto GetISearchString() const -> tstring
Retrieves the incremental search string.
auto GetCountPerPage() const -> int
Calculates the number of items that can fit vertically in the visible area of a list-view control whe...
auto SetTileViewInfo(const TLvTileViewInfo &tileViewInfo) -> bool
Sets tile view information.
auto GetStringWidth(LPCTSTR text) const -> int
Calculates the exact width in pixels of the given string using the control's current font.
auto GetBkColor() const -> TColor
Retrieves the background color of a list-view control.
auto SetItemCount(int numItems, TSetItemCountBehavior behavior=Unspecified) -> bool
Sets the number of items that the list-view control will ultimately contain.
auto GetSelIndex() const -> int
Retrieves the selected item index.
auto GetTileViewInfo(TLvTileViewInfo &tileViewInfo) const -> void
Retrieves tile view information.
auto GetEditControl() const -> HWND
Retrieves the handle to the edit control used to edit a list-view item's text.
auto SortItemsEx(const TCompareFunc &Comparator, LPARAM lParam=0) -> bool
Sorts the list items.
auto GetItemPosition(int index, TPoint &pt) const -> bool
Retrieves the position of a list-view item.
auto AddItem(const TLvItem &item) -> int
Adds a new item to the end of the list.
auto SetItemPosition(int index, const TPoint &pt) -> bool
Sets the position of a list-view item.
auto Arrange(TArrangeCode code) -> bool
Arranges items in icon view.
TViewType
Describes the type of views.
@ SmallIcon
Small icon view.
auto GetItemCount() const -> int
Retrieves the number of items in the list-view control.
TImageListType
Describes the type of image list for use with the list window control.
@ Small
Small icons for LVS_SMALLICON.
@ Normal
Normal image list.
auto SetFocusItem(int index, bool focused=true) -> bool
Sets or removes the focus for an item.
auto GetImageList(TImageListType type) const -> HIMAGELIST
Retrieves the handle to an image list used for drawing list-view items.
auto GetSelString(tchar *str, int maxChars, int subitemIndex=0) const -> bool
Retrieves the selected item or item subitem text.
auto GetSelCount(void) const -> int
Retrieves the number of selected items.
auto SortItems(const TCompareFunc &Comparator, LPARAM lParam=0) -> bool
Sorts the list items.
auto GetItemState(int index, uint mask) const -> TLvItem::TListState
Retrieves the current state for an item.
auto FindItem(int index, const TLvFindInfo &findInfo) const -> int
Searches for an item with the specified characteristics.
auto SetColumn(int colNum, const TLvColumn &column) -> bool
Sets the attributes of a list-view control's column.
auto GetToolTips() const -> HWND
Retrieves the handle of the tooltip control that the list-view control uses to display tooltips.
auto InsertItem(const TLvItem &item, int index=-1) -> int
Inserts a new item to the list.
TSetItemCountBehavior
Describes the behavior for the control when setting the item count.
@ NoInvalidateAll
Do not repaint unless affected items are currently in view.
@ Unspecified
No behavior specified.
@ NoScroll
Do not change the scroll position.
auto SetIconSpacing(int x, int y) -> TSize
Sets the spacing between icons in list-view controls that have the LVS_ICON style.
TArrangeCode
TArrangeCode is used to describe how to arrange the items in a list window control.
@ Top
Align items to the top edge.
@ Left
Align items to the left edge.
@ SnapToGrid
Snap icons to nearest grid position.
@ Default
Use default for control style.
auto GetColumnWidth(int colNum) const -> int
Retrieves the width of a column in report or list view.
auto GetOutlineColor() const -> TColor
Retrieves the list-view control border color.
auto SetTextBkColor(const TColor &c) -> bool
Sets the background color of text in a list-view control.
TListViewCtrl(TWindow *parent, int id, int x, int y, int w, int h, TModule *module=0)
Constructor that simply passes the parameters to the parent TControl::TControl(TWindow*,...
auto HitTest(TLvHitTestInfo &) const -> int
Determines whether a list-view item is at a specified position.
auto Update(int index) -> bool
Updates a list-view item.
auto GetTileInfo(PLVTILEINFO lvTileInfo) const -> void
Retrieves information about a tile in a list-view control.
auto SetTileInfo(PLVTILEINFO lvTileInfo) -> bool
Sets information about a tile in a list-view control.
auto GetTextBkColor() const -> TColor
Retrieves the text background color of a list-view control.
auto GetOrigin(TPoint &pt) const -> bool
Retrieves the current view origin for a list-view control.
auto CancelEditLabel() -> void
Cancels an item text editing operation.
auto SetItemState(int index, TLvItem::TListState state, uint mask) -> bool
Sets the current state for an item.
auto SetTextColor(const TColor &c) -> bool
Sets the color of text in a list-view control.
auto SetSel(int index, bool select) -> bool
Selects or deselects an item.
TItemRectType
Describes the type of rectangle boundaries to retrieve.
@ Bounds
Entire boundary (icon and label).
@ SelectBounds
Union of Icon+Label but no colmns.
auto SetImageList(HIMAGELIST list, TImageListType type) -> HIMAGELIST
Assigns an image list to a list-view control.
auto MapIndexToId(int index) const -> TItemId
Associates a unique identifier with an item.
auto Scroll(int dx, int dy) -> bool
Scrolls the content of a list-view control.
auto DeleteColumn(int colNum) -> bool
Deletes a column in a list-view control.
auto SetInfoTip(LPCWSTR text, int index, int subitemIndex=0) -> bool
Sets tooltip text in delayed response to the LVN_GETINFOTIP notification.
auto SetBkColor(const TColor &c) -> bool
Sets the background color of a list-view control.
auto GetView() const -> TViewType
Retrieves the view type.
auto RedrawItems(int startIndex, int endIndex) -> bool
Forces a list-view control to redraw a range of items.
auto IsSelected(int index) const -> bool
Queries if an item is selected.
auto SetSelItemRange(bool select, int first, int last) -> bool
Selects or deselects a range of items.
auto GetItemText(int index, TLvItem &item) const -> int
Retrieves the text of the item.
auto GetSelStrings(tchar **strs, int maxCount, int maxChars, int subitemIndex=0) const -> int
Retrieves the item or subitem strings of the selected items.
auto MapIdToIndex(TItemId id) const -> int
Retrieves the current index for the item with the given unique identifier.
auto SetToolTips(THandle handle) -> HWND
Sets the handle of the tooltip control that the list-view control uses to display tooltips.
auto GetColumn(int colNum, TLvColumn &column) const -> bool
Retrieves the attributes of a list-view control's column.
auto GetSelectedColumn() const -> int
Retrieves the currently selected column number.
auto GetCallBackMask() const -> TLvItem::TListState
Retrieves the callback mask for a list-view control.
auto EnsureVisible(int index, bool partialOk) -> bool
Ensures that a list-view item is either partially or entirely visible, scrolling the list-view contro...
auto SetSelectedColumn(int colNum) -> void
Sets the selected column number.
auto SetOutlineColor(const TColor &color) -> TColor
Sets the list-view control border color.
auto GetItemRect(int index, TRect &rect, TItemRectType type) const -> bool
Retrieves the bounding rectangle of a list-view item.
TParam1 TItemId
Defines the type of a unique identifier for an item.
auto InsertColumn(int colNum, const TLvColumn &column) -> int
Inserts a new column in a list-view control.
auto SetItemPosition32(int index, const TPoint &pt) -> void
Sets the position of a list-view item.
auto GetTextColor() const -> TColor
Retrieves the text color of a list-view control.
auto SetColumnWidth(int colNum, int width) -> bool
Sets the width of a column in report or list view.
auto SetView(TViewType viewType) -> bool
Sets the view type.
auto SetItemText(int index, const TLvItem &item) -> bool
Sets the text of a list-view item or subitem.
TNextItemCode
Describes the next item to retrieve from the current item.
@ SameGroupOnly
Search the current group.
@ DropHilited
Marked for drop target.
@ VisibleOrder
Search the visible order.
@ Previous
Ordered before.
@ VisibleOnly
Search the visible items.
@ Selected
Marked as selected.
@ StateMask
State flag mask combining Cut, DropHilited, Focused, and Selected.
@ Cut
Marked for cut & paste.
@ Focused
Marked as having focus.
@ DirectionMask
Directional flag mask combining Above, Below, ToLeft, and ToRight.
auto GetItem(TLvItem &item, int index=-1, int subitemIndex=-1) const -> bool
Retrieves a list-view item's attributes.
auto SetCallBackMask(TLvItem::TListState mask) -> bool
Sets the callback mask for a list-view control.
auto CreateDragImage(int index, TPoint *upLeft) -> HIMAGELIST
Creates a drag image list for an item.
auto SetItem(const TLvItem &item, int index=-1, int subitemIndex=-1) -> bool
Sets a list-view item's attributes.
Encapsulates structure LVCOLUMN, used to pass or retrieve column attributes in a TListViewCtrl.
TLvColumn(uint mask_=lvcfAll, int subitemIndex=0, int bufferSize=1000)
Constructs an empty parameter package.
TMaskFlag
Flags for setting the initialisation mask.
TFormat
TFormat is used to describe the alignment of a column in a list window.
@ Unspecified
Unspecified.
std::vector< tchar > TBuffer
Character buffer to hold text.
auto Init() -> void
Initializes member data; used by internal routines.
Encapsulates structure LVFINDINFO, used to find an item in a TListViewCtrl.
auto SetPartial(const tstring &text) -> void
Sets a string to be used for a partial search.
auto SetString(const tstring &text) -> void
Sets a string to be used for the search.
tstring Text
String used for searching.
auto SetData(LPARAM param) -> void
Sets extra application-specific information.
TLvFindInfo()
Constructs with an empty string and parameter.
auto SetSubstring(const tstring &text) -> void
Sets a string to be used for an exact search.
auto SetWrap(bool wrap=true) -> void
Sets the setting for wrap-around during a search.
Encapsulates structure LVHITTESTINFO, used to contain information about a hit test in a TListViewCtrl...
TLvHitTestInfo()
Constructs with a zero point for the hit test.
auto GetGroup() -> int
Retrieves the group index for the hit item.
auto GetFlags() -> uint
Retrieves the flags for the hit item.
TLvHitTestInfo(const LVHITTESTINFO &info)
Constructs a copy of another class instance.
auto GetSubItem() -> int
Retrieves the subitem index for the hit item.
auto GetIndex() -> int
Retrieves the hit item's index.
TLvHitTestInfo(const TPoint &p)
Constructs with a specified point for the hit test.
auto SetPoint(const TPoint &p) -> void
Sets a point for the hit test.
Encapsulates structure LVITEM, used to describe an item in a TListViewCtrl.
std::vector< tchar > TBuffer
TListState
TListState is used to describe the state of an item.
@ OverlayMask
Retrieve one-based overlay image index.
@ StateImageMask
Retrieve one-based state image index.
@ Cut
Marked for cut & paste.
@ Focus
Only one item has focus.
@ Activating
(Ver 4.71) The item is being activated in an LVN_ITEMACTIVATE notification.
@ DropHilited
Marked as drop target.
@ Unspecified
Unspecified state.
@ Selected
Marked as selected.
TLvItem(uint mask_=lvifAll, bool allocTextBuffer=true, int bufferSize=1000)
Constructs an empty parameter package.
void Init()
Initializes member data; used by internal routines.
TMaskFlag
Flags for setting the initialisation mask.
Encapsulates structure LVTILEVIEWINFO, used to pass or retrieve tile view information in a TListViewC...
TTileSize
TTileSize describes the sizing of tiles in a list view control.
@ FixedHeight
Applies a fixed height to the tiles.
@ FixedWidth
Applies a fixed width to the tiles.
@ FixedSize
Applies a fixed height and width to the tiles.
auto IsSizeFixed() const -> bool
Checks if tile view size is fixed-height and fixed-width.
TLvTileViewInfo()
Constructs an automatic-sized tile view.
auto GetLabelMargin() const -> TRect
Retrieves the specified coordinates of the label margin.
auto IsSizeAutomatic() const -> bool
Checks if tile view size is automatic.
auto IsSizeFixedHeight() const -> bool
Checks if tile view size is fixed-height.
auto GetMaxTextLines() const -> int
Retrieves the specified maximum number of text lines in each item label.
auto IsSizeFixedWidth() const -> bool
Checks if tile view size is fixed-width.
auto GetTileSize() const -> TSize
Retrieves the specified tile size.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
The tagSIZE struct is defined as.
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
HWND THandle
TWindow encapsulates an HWND.
Definition of classes for CommonControl encapsulation.
Object Windows Library (OWLNext Core).
WPARAM TParam1
First parameter type.
General definitions used by all ObjectWindows programs.