⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgoptionadv.cpp

📁 本程序是VC为平台开发的股票资讯系统
💻 CPP
字号:
// DlgOptionAdv.cpp : implementation file
//

#include "stdafx.h"
#include "StockRefer.h"
#include "DlgOptionAdv.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgOptionAdv property page

IMPLEMENT_DYNCREATE(CDlgOptionAdv, CPropertyPage)

CDlgOptionAdv::CDlgOptionAdv() : CPropertyPage(CDlgOptionAdv::IDD)
{
	//{{AFX_DATA_INIT(CDlgOptionAdv)
	//}}AFX_DATA_INIT
}

CDlgOptionAdv::~CDlgOptionAdv()
{
}

void CDlgOptionAdv::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgOptionAdv)
	DDX_Control(pDX, IDC_SPIN_SAVEDAY, m_spSaveDay);
	DDX_Control(pDX, IDC_EDIT_SAVEDAY, m_edSaveDay);
	DDX_Control(pDX, IDC_CHECK_SPLASH, m_chkSplash);
	DDX_Control(pDX, IDC_CHECK_TIP, m_chkTip);
	DDX_Control(pDX, IDC_RADIO_SAVEDAY, m_rdSaveDay);
	DDX_Control(pDX, IDC_RADIO_TODAY, m_rdToday);
	DDX_Control(pDX, IDC_RADIO_NODEL, m_rdNoDel);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgOptionAdv, CPropertyPage)
	//{{AFX_MSG_MAP(CDlgOptionAdv)
	ON_BN_CLICKED(IDC_CHECK_SPLASH, OnCheckSplash)
	ON_BN_CLICKED(IDC_CHECK_TIP, OnCheckTip)
	ON_BN_CLICKED(IDC_RADIO_NODEL, OnRadioNodel)
	ON_BN_CLICKED(IDC_RADIO_SAVEDAY, OnRadioSaveday)
	ON_BN_CLICKED(IDC_RADIO_TODAY, OnRadioToday)
	ON_EN_UPDATE(IDC_EDIT_SAVEDAY, OnUpdateEditSaveday)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgOptionAdv message handlers

BOOL CDlgOptionAdv::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
	CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
	ASSERT(pFrame);
	CContainView *pView = (CContainView*)pFrame->GetContainView();
	ASSERT(pView);
	
	int chk = pFrame->m_bShowSplash;
	m_chkSplash.SetCheck(chk);

	int chkTip = pFrame->m_bShowTip;
	m_chkTip.SetCheck(chkTip);

	m_spSaveDay.SetRange32(1,3650);
	int m_NewsChk = pView->m_SaveNewsChk;
	if(m_NewsChk == 0)
	{
		m_rdSaveDay.SetCheck(1);
		m_edSaveDay.EnableWindow();
		m_spSaveDay.EnableWindow();
	}
	else if(m_NewsChk == 1) m_rdToday.SetCheck(1);
	else m_rdNoDel.SetCheck(1);
	int m_SaveDay = pView->m_SaveDays;
	CString strSaveDay;
	strSaveDay.Format(_T("%d"),m_SaveDay);
	m_edSaveDay.SetWindowText(strSaveDay);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgOptionAdv::OnOK() 
{
	// TODO: Add your specialized code here and/or call the base class
	if(GetParent()->GetDlgItem(ID_APPLY_NOW)->IsWindowEnabled())
		OnSetChanged();

	CPropertyPage::OnOK();
}

BOOL CDlgOptionAdv::OnApply() 
{
	// TODO: Add your specialized code here and/or call the base class
	OnSetChanged();
	
	return CPropertyPage::OnApply();
}

void CDlgOptionAdv::OnSetChanged()
{
	CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
	ASSERT(pFrame);
	CContainView *pView = (CContainView*)pFrame->GetContainView();
	ASSERT(pView);

	int chk = m_chkSplash.GetCheck();
	pFrame->m_bShowSplash = chk;	

	int chkTip = m_chkTip.GetCheck();
	pFrame->m_bShowTip = chkTip;

	CString strSaveDay;
	m_edSaveDay.GetWindowText(strSaveDay);
	int m_SaveDay = atoi(strSaveDay);
	pView->m_SaveDays = m_SaveDay;

	int m_NewsChk;
	if(m_rdSaveDay.GetCheck() == 1) m_NewsChk = 0; 
	else if(m_rdToday.GetCheck() == 1) m_NewsChk = 1;
	else m_NewsChk = 2;

	pView->m_SaveNewsChk = m_NewsChk;
}

void CDlgOptionAdv::OnCheckSplash() 
{
	// TODO: Add your control notification handler code here
	SetModified();
}

void CDlgOptionAdv::OnCheckTip() 
{
	// TODO: Add your control notification handler code here
	SetModified();
}

void CDlgOptionAdv::OnRadioNodel() 
{
	// TODO: Add your control notification handler code here
	RadioCheck();
}

void CDlgOptionAdv::OnRadioSaveday() 
{
	// TODO: Add your control notification handler code here
	RadioCheck();
}

void CDlgOptionAdv::OnRadioToday() 
{
	// TODO: Add your control notification handler code here
	RadioCheck();
}

void CDlgOptionAdv::OnUpdateEditSaveday() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CPropertyPage::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_UPDATE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	SetModified();
}

void CDlgOptionAdv::RadioCheck()
{
	BOOL m_bEnable = m_rdSaveDay.GetCheck();
	m_edSaveDay.EnableWindow(m_bEnable);
	m_spSaveDay.EnableWindow(m_bEnable);

	SetModified();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -