Click here to Skip to main content
15,895,799 members
Articles / Desktop Programming / WTL

CPPMessageBox v1.0

Rate me:
Please Sign up or sign in to vote.
4.89/5 (53 votes)
14 Feb 2005CPOL22 min read 175.5K   5.2K   128  
Extended MessageBox class
// PageHeader.cpp : implementation file
//

#include "stdafx.h"
#include "cppmessagebox_demo.h"
#include "CPPMessageBox_demoDlg.h"
#include "PageHeader.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPageHeader property page

IMPLEMENT_DYNCREATE(CPageHeader, CPropertyPage)

CPageHeader::CPageHeader() : CPropertyPage(CPageHeader::IDD)
{
	//{{AFX_DATA_INIT(CPageHeader)
	m_align = 0;
	m_enable = FALSE;
	m_header_text = _T("");
	m_height = 0;
	m_text = _T("CPPMessageBox");
	m_type = 0;
	m_effect_bk = 0;
	//}}AFX_DATA_INIT
}

CPageHeader::~CPageHeader()
{
}

void CPageHeader::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPageHeader)
	DDX_Control(pDX, IDC_COLOR_END, m_color_end);
	DDX_Control(pDX, IDC_COLOR_MID, m_color_mid);
	DDX_Control(pDX, IDC_COLOR_START, m_color_start);
	DDX_CBIndex(pDX, IDC_ALIGN, m_align);
	DDX_Check(pDX, IDC_ENABLE, m_enable);
	DDX_Text(pDX, IDC_HEADER_TEXT, m_header_text);
	DDX_Text(pDX, IDC_HEIGHT, m_height);
	DDX_Text(pDX, IDC_TEXT, m_text);
	DDX_CBIndex(pDX, IDC_TYPE, m_type);
	DDX_CBIndex(pDX, IDC_EFFECT, m_effect_bk);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPageHeader, CPropertyPage)
	//{{AFX_MSG_MAP(CPageHeader)
	ON_CBN_SELENDOK(IDC_ALIGN, OnChangeHeader)
	ON_BN_CLICKED(IDC_ENABLE, OnChangeHeader)
	ON_EN_CHANGE(IDC_HEADER_TEXT, OnChangeHeader)
	ON_EN_CHANGE(IDC_HEIGHT, OnChangeHeader)
	ON_EN_CHANGE(IDC_TEXT, OnChangeHeader)
	ON_CBN_SELCHANGE(IDC_TYPE, OnChangeHeader)
	ON_CBN_SELENDOK(IDC_EFFECT, OnChangeHeader)
	//}}AFX_MSG_MAP
	ON_MESSAGE(CPN_SELENDOK, OnChangeColorBk)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPageHeader message handlers

BOOL CPageHeader::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	UpdateData(FALSE);
	EnableHeader();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPageHeader::OnChangeHeader() 
{
	UpdateData();
	EnableHeader();
}

void CPageHeader::EnableHeader()
{
	GetDlgItem(IDC_HEIGHT)->EnableWindow(m_enable);
	GetDlgItem(IDC_TYPE)->EnableWindow(m_enable && m_height);
	GetDlgItem(IDC_TEXT)->EnableWindow(m_enable && m_type && m_height);
	GetDlgItem(IDC_ALIGN)->EnableWindow(m_enable && m_type && m_height);
	GetDlgItem(IDC_HEADER_TEXT)->EnableWindow(m_enable && m_height);
	GetDlgItem(IDC_EFFECT)->EnableWindow(m_enable);
	GetDlgItem(IDC_COLOR_START)->EnableWindow(m_enable);
	GetDlgItem(IDC_COLOR_MID)->EnableWindow(m_enable);
	GetDlgItem(IDC_COLOR_END)->EnableWindow(m_enable);
}

LONG CPageHeader::OnChangeColorBk(UINT lParam, LONG wParam)
{
	// TODO: Add your control notification handler code here
	return 0L;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer SvyazInvest
Belarus Belarus
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions