Click here to Skip to main content
15,885,546 members
Articles / Desktop Programming / MFC

The Ultimate Grid Home Page

,
Rate me:
Please Sign up or sign in to vote.
5.00/5 (122 votes)
14 Sep 2013CPOL10 min read 4.6M   81.9K   418  
The Ultimate Grid is now Open Source
// Ex14View.cpp : implementation of the CEx14View class
//

#include "stdafx.h"
#include "Ex14.h"

// include the header file for the Ultimate Grid derived class
#include "MyCug.h"

#include "Ex14Doc.h"
#include "Ex14View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEx14View

IMPLEMENT_DYNCREATE(CEx14View, CFormView)

BEGIN_MESSAGE_MAP(CEx14View, CFormView)
	//{{AFX_MSG_MAP(CEx14View)
	ON_WM_SIZE()
	ON_COMMAND(ID_VIEW_USEXPTHEMES, OnViewUsexpthemes)
	ON_UPDATE_COMMAND_UI(ID_VIEW_USEXPTHEMES, OnUpdateViewUsexpthemes)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEx14View construction/destruction

CEx14View::CEx14View() 
	:CFormView(CEx14View::IDD),
	m_ctrl(this)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

CEx14View::~CEx14View()
{
}

BOOL CEx14View::PreCreateWindow(CREATESTRUCT& cs)
{
	
	return CFormView::PreCreateWindow(cs);
}


void CEx14View::DoDataExchange(CDataExchange* pDX) 
{
	CFormView::DoDataExchange(pDX);

	//{{AFX_DATA_MAP(CEx14View)
	DDX_Control(pDX, IDC_NOTIFICATION_OUT, m_output);
	//}}AFX_DATA_MAP

}


/////////////////////////////////////////////////////////////////////////////
// CEx14View drawing

void CEx14View::OnDraw(CDC* pDC)
{
	CEx14Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->SetTitle(_T("Ultimate Grid"));
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CEx14View diagnostics

#ifdef _DEBUG
void CEx14View::AssertValid() const
{
	CFormView::AssertValid();
}

void CEx14View::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CEx14Doc* CEx14View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx14Doc)));
	return (CEx14Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CEx14View message handlers

void CEx14View::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	m_output.AddString("Notifiactions Recieved:");
	
	// attach the grid to the static control
	m_ctrl.AttachGrid(this, IDC_GRID);
}


void CEx14View::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);

	// resize components to take up all real estate
	CWnd* pWnd = GetDlgItem(IDC_GRID);
	if(pWnd)
		pWnd->SetWindowPos(NULL, 0, 0, cx, cy/2, SWP_NOZORDER);

	pWnd = GetDlgItem(IDC_NOTIFICATION_OUT);
	if(pWnd)
		pWnd->SetWindowPos(NULL, 0, cy/2+3, cx,cy/2-4, SWP_NOZORDER);
}

void CEx14View::AddNotificationMessage(LPCSTR message)
{
	m_output.SetCurSel(m_output.AddString(message));
}


void CEx14View::OnViewUsexpthemes() 
{
	UGXPThemes::UseThemes(!UGXPThemes::UseThemes());
	m_ctrl.Invalidate();	
}

void CEx14View::OnUpdateViewUsexpthemes(CCmdUI* pCmdUI) 
{
	pCmdUI->SetCheck(UGXPThemes::UseThemes());	
}

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
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
This is a Organisation

476 members

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

Comments and Discussions