Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[91ef65]: ColumnChooserDlg.cpp Maximize Restore History

Download this file

ColumnChooserDlg.cpp    94 lines (73 with data), 2.1 kB

 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// ColumnChooserDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ColumnChooserDlg.h"
// CColumnChooserDlg dialog
IMPLEMENT_DYNAMIC(CColumnChooserDlg, CDialog)
CColumnChooserDlg::CColumnChooserDlg(CWnd* pParent /*=NULL*/)
: CDialog(CColumnChooserDlg::IDD, pParent)
{
}
CColumnChooserDlg::~CColumnChooserDlg()
{
}
void CColumnChooserDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_CPLIST, m_ccListCtrl);
}
BEGIN_MESSAGE_MAP(CColumnChooserDlg, CDialog)
//{{AFX_MSG_MAP(CColumnChooserDlg)
ON_WM_DESTROY()
ON_WM_SHOWWINDOW()
ON_WM_SYSCOMMAND()
ON_WM_STYLECHANGED()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// CColumnChooserDlg message handlers
BOOL CColumnChooserDlg::Create(UINT nID, CWnd *parent)
{
m_pLVHdrCtrl = NULL;
return CDialog::Create(nID, parent);
}
BOOL CColumnChooserDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Initialise DropTarget
m_ccListCtrl.Initialize(&m_ccListCtrl);
return TRUE;
}
void CColumnChooserDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == SC_CLOSE)
ShowWindow(SW_HIDE);
else
CDialog::OnSysCommand(nID, lParam);
}
void CColumnChooserDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
if (m_pLVHdrCtrl != NULL && nStatus == 0)
m_pLVHdrCtrl->SetLVState(bShow);
CDialog::OnShowWindow(bShow, nStatus);
}
void CColumnChooserDlg::OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
{
if ((nStyleType & GWL_STYLE) == GWL_STYLE) {
DWORD oldStyle = lpStyleStruct->styleOld & WS_VISIBLE;
DWORD newStyle = lpStyleStruct->styleNew & WS_VISIBLE;
if (oldStyle != newStyle && m_pLVHdrCtrl != NULL)
m_pLVHdrCtrl->SetLVState(newStyle != 0 ? SW_SHOW : SW_HIDE);
}
CDialog::OnStyleChanged(nStyleType, lpStyleStruct);
}
void CColumnChooserDlg::PostNcDestroy()
{
delete this;
}
void CColumnChooserDlg::OnDestroy()
{
// Delete all items
m_ccListCtrl.DeleteAllItems();
// Stop Drag & Drop OLE
m_ccListCtrl.Terminate();
}