1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#ifndef LISTCTRLFORMATTER_H
#define LISTCTRLFORMATTER_H
#include <string>
/*! \brief Helper to setup ListCtrl columns format.
*/
class ListCtrlFormatter
{
public:
/*!
* Constructor.
* \param list List control to setup.
*/
ListCtrlFormatter( CListCtrl &list );
/*!
* Destructeur.
*/
virtual ~ListCtrlFormatter();
/*! Adds a column to the list control.
* \param strHeading Column title.
* \param nWidth Column width in pixel. (-1 if not defined).
* \param nFormat Text alignment (LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_CENTER).
* \param nSubItemNo Index of the sub-item associates to the column.
*/
void AddColumn( const std::string &strHeading,
int nWidth =-1,
int nFormat = LVCFMT_LEFT,
int nSubItemNo =-1 );
/*! Adds a column to the list control.
* \param strHeading Column title.
* \param nWidth Column width in pixel. (-1 if not defined).
* \param nFormat Text alignment (LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_CENTER).
* \param nSubItemNo Index of the sub-item associates to the column.
*/
void AddColumn( CString strHeading,
int nWidth =-1,
int nFormat = LVCFMT_LEFT,
int nSubItemNo =-1 );
/*! Adds a column to the list control.
* \param nIdStringHeading Resource ID of the column title string (IDS_xxx).
* \param nWidth Column width in pixel. (-1 if not defined).
* \param nFormat Text alignment (LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_CENTER).
* \param nSubItemNo Index of the sub-item associates to the column.
*/
void AddColumn( UINT nIdStringHeading,
int nWidth =-1,
int nFormat = LVCFMT_LEFT,
int nSubItemNo =-1 );
/*! Gets the sub item index of the next column.
* \return Sub item index of the next column, starting with 0.
*/
int GetNextColumnIndex() const;
private:
/*! Associated list control.
*/
CListCtrl &m_List;
/*! Next column number.
*/
int m_nColNo;
};
#endif //WILLISTCTRLFORMATTER_H
|