QListCtrlPpg.cpp
上传用户:cnjubao
上传日期:2007-01-02
资源大小:34k
文件大小:5k
源码类别:
ListView/ListBox
开发平台:
Visual C++
- /************************************
- REVISION LOG ENTRY
- Revision By: Mihai Filimon
- Revised on 11/2/98 21:20:30
- Comments: QListCtrlPpg.cpp : Implementation of the CQListCtrlPropPage property page class.
- ************************************/
- #include "stdafx.h"
- #include "QListCtrl.h"
- #include "QListCtrlPpg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- IMPLEMENT_DYNCREATE(CQListCtrlPropPage, COlePropertyPage)
- /////////////////////////////////////////////////////////////////////////////
- // Message map
- BEGIN_MESSAGE_MAP(CQListCtrlPropPage, COlePropertyPage)
- //{{AFX_MSG_MAP(CQListCtrlPropPage)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // Initialize class factory and guid
- IMPLEMENT_OLECREATE_EX(CQListCtrlPropPage, "QLISTCTRL.QListCtrlPropPage.1",
- 0xbfcc1bc7, 0x7257, 0x11d2, 0x86, 0xe6, 0, 0x40, 0x5, 0x5c, 0x8, 0xd9)
- /////////////////////////////////////////////////////////////////////////////
- // CQListCtrlPropPage::CQListCtrlPropPageFactory::UpdateRegistry -
- // Adds or removes system registry entries for CQListCtrlPropPage
- BOOL CQListCtrlPropPage::CQListCtrlPropPageFactory::UpdateRegistry(BOOL bRegister)
- {
- if (bRegister)
- return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
- m_clsid, IDS_QLISTCTRL_PPG);
- else
- return AfxOleUnregisterClass(m_clsid, NULL);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CQListCtrlPropPage::CQListCtrlPropPage - Constructor
- #define sC _separatorColumnHeader
- #define sH _separatorHeader
- static const CString defaultText = CString(_T("<... "Col1")) + sH + _T("Hght1") + sH + _T("Just1") + sC + _T(" ... ") + sC + _T("ColN") + sH + _T("HghtN") + sH + _T("JustN" ...>");
- CQListCtrlPropPage::CQListCtrlPropPage() :
- COlePropertyPage(IDD, IDS_QLISTCTRL_PPG_CAPTION),m_labelHeader(defaultText)
- {
- //{{AFX_DATA_INIT(CQListCtrlPropPage)
- m_bGridLines = FALSE;
- m_bMultiSelect = FALSE;
- m_bNoHeader = FALSE;
- m_bSColumn = FALSE;
- //}}AFX_DATA_INIT
- }
- /////////////////////////////////////////////////////////////////////////////
- // CQListCtrlPropPage::DoDataExchange - Moves data between page and properties
- void CQListCtrlPropPage::DoDataExchange(CDataExchange* pDX)
- {
- //{{AFX_DATA_MAP(CQListCtrlPropPage)
- DDP_Check(pDX, IDC_CHECK_GRIDLINES, m_bGridLines, _T("GridLines") );
- DDX_Check(pDX, IDC_CHECK_GRIDLINES, m_bGridLines);
- DDP_Check(pDX, IDC_CHECK_MULTISELECT, m_bMultiSelect, _T("MultiSelect") );
- DDX_Check(pDX, IDC_CHECK_MULTISELECT, m_bMultiSelect);
- DDP_Check(pDX, IDC_CHECK_NOHEADER, m_bNoHeader, _T("NoHeader") );
- DDX_Check(pDX, IDC_CHECK_NOHEADER, m_bNoHeader);
- DDP_Check(pDX, IDC_CHECK_SCOLUMN, m_bSColumn, _T("SColumn"));
- DDX_Check(pDX, IDC_CHECK_SCOLUMN, m_bSColumn);
- //}}AFX_DATA_MAP
- DDP_PostProcessing(pDX);
- long nHeight = 0;
- if (pDX->m_bSaveAndValidate)
- {
- m_sHeader = m_labelHeader.GetText();
- m_sHeight = m_labelHeight.GetText();
- nHeight = abs(atoi(m_sHeight));
- }
- DDP_DEFINE<CString>(this, pDX->m_bSaveAndValidate, &m_sHeader, _T("Header"), VT_BSTR);
- DDP_DEFINE<long>(this, pDX->m_bSaveAndValidate, &nHeight, _T("ItemHeight"), VT_I4);
- m_sHeight.Format(_T("%i"), nHeight);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CQListCtrlPropPage message handlers
- // Function name : CQListCtrlPropPage::OnInitDialog
- // Description : Call to subclass all controls
- // Return type : BOOL
- BOOL CQListCtrlPropPage::OnInitDialog()
- {
- COlePropertyPage::OnInitDialog();
- m_labelHeader.SubclassDlgItem(IDC_CUSTOM_HEADER, this);
- m_labelHeader.SetText(m_sHeader);
- m_labelHeight.SubclassDlgItem(IDC_CUSTOM_HEIGHT, this);
- m_labelHeight.SetText(m_sHeight);
- m_labelSeparators.SubclassDlgItem(IDC_CUSTOM_SEPARATORS, this);
- CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_SEPARATORS);
- int nC = pCombo->AddString(CString(_T("Columns: '")) + _separatorColumnHeader + TCHAR('''));
- pCombo->AddString(CString(_T("Height,Justify: '")) + _separatorHeader + TCHAR('''));
- m_labelSeparators.Attach(pCombo->m_hWnd);
- CString s; pCombo->GetLBText(nC, s);
- m_labelSeparators.SetText(s);
- pCombo->SetCurSel(nC);
- return FALSE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- // Function name : CQListCtrlPropPage::WindowProc
- // Description : If something is change in one of CTEditLabels then will propage the modified flag
- // Return type : LRESULT
- // Argument : UINT message
- // Argument : WPARAM wParam
- // Argument : LPARAM lParam
- LRESULT CQListCtrlPropPage::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
- {
- if (message == WM_COMMAND)
- if (HIWORD(wParam) == EN_CHANGE)
- SetModifiedFlag();
- return COlePropertyPage::WindowProc( message, wParam, lParam );
- }