DragonNest/Third/XTToolkitPro/Samples/Controls/EditListBox/EditListSheet.cpp

173 lines
4.4 KiB
C++
Raw Normal View History

2024-12-19 09:48:26 +08:00
// EditListSheet.cpp : implementation file
//
// This file is a part of the XTREME TOOLKIT PRO MFC class library.
// (c)1998-2008 Codejock Software, All Rights Reserved.
//
// THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
// RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
// CONSENT OF CODEJOCK SOFTWARE.
//
// THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
// IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
// YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
// SINGLE COMPUTER.
//
// CONTACT INFORMATION:
// support@codejock.com
// http://www.codejock.com
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include "EditListSheet.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEditListSheet
IMPLEMENT_DYNAMIC(CEditListSheet, CXTResizePropertySheet)
CEditListSheet::CEditListSheet(CWnd* pWndParent)
: CXTResizePropertySheet(IDS_PROPSHT_CAPTION, pWndParent)
{
// Add all of the property pages here. Note that
// the order that they appear in here will be
// the order they appear in on screen. By default,
// the first page of the set is the active one.
// One way to make a different property page the
// active one is to call SetActivePage().
AddPage(&m_Page1);
AddPage(&m_Page2);
AddPage(&m_Page3);
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
CEditListSheet::~CEditListSheet()
{
}
BEGIN_MESSAGE_MAP(CEditListSheet, CXTResizePropertySheet)
//{{AFX_MSG_MAP(CEditListSheet)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDHELP, OnHelp)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CEditListSheet::OnHelp()
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CEditListSheet message handlers
void CEditListSheet::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CXTResizePropertySheet::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CEditListSheet::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CXTResizePropertySheet::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CEditListSheet::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CEditListSheet::OnInitDialog()
{
BOOL bRet = CXTResizePropertySheet::OnInitDialog();
// TODO: Add your specialized code here
ModifyStyle (0L, WS_OVERLAPPEDWINDOW);
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
LoadPlacement(_T("CEditListSheet"));
CXTPPaintManager::SetTheme(xtpThemeOffice2003);
return bRet; // return TRUE unless you set the focus to a control
}
void CEditListSheet::OnDestroy()
{
// TODO: Add your message handler code here
SavePlacement(_T("CEditListSheet"));
CXTResizePropertySheet::OnDestroy();
}