OSDN Git Service

PATCH: [ 1516626 ] Enable double-click in column customization dialog
[winmerge-jp/winmerge-jp.git] / Src / DirColsDlg.h
1 /** 
2  * @file  DirColsDlg.h
3  *
4  * @brief Declaration file for CDirColsDlg
5  *
6  * @date  Created: 2003-08-19
7  */
8 // RCS ID line follows -- this is updated by CVS
9 // $Id$
10
11
12 #if !defined(AFX_DIRCOLSDLG_H__2FCB576C_C609_4623_8C55_F3870F22CA0B__INCLUDED_)
13 #define AFX_DIRCOLSDLG_H__2FCB576C_C609_4623_8C55_F3870F22CA0B__INCLUDED_
14 #pragma once
15
16 #include "HScrollListBox.h"
17
18 /////////////////////////////////////////////////////////////////////////////
19 // CDirColsDlg dialog
20
21 /**
22  * @brief Dialog to choose & order columns to be shown in dirview of differing files
23  */
24 class CDirColsDlg : public CDialog
25 {
26 // Public types
27 public:
28         /** @brief One column's information. */
29         struct column
30         {
31                 CString name; /**< Column name */
32                 CString desc; /**< Description for column */
33                 int log_col; /**< Logical (shown) order number */
34                 int phy_col; /**< Physical (in memory) order number */
35                 column() : log_col(-1), phy_col(-1) { } /**< default constructor for use in CArray */
36                 column(LPCTSTR sz, LPCTSTR dsc, int log, int phy) : name(sz), desc(dsc), log_col(log), phy_col(phy) { } 
37         };
38         typedef CArray<column, column> ColumnArray;
39
40 // Construction
41 public:
42         CDirColsDlg(CWnd* pParent = NULL);   // standard constructor
43         void AddColumn(CString name, CString desc, int log, int phy=-1)
44                 { column c(name, desc, log, phy); m_cols.Add(c); }
45         void AddDefColumn(CString name, int log, int phy=-1)
46                 { column c(name, _T(""), log, phy); m_defCols.Add(c); }
47         const ColumnArray & GetColumns() const { return m_cols; }
48
49 // Dialog Data
50         //{{AFX_DATA(CDirColsDlg)
51         enum { IDD = IDD_DIRCOLS };
52         CHScrollListBox m_list_show;
53         CHScrollListBox m_list_hide;
54         BOOL            m_bReset;
55         //}}AFX_DATA
56
57
58 // Overrides
59         // ClassWizard generated virtual function overrides
60         //{{AFX_VIRTUAL(CDirColsDlg)
61         protected:
62         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
63         virtual BOOL PreTranslateMessage(MSG* pMsg);
64         //}}AFX_VIRTUAL
65
66 // Implementation methods
67 protected:
68         void LoadLists();
69         void LoadDefLists();
70         void MoveItems(CHScrollListBox * list1, CHScrollListBox * list2, bool top);
71         void UpdateEnables();
72         void SortArrayToLogicalOrder();
73         static int cmpcols(const void * el1, const void * el2);
74
75 // Implementation data
76 private:
77         ColumnArray m_cols;
78         ColumnArray m_defCols;
79         BOOL m_bFromKeyboard; /**< Is up/down movement originating from keyboard? */
80
81         // Generated message map functions
82         //{{AFX_MSG(CDirColsDlg)
83         virtual BOOL OnInitDialog();
84         afx_msg void OnUp();
85         afx_msg void OnDown();
86         afx_msg void OnAdd();
87         afx_msg void OnRemove();
88         virtual void OnOK();
89         afx_msg void OnDefaults();
90         afx_msg void OnLbnSelchangeListShow();
91         afx_msg void OnLbnSelchangeListHide();
92         //}}AFX_MSG
93         DECLARE_MESSAGE_MAP()
94 public:
95         afx_msg void OnLbnDblclkListShow();
96         afx_msg void OnLbnDblclkListHide();
97 };
98
99 //{{AFX_INSERT_LOCATION}}
100 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
101
102 #endif // !defined(AFX_DIRCOLSDLG_H__2FCB576C_C609_4623_8C55_F3870F22CA0B__INCLUDED_)