OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TLvColumn Class Reference

Encapsulates structure LVCOLUMN, used to pass or retrieve column attributes in a TListViewCtrl. More...

#include <owl/listviewctrl.h>

Inheritance diagram for owl::TLvColumn:

Public Types

enum  TFormat { Unspecified = 0 , Left = LVCFMT_LEFT , Center = LVCFMT_CENTER , Right = LVCFMT_RIGHT }
 TFormat is used to describe the alignment of a column in a list window. More...
 
enum  TMaskFlag { lvcfAll = 0xFFFFFFFF }
 Flags for setting the initialisation mask. More...
 

Public Member Functions

Constructors
 TLvColumn (uint mask_=lvcfAll, int subitemIndex=0, int bufferSize=1000)
 Constructs an empty parameter package.
 
 TLvColumn (const tstring &text, int width, TFormat how=Left, int subitemIndex=0)
 Constructs a parameter package based on the given text, width, format, and subitem.
 
 TLvColumn (const TListViewCtrl &ctl, int index, uint mask_=lvcfAll, int subitemIndex=0, int bufferSize=1000)
 Constructs a parameter package based on the column attributes of an existing control.
 
 TLvColumn (const LVCOLUMN &column)
 Constructs a parameter package from an existing parameter package.
 
 TLvColumn (const TLvColumn &column)
 Constructs a parameter package from an existing parameter package.
 
Overload operations
auto operator= (const LVCOLUMN &column) -> TLvColumn &
 Overloads the assignment operator to perform a deep copy using a separate string buffer if applicable.
 
auto operator= (const TLvColumn &column) -> TLvColumn &
 Copies the given parameter package.
 
Information changing operations
auto SetTextBuffer (TCHAR *buffer, int bufferSize) -> void
 Overrides the internal buffer and assigns an external text buffer.
 
auto SetText (const tstring &text) -> void
 Copies the given text into the internal text buffer.
 
auto SetFormat (TFormat how) -> void
 Sets the alignment format for the column.
 
auto SetWidth (int width, const tstring &text=tstring()) -> void
 Sets the width of the column.
 
auto SetSubItem (int subitemIndex) -> void
 Sets the subitem index.
 
Information retrieval operations
auto GetText () const -> LPCTSTR
 Retrieves the current text for the column.
 
auto GetFormat () const -> TFormat
 Retrieves the current alignment format for the column.
 
auto GetWidth () const -> int
 Retrieves the current width for the column.
 
auto GetSubItem () const -> int
 Retrieves the current subitem used for the column.
 
New IE 3.0 data
auto GetImage () const -> int
 Retrieves the current image index used for the column.
 
auto SetImage (int image) -> void
 Sets the image index within the image list to use.
 
auto GetOrder () const -> int
 Retrieves the current column order offset used for the column.
 
auto SetOrder (int order) -> void
 Sets the column order offset.
 

Protected Types

typedef std::vector< tcharTBuffer
 Character buffer to hold text.
 

Protected Member Functions

auto Init () -> void
 Initializes member data; used by internal routines.
 

Protected Attributes

TBuffer Buffer
 

Detailed Description

Encapsulates structure LVCOLUMN, used to pass or retrieve column attributes in a TListViewCtrl.

See also
http://msdn.microsoft.com/en-us/library/windows/desktop/bb774743.aspx

Definition at line 300 of file listviewctrl.h.

Member Typedef Documentation

◆ TBuffer

typedef std::vector<tchar> owl::TLvColumn::TBuffer
protected

Character buffer to hold text.

Definition at line 377 of file listviewctrl.h.

Member Enumeration Documentation

◆ TFormat

TFormat is used to describe the alignment of a column in a list window.

Enumerator
Unspecified 

Unspecified.

Left 

Left aligned.

Center 

Centered.

Right 

Right aligned.

Definition at line 308 of file listviewctrl.h.

◆ TMaskFlag

Flags for setting the initialisation mask.

See also
TLvColumn::TLvColumn, LVCOLUMN::mask, https://msdn.microsoft.com/en-us/library/windows/desktop/bb774743.aspx
Enumerator
lvcfAll 

