Click here to Skip to main content
15,896,730 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
// MyCUG.h : interface of the MyCug class
//
/////////////////////////////////////////////////////////////////////////////
#include "ugctrl.h"
#include "UGCTRado.h"
#include "UGCTelps.h"
#include "UGCTLabeled.h"
#include "UGCTMarquee.h"
#include "UTEdit.h"
#include "UTMaskedEdit.h"

#define	LABEL_BACK		RGB(100,150,200)
#define SUBLABEL_BACK	RGB(220,200,180)

#define MY_SEPARATOR		10
#define USE_UPPER			1001
#define USE_LOWER			1002
#define USE_PASSWORD		1003
#define USE_CHARLIMIT		1004
#define USE_NUMLIMIT		1005
#define USE_FINISHTEST		1006
#define USE_SETMASK			1007
#define USE_SETCOXMASK		1008
#define USE_SETCOXNUMBER	1009
#define USE_SETCOXCURRENCY	1010

#define FLEXEDIT_ID			320001
#define COXMASK_ID			320002
#define COXNUMBER_ID		320003
#define COXCURRENCY_ID		320004

class MyCug:public CUGCtrl
{
public:
	MyCug();
	~MyCug();

protected:
	// celltypes
	CUGRadioType m_radioType;
	CUGEllipsisType m_ellipType;
	CUGLabeledType m_labeledType;
	CUGMarqueeType m_marqueeType;

	// additional edit controls
	CUTMaskedEdit	m_cutMaskEdit;
	CUTNumericEdit	m_cutNumeric;
	CUTCurrencyEdit	m_cutCurrency;

	// font functions
	struct _tagFonts
	{
		int fontIndex;
		CFont font;
		_tagFonts *next;

		_tagFonts()
		{
			fontIndex = -1;
			next = NULL;
		}
	} *m_fontsList;

	CFont * m_defFont;
	CFont * m_smallFont;
	CFont * m_largeFont;

	BOOL ShowFontDlg( CUGCell &cell, LOGFONT &selectedLogFont, COLORREF &textColor );
	CFont* CreateFont( int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename );
	CFont* CreateFontIndirect( LOGFONT newLogFont );

	// additional edit controls
	CUGEdit m_myCUGEdit;

private:

	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainFrame)
	//}}AFX_VIRTUAL

	
	//{{AFX_MSG(MyCug)
	// NOTE - the ClassWizard will add and remove member functions here.
	//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

public:
	//***** Over-ridable Notify Functions *****
	virtual void OnSetup();
	//mouse and key strokes
	virtual void OnDClicked(int col,long row,RECT *rect,POINT *point,BOOL processed);
	
	virtual void OnKeyDown(UINT *vcKey,BOOL processed);
	virtual void OnCharDown(UINT *vcKey,BOOL processed);
	
	//SetCell notification
	virtual void OnSetCell(int col,long row,CUGCell *cell);
	
	//cell type notifications
	virtual int OnCellTypeNotify(long ID,int col,long row,long msg,long param);

	//editing
	virtual int OnEditStart(int col, long row,CWnd **edit);
	virtual int OnEditVerify(int col,long row,CWnd *edit,UINT *vcKey);
	virtual int OnEditFinish(int col, long row,CWnd *edit,LPCTSTR string,BOOL cancelFlag);
	virtual int OnEditContinue(int oldcol,long oldrow,int* newcol,long* newrow);

	virtual COLORREF OnGetDefBackColor(int section);
};

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