gps/GPSProject/GPSMain/SysSettingDlg.cpp

233 lines
5.6 KiB
C++
Executable File

// SysSettingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "gpsmain.h"
#include "SysSettingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSysSettingDlg dialog
CSysSettingDlg::CSysSettingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSysSettingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSysSettingDlg)
//}}AFX_DATA_INIT
// 初始化背景画刷
CBitmap tmpBmp;
// 从资源中加载背景图片
tmpBmp.LoadBitmap(IDB_SETTING_WND);
m_BgDC.CreateCompatibleDC(NULL);
m_BgDC.SelectObject(&tmpBmp);
tmpBmp.DeleteObject();
}
CSysSettingDlg::~CSysSettingDlg()
{
m_BgDC.DeleteDC();
}
void CSysSettingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSysSettingDlg)
DDX_Control(pDX, IDC_BUTTON_SET_EXIT, m_butExit);
DDX_Control(pDX, IDC_BUTTON_SYSINFO, m_butSysInfo);
DDX_Control(pDX, IDC_BUTTON_SOUND, m_butSound);
DDX_Control(pDX, IDC_BUTTON_POWER, m_butPower);
DDX_Control(pDX, IDC_BUTTON_LANGUAGE, m_butLanguage);
DDX_Control(pDX, IDC_BUTTON_DATATIME, m_butDateTime);
DDX_Control(pDX, IDC_BUTTON_BACKLIGHT, m_butBacklight);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSysSettingDlg, CDialog)
//{{AFX_MSG_MAP(CSysSettingDlg)
ON_BN_CLICKED(IDC_BUTTON_SOUND, OnButtonSound)
ON_BN_CLICKED(IDC_BUTTON_POWER, OnButtonPower)
ON_BN_CLICKED(IDC_BUTTON_BACKLIGHT, OnButtonBacklight)
ON_WM_ERASEBKGND()
ON_WM_PAINT()
ON_BN_CLICKED(IDC_BUTTON_DATATIME, OnButtonDatatime)
ON_BN_CLICKED(IDC_BUTTON_LANGUAGE, OnButtonLanguage)
ON_BN_CLICKED(IDC_BUTTON_SYSINFO, OnButtonSysinfo)
ON_BN_CLICKED(IDC_BUTTON_SET_EXIT, OnButtonSetExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSysSettingDlg message handlers
BOOL CSysSettingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CenterWindow(this); // center to the hpc screen
// TODO: Add extra initialization here
// 设置窗口大小
MoveWindow(0,0,320,240);
m_butExit.MoveWindow(282,6,25,25);
m_butExit.LoadBitmaps(IDB_SETTING_CLOSE,IDB_SETTING_CLOSED);
m_butSound.MoveWindow(31,34,70,85);
m_butSound.LoadBitmaps(IDB_SETTING_SOUND,IDB_SETTING_SOUNDD);
m_butPower.MoveWindow(125,34,70,85);
m_butPower.LoadBitmaps(IDB_SETTING_POWER,IDB_SETTING_POWERD);
m_butBacklight.MoveWindow(220,34,70,85);
m_butBacklight.LoadBitmaps(IDB_SETTING_BACKLIGHT,IDB_SETTING_BACKLIGHTD);
m_butDateTime.MoveWindow(31,135,70,85);
m_butDateTime.LoadBitmaps(IDB_SETTING_CALENDER,IDB_SETTING_CALENDERD);
m_butLanguage.MoveWindow(125,135,70,85);
m_butLanguage.LoadBitmaps(IDB_SETTING_LANGUAGE,IDB_SETTING_LANGUAGED);
m_butSysInfo.MoveWindow(220,135,70,85);
m_butSysInfo.LoadBitmaps(IDB_SETTING_SYSINFO,IDB_SETTING_SYSINFOD);
SetButtonTitle();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSysSettingDlg::OnButtonSound()
{
// TODO: Add your control notification handler code here
CSetSoundDlg dlgSound;
if (dlgSound.DoModal() == IDOK)
{
}
else
{
}
}
void CSysSettingDlg::OnButtonPower()
{
// TODO: Add your control notification handler code here
CPowerDlg dlgPower;
if (dlgPower.DoModal() == IDOK)
{
}
else
{
}
}
void CSysSettingDlg::OnButtonBacklight()
{
// TODO: Add your control notification handler code here
CSetBacklightDlg dlgBacklight;
if (dlgBacklight.DoModal() == IDOK)
{
}
else
{
}
}
BOOL CSysSettingDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return FALSE;
//return CDialog::OnEraseBkgnd(pDC);
}
void CSysSettingDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
dc.BitBlt(0,0,320,240,&m_BgDC,0,0,SRCCOPY);
// Do not call CDialog::OnPaint() for painting messages
}
void CSysSettingDlg::OnButtonDatatime()
{
// TODO: Add your control notification handler code here
CSetDateTimeDlg dlgDateTime;
if (dlgDateTime.DoModal() == IDOK)
{
}
else
{
}
}
void CSysSettingDlg::OnButtonLanguage()
{
// TODO: Add your control notification handler code here
CSetLanguageDlg dlgSetLanguage;
if(dlgSetLanguage.DoModal() == IDOK)
{
SetButtonTitle();
}
else
{
}
}
void CSysSettingDlg::OnButtonSysinfo()
{
// TODO: Add your control notification handler code here
CSysInfoDlg dlgSysInfo;
if (dlgSysInfo.DoModal() == IDOK)
{
}
else
{
}
}
void CSysSettingDlg::OnButtonSetExit()
{
// TODO: Add your control notification handler code here
EndDialog(IDOK);
}
void CSysSettingDlg::SetButtonTitle()
{
WCHAR strRes[MAX_PATH];
// 按钮标题
// 导航
CString(LoadString(theApp.GetResourceLib(),IDS_SETTING_VOLUME,strRes,MAX_PATH));
m_butSound.SetButtonTitle(strRes);
// 音乐播放器
CString(LoadString(theApp.GetResourceLib(),IDS_SETTINT_POWER,strRes,MAX_PATH));
m_butPower.SetButtonTitle(strRes);
// 电子书
CString(LoadString(theApp.GetResourceLib(),IDS_SETTING_BACKLIGHT,strRes,MAX_PATH));
m_butBacklight.SetButtonTitle(strRes);
// 视频播放器
CString(LoadString(theApp.GetResourceLib(),IDS_SETTING_DATETIME,strRes,MAX_PATH));
m_butDateTime.SetButtonTitle(strRes);
// 图片浏览器
CString(LoadString(theApp.GetResourceLib(),IDS_SETTING_LANGUAGE,strRes,MAX_PATH));
m_butLanguage.SetButtonTitle(strRes);
// 系统设置
CString(LoadString(theApp.GetResourceLib(),IDS_SETTING_SYSINFO,strRes,MAX_PATH));
m_butSysInfo.SetButtonTitle(strRes);
}