Definition at line 320 of file listviewctrl.h.

Constructor & Destructor Documentation

◆ TLvColumn() [1/5]

owl::TLvColumn::TLvColumn ( uint mask_ = lvcfAll,
int subitemIndex = 0,
int bufferSize = 1000 )
explicit

Constructs an empty parameter package.

This constructor is typically used to retrieve information about an existing column. For example,

bool success = ListWnd.GetColumn(1, col);
if (success && col.GetText()) ShowString(col.GetText());
Encapsulates structure LVCOLUMN, used to pass or retrieve column attributes in a TListViewCtrl.
Parameters
[in]mask_is the mask to use.
[in]subitemIndexis the subitem index to use.
[in]bufferSizeis the size of the text characters to allocate and use, provided the mask includes LVCF_TEXT.

Definition at line 565 of file listviewctrl.cpp.

References Buffer, CHECK, Init(), SetSubItem(), and SetTextBuffer().

◆ TLvColumn() [2/5]

owl::TLvColumn::TLvColumn ( const tstring & text,
int width,
TFormat how = Left,
int subitemIndex = 0 )

Constructs a parameter package based on the given text, width, format, and subitem.

Parameters
[in]textis the string to use.
[in]widthis the pixel width to use the column; if 0, a width will be calculated by SetWidth.
[in]howspecifies the formatting to use for the string.
[in]subitemIndexis the subitem index to use.

Definition at line 586 of file listviewctrl.cpp.

References Init(), SetFormat(), SetSubItem(), SetText(), and SetWidth().

◆ TLvColumn() [3/5]

owl::TLvColumn::TLvColumn ( const TListViewCtrl & ctl,
int index,
uint mask_ = lvcfAll,
int subitemIndex = 0,
int bufferSize = 1000 )

Constructs a parameter package based on the column attributes of an existing control.

Parameters
[in]ctlis an existing list-view control from which to copy.
[in]indexis the item index of the existing list-view control to use for copying.
[in]mask_is the mask to use for copying.
[in]subitemIndexis the subitem index to use.
[in]bufferSizeis the size of the text characters to allocate and use, provided the mask includes LVCF_TEXT.

Definition at line 604 of file listviewctrl.cpp.

References Buffer, CHECK, Init(), PRECONDITION, SetSubItem(), and SetTextBuffer().

◆ TLvColumn() [4/5]

owl::TLvColumn::TLvColumn ( const LVCOLUMN & column)

Constructs a parameter package from an existing parameter package.

A deep copy is performed; see the assignment operator for const LVCOLUMN& for details.

Parameters
[in]columnis an existing list-view column class from which to copy.

Definition at line 626 of file listviewctrl.cpp.

◆ TLvColumn() [5/5]

owl::TLvColumn::TLvColumn ( const TLvColumn & column)

Constructs a parameter package from an existing parameter package.

A deep copy is performed; see the copy assignment operator for details.

Parameters
[in]columnis an existing list-view column class from which to copy.

Definition at line 638 of file listviewctrl.cpp.

Member Function Documentation

◆ GetFormat()

auto owl::TLvColumn::GetFormat ( ) const -> TFormat

Retrieves the current alignment format for the column.

Returns
the alignment format.

Definition at line 778 of file listviewctrl.cpp.

References Unspecified.

◆ GetImage()

auto owl::TLvColumn::GetImage ( ) const -> int

Retrieves the current image index used for the column.

Returns
the image index, or -1 if not used.

Definition at line 811 of file listviewctrl.cpp.

◆ GetOrder()

auto owl::TLvColumn::GetOrder ( ) const -> int

Retrieves the current column order offset used for the column.

Returns
the column order offset, or -1 if not used.

Definition at line 836 of file listviewctrl.cpp.

◆ GetSubItem()

auto owl::TLvColumn::GetSubItem ( ) const -> int

Retrieves the current subitem used for the column.

Returns
the subitem index, or -1 if not used.

Definition at line 800 of file listviewctrl.cpp.

◆ GetText()

auto owl::TLvColumn::GetText ( ) const -> LPCTSTR

Retrieves the current text for the column.

Returns
a pointer to the text which will be nullptr if not used.

Definition at line 767 of file listviewctrl.cpp.

◆ GetWidth()

auto owl::TLvColumn::GetWidth ( ) const -> int

Retrieves the current width for the column.

Returns
the pixel width, or -1 if not used.

Definition at line 789 of file listviewctrl.cpp.

◆ Init()

auto owl::TLvColumn::Init ( ) -> void
protected

Initializes member data; used by internal routines.

Returns
none.

Definition at line 861 of file listviewctrl.cpp.

◆ operator=() [1/2]

auto owl::TLvColumn::operator= ( const LVCOLUMN & column) -> TLvColumn&

Overloads the assignment operator to perform a deep copy using a separate string buffer if applicable.

Parameters
[in]columnis an existing list-view column class from which to copy.

Definition at line 649 of file listviewctrl.cpp.

◆ operator=() [2/2]

auto owl::TLvColumn::operator= ( const TLvColumn & column) -> TLvColumn&

Copies the given parameter package.

A deep copy is performed; see the assignment operator for const LVCOLUMN& for details.

Definition at line 663 of file listviewctrl.cpp.

◆ SetFormat()

auto owl::TLvColumn::SetFormat ( TFormat how) -> void

Sets the alignment format for the column.

Parameters
[in]howspecifies the formatting to use for the string.
Returns
none.

Definition at line 719 of file listviewctrl.cpp.

◆ SetImage()

auto owl::TLvColumn::SetImage ( int image) -> void

Sets the image index within the image list to use.

Parameters
[in]imageis the image index to use.
Returns
none.

Definition at line 824 of file listviewctrl.cpp.

◆ SetOrder()

auto owl::TLvColumn::SetOrder ( int order) -> void

Sets the column order offset.

Parameters
[in]orderis the zero-based left-to-right column offset to use.
Returns
none.

Definition at line 849 of file listviewctrl.cpp.

◆ SetSubItem()

auto owl::TLvColumn::SetSubItem ( int subitemIndex) -> void

Sets the subitem index.

Parameters
[in]subitemIndexis the subitem index to use.
Returns
none.

Definition at line 755 of file listviewctrl.cpp.

◆ SetText()

auto owl::TLvColumn::SetText ( const tstring & text) -> void

Copies the given text into the internal text buffer.

Sets the pszText and cchTextMax members of LVCOLUMN, and enables the LVCF_TEXT flag.

Note
If the string is larger than what can be represented by the class, i.e. INT_MAX, then a TXOwl exception is thrown.
Parameters
[in]textis the string to copy.
Returns
none.

Definition at line 701 of file listviewctrl.cpp.

References _T.

◆ SetTextBuffer()

auto owl::TLvColumn::SetTextBuffer ( TCHAR * buffer,
int bufferSize ) -> void

Overrides the internal buffer and assigns an external text buffer.

Sets the pszText and cchTextMax members of LVCOLUMN, and enables the LVCF_TEXT flag.

Note
This function does not copy the text!
Parameters
[in]bufferpointer to a text string buffer to use.
[in]bufferSizespecifies the size of the text string buffer.
Returns
none.

Definition at line 681 of file listviewctrl.cpp.

◆ SetWidth()

auto owl::TLvColumn::SetWidth ( int width,
const tstring & text = tstring() ) -> void

Sets the width of the column.

Parameters
[in]widthis the pixel width to use the column; if 0, a width will be calculated by using the default GUI system font for the string.
[in]textis the string to use for calculating a width when width is 0.
Returns
none.
See also
TListViewCtrl::GetStringWidth(const tstring&) const
TListViewCtrl::CalculateColumnWidth(const tstring&, int padding) const

Definition at line 741 of file listviewctrl.cpp.

References owl::TFont::GetTextExtent(), and owl::TDefaultGuiFont::sfiIcon.

Member Data Documentation

◆ Buffer

TBuffer owl::TLvColumn::Buffer
protected

Definition at line 378 of file listviewctrl.h.


The documentation for this class was generated from the following files: