OSDN Git Service

PATCH: [ 987122 ] Horizontal scroll for dirview columns dialog listboxes
[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         struct column {
29                 CString name;
30                 CString desc;
31                 int log_col;
32                 int phy_col;
33                 column() : log_col(-1), phy_col(-1) { } /**< default constructor for use in CArray */
34                 column(LPCTSTR sz, LPCTSTR dsc, int log, int phy) : name(sz), desc(dsc), log_col(log), phy_col(phy) { } 
35         };
36         typedef CArray<column, column> ColumnArray;
37
38 // Construction
39 public:
40         CDirColsDlg(CWnd* pParent = NULL);   // standard constructor
41         void AddColumn(CString name, CString desc, int log, int phy=-1)
42                 { column c(name, desc, log, phy); m_cols.Add(c); }
43         void AddDefColumn(CString name, int log, int phy=-1)
44                 { column c(name, _T(""), log, phy); m_defCols.Add(c); }
45         const ColumnArray & GetColumns() const { return m_cols; }
46
47 // Dialog Data
48         //{{AFX_DATA(CDirColsDlg)
49         enum { IDD = IDD_DIRCOLS };
50         CHScrollListBox m_list_show;
51         CHScrollListBox m_list_hide;
52         BOOL            m_bReset;
53         //}}AFX_DATA
54
55
56 // Overrides
57         // ClassWizard generated virtual function overrides
58         //{{AFX_VIRTUAL(CDirColsDlg)
59         protected:
60         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
61         virtual BOOL PreTranslateMessage(MSG* pMsg);
62         //}}AFX_VIRTUAL
63
64 // Implementation methods
65 protected:
66         void LoadLists();
67         void LoadDefLists();
68         void MoveItems(CHScrollListBox * list1, CHScrollListBox * list2, bool top);
69         void UpdateEnables();
70         void SortArrayToLogicalOrder();
71         static int cmpcols(const void * el1, const void * el2);
72
73 // Implementation data
74 private:
75         ColumnArray m_cols;
76         ColumnArray m_defCols;
77         BOOL m_bFromKeyboard; /**< Is up/down movement originating from keyboard? */
78
79         // Generated message map functions
80         //{{AFX_MSG(CDirColsDlg)
81         virtual BOOL OnInitDialog();
82         afx_msg void OnUp();
83         afx_msg void OnDown();
84         afx_msg void OnAdd();
85         afx_msg void OnRemove();
86         virtual void OnOK();
87         afx_msg void OnDefaults();
88         afx_msg void OnLbnSelchangeListShow();
89         afx_msg void OnLbnSelchangeListHide();
90         //}}AFX_MSG
91         DECLARE_MESSAGE_MAP()
92 };
93
94 //{{AFX_INSERT_LOCATION}}
95 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
96
97 #endif // !defined(AFX_DIRCOLSDLG_H__2FCB576C_C609_4623_8C55_F3870F22CA0B__INCLUDED_)