【VC开源代码栏目提醒】:网学会员在VC开源代码频道为大家收集整理了XFLOORWNDPPG.CPP提供大家参考,希望对大家有所帮助!
/************************************
REVISION LOG ENTRY
Revision By: Mihai Filimon
Revised on 10/10/98 1:39:58 PM
Comments: XFloorWndPpg.cpp : Implementation of the CXFloorWndPropPage property page class.
************************************/
#include "stdafx.h"
#include "XFloorWnd.h"
#include "XFloorWndPpg.h"
#include "FloorPageObject.h"
#include <atlconv.h>
#include <afxconv.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CXFloorWndPropPage, COlePropertyPage)
/////////////////////////////////////////////////////////////////////////////
// Message map
BEGIN_MESSAGE_MAP(CXFloorWndPropPage, COlePropertyPage)
//{{AFX_MSG_MAP(CXFloorWndPropPage)
ON_BN_CLICKED(IDC_CHECK_ANIMATION, OnCheckAnimation)
ON_WM_HSCROLL()
ON_BN_CLICKED(IDC_CHECK_SIGN, OnCheckSign)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Initialize class factory and guid
IMPLEMENT_OLECREATE_EX(CXFloorWndPropPage, "XFLOORWND.XFloorWndPropPage.1",
0x24ffd1ee, 0x5ea9, 0x11d2, 0x86, 0xb1, 0, 0x40, 0x5, 0x5c, 0x8, 0xd9)
/////////////////////////////////////////////////////////////////////////////
// CXFloorWndPropPage::CXFloorWndPropPageFactory::UpdateRegistry -
// Adds or removes system registry entries for CXFloorWndPropPage
// Function name : CXFloorWndPropPage::CXFloorWndPropPageFactory::UpdateRegistry
// Description :
// Return type : BOOL
// Argument : BOOL bRegister
BOOL CXFloorWndPropPage::CXFloorWndPropPageFactory::UpdateRegistry(BOOL bRegister)
{
if (bRegister)
return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
m_clsid, IDS_XFLOORWND_PPG);
else
return AfxOleUnregisterClass(m_clsid, NULL);
}
/////////////////////////////////////////////////////////////////////////////
// CXFloorWndPropPage::CXFloorWndPropPage - Constructor
CXFloorWndPropPage::CXFloorWndPropPage() :
COlePropertyPage(IDD, IDS_XFLOORWND_PPG_CAPTION)
{
//{{AFX_DATA_INIT(CXFloorWndPropPage)
m_bAnimation = FALSE;
m_bSign = FALSE;
m_bAsPage = FALSE;
//}}AFX_DATA_INIT
m_nSleep = 0;
}
/////////////////////////////////////////////////////////////////////////////
// CXFloorWndPropPage::DoDataExchange - Moves data between page and properties
// Function name : CXFloorWndPropPage::DoDataExchange
// Description : Save data throw OLE controls
// Return type : void
// Argument : CDataExchange* pDX
void CXFloorWndPropPage::DoDataExchange(CDataExchange* pDX)
{
//{{AFX_DATA_MAP(CXFloorWndPropPage)
DDX_Control(pDX, IDC_STATIC_SLEEP, m_sSleep);
DDX_Control(pDX, IDC_SLIDER_ANIMATION, m_sliderAnimation);
DDX_Control(pDX, IDC_LIST_PAGES, m_listPages);
DDP_Check(pDX, IDC_CHECK_ANIMATION, m_bAnimation, _T("Animation") );
DDX_Check(pDX, IDC_CHECK_ANIMATION, m_bAnimation);
DDP_Check(pDX, IDC_CHECK_SIGN, m_bSign, _T("Sign") );
DDX_Check(pDX, IDC_CHECK_SIGN, m_bSign);
DDP_Check(pDX, IDC_CHECK_PAGE, m_bAsPage, _T("AsPage"));
DDX_Check(pDX, IDC_CHECK_PAGE, m_bAsPage);
//}}AFX_DATA_MAP
DDP_Long(pDX, &m_nSleep, _T("Sleep"));
DDP_String(pDX, &m_sPages, _T("Pages"));
DDP_PostProcessing(pDX);
UpdateMSecond();
}
// Function name : CXFloorWndPropPage::UpdateMSecond
// Description : Update all static controls, after some data change
// Return type : void
void CXFloorWndPropPage::UpdateMSecond()
{
m_sliderAnimation.SetRange(0,16);
m_sliderAnimation.EnableWindow(m_bAnimation);
m_sSleep.EnableWindow(m_bAnimation);
m_sliderAnimation.SetPos(m_nSleep);
CString sSleep; sSleep.Format(_T("%i ms"), m_nSleep * MulSleep);
m_sSleep.SetWindowText(sSleep);
UpdateStatic(m_bAnimation, IDC_STATIC_SCROLL);
}
void CXFloorWndPropPage::UpdateStatic(BOOL bValue, UINT idStatic)
{
CString text;
CWnd* pStatic = GetDlgItem(idStatic);
pStatic->GetWindowText(text); AfxExtractSubString(text,text,0,TCHAR(':'));
text += CString(_T(": ")) + (bValue ? _T("on") : _T("off"));
pStatic->SetWindowText(text);
}
/////////////////////////////////////////////////////////////////////////////
// CXFloorWndPropPage message handlers
// Function name : CXFloorWndPropPage::OnInitDial