[r5083]: tags / V3_12 / ColumnChooserDlg.cpp Maximize Restore History

Download this file

ColumnChooserDlg.cpp    102 lines (80 with data), 2.4 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
 94
 95
 96
 97
 98
 99
100
101
/*
* Copyright (c) 2003-2008 Rony Shapiro <ronys@users.sourceforge.net>.
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
// ColumnChooserDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ColumnChooserDlg.h"
// CColumnChooserDlg dialog
IMPLEMENT_DYNAMIC(CColumnChooserDlg, CPWDialog)
CColumnChooserDlg::CColumnChooserDlg(CWnd* pParent /*=NULL*/)
: CPWDialog(CColumnChooserDlg::IDD, pParent)
{
}
CColumnChooserDlg::~CColumnChooserDlg()
{
}
void CColumnChooserDlg::DoDataExchange(CDataExchange* pDX)
{
CPWDialog::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()
{
CPWDialog::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
CPWDialog::OnSysCommand(nID, lParam);
}
void CColumnChooserDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
if (m_pLVHdrCtrl != NULL && nStatus == 0)
m_pLVHdrCtrl->SetLVState(bShow);
CPWDialog::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();
}