4 * @brief Declaration file for CDirColsDlg
6 * @date Created: 2003-08-19
8 // ID line follows -- this is updated by SVN
12 #if !defined(AFX_DIRCOLSDLG_H__2FCB576C_C609_4623_8C55_F3870F22CA0B__INCLUDED_)
13 #define AFX_DIRCOLSDLG_H__2FCB576C_C609_4623_8C55_F3870F22CA0B__INCLUDED_
17 /////////////////////////////////////////////////////////////////////////////
21 * @brief A Dialog for choosing visible folder compare columns.
22 * This class implements a dialog for choosing visible columns in folder
23 * compare. Columns can be also re-ordered. There is one listview component
24 * which lists all available columns. Every column name has a checkbox with
25 * it. If the checkbox is checked, the column is visible.
27 * @note: Due to how columns handling code is implemented, hidden columns
28 * must be always be last in the list with order number -1.
29 * @todo: Allow hidden columns between visible columns.
31 class CDirColsDlg : public CDialog
35 /** @brief One column's information. */
38 CString name; /**< Column name */
39 CString desc; /**< Description for column */
40 int log_col; /**< Logical (shown) order number */
41 int phy_col; /**< Physical (in memory) order number */
42 column() : log_col(-1), phy_col(-1) { } /**< default constructor for use in CArray */
43 column(LPCTSTR sz, LPCTSTR dsc, int log, int phy) : name(sz), desc(dsc), log_col(log), phy_col(phy) { }
45 typedef CArray<column, column> ColumnArray;
49 CDirColsDlg(CWnd* pParent = NULL); // standard constructor
50 void AddColumn(CString name, CString desc, int log, int phy=-1)
51 { column c(name, desc, log, phy); m_cols.Add(c); }
52 void AddDefColumn(CString name, int log, int phy=-1)
53 { column c(name, _T(""), log, phy); m_defCols.Add(c); }
54 const ColumnArray & GetColumns() const { return m_cols; }
57 //{{AFX_DATA(CDirColsDlg)
58 enum { IDD = IDD_DIRCOLS };
59 CListCtrl m_listColumns;
65 // ClassWizard generated virtual function overrides
66 //{{AFX_VIRTUAL(CDirColsDlg)
68 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
71 // Implementation methods
76 void SortArrayToLogicalOrder();
77 void MoveItem(int index, int newIndex);
78 void MoveSelectedItems(BOOL bUp);
80 static int cmpcols(const void * el1, const void * el2);
82 // Implementation data
84 ColumnArray m_cols; /**< Column list. */
85 ColumnArray m_defCols; /**< Default columns. */
87 // Generated message map functions
88 //{{AFX_MSG(CDirColsDlg)
89 virtual BOOL OnInitDialog();
91 afx_msg void OnDown();
93 afx_msg void OnDefaults();
97 afx_msg void OnLvnItemchangedColdlgList(NMHDR *pNMHDR, LRESULT *pResult);
100 //{{AFX_INSERT_LOCATION}}
101 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
103 #endif // !defined(AFX_DIRCOLSDLG_H__2FCB576C_C609_4623_8C55_F3870F22CA0B__INCLUDED_)