Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

A comprehensive CE class library to replace ATL and MFC

, 4 Oct 2000 CPOL
A collection of classes for CE that do not use ATL or MFC, plus an FTP client, database viewer, and sample application that solves beam deflection equations.
kgwince-old.zip
WinCe
BeamEx
app.ico
BeamEx.dsp
BeamEx.dsw
BeamEx.ini
BeamEx.plg
bitmap1.bmp
bmp00001.bmp
bmp00002.bmp
calc.bmp
calc16.bmp
circ_cross.ico
cir_cross.ico
cross_4.ico
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico00005.ico
ico00008.ico
ico00009.ico
ico00010.ico
icon1.ico
icon2.ico
icon4.ico
id_downl.bmp
Install
BeamEx.inf
BeamEx.ini
BeamEx.MIPS_PPCBW.CAB
BeamEx.MIPS_PPCColor.CAB
BeamEx.SH3_PPCColor.CAB
Setup.exe
i_cross.ico
l_cross.ico
magenic.ico
mssccprj.scc
obl_corss.ico
obl_cross.ico
options.bmp
options1.bmp
ping16.bmp
rect_cross.ico
scene_5.ico
scene_6.ico
tri_cross.ico
vssver.scc
CeLib
CeLabel.inl
CeLib.aps
CeLib.dsp
CeLib.dsw
CeLib.old
CeLib.plg
CeLib.vcp
CeMisc.inl
CeProperty.inl
CeTab.inl
CeWnd.inl
mssccprj.scc
vssver.scc
WinLib.dsp
WinLib.dsw
dbView
bitmap1.bmp
bmp00001.bmp
db5.bmp
dbView.aps
DbView.dsp
dbView.dsw
dbView.old
dbView.plg
DbView.vcp
deldb.bp2
deldb5.bmp
delrec.bp2
delrecor.bmp
help16.bmp
help4.bmp
icon1.ico
icon2.ico
Install
dbView.inf
dbView.ini
Setup.exe
magenic.bmp
magenic.ico
mssccprj.scc
vssver.scc
ftpView
appicon.ico
bitmap1.bmp
bitmap2.bmp
bitmap3.bmp
bitmap4.bmp
bmp00001.bmp
bmp00002.bmp
db5.bmp
deldb.bp2
delrec.bp2
FtpView.dsp
ftpView.dsw
FtpView.old
ftpView.plg
FtpView.vcl
FtpView.vcp
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico171.ico
ico35.ico
icon1.ico
icon2.ico
imagelis.bmp
IMAGES.bmp
Install
ftpView.inf
ftpView.ini
Setup.exe
vssver.scc
magenic.bmp
magenic.ico
mssccprj.scc
options.bmp
options1.bmp
seperato.bmp
vssver.scc
Setup
ico101.ico
Setup.aps
Setup.dsp
setup.ico
Setup.plg
WinCe.dsw
WinLib.dsw
kgwince.zip
app.ico
BeamEx.dsp
BeamEx.dsw
BeamEx.ini
BeamEx.plg
BeamEx.vcl
BeamEx.vcp
bitmap1.bmp
bmp00001.bmp
bmp00002.bmp
calc.bmp
calc16.bmp
circ_cross.ico
cir_cross.ico
cross_4.ico
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico00005.ico
ico00008.ico
ico00009.ico
ico00010.ico
icon1.ico
icon2.ico
icon4.ico
id_downl.bmp
BeamEx.inf
BeamEx.ini
Setup.exe
i_cross.ico
l_cross.ico
magenic.ico
mssccprj.scc
obl_corss.ico
obl_cross.ico
options.bmp
options1.bmp
ping16.bmp
rect_cross.ico
scene_5.ico
scene_6.ico
tri_cross.ico
vssver.scc
CeFtp.vcp
CeFtp.vcw
CeLabel.inl
CeLib.aps
CeLib.dsp
CeLib.dsw
CeLib.plg
CeLib.vcl
CeLib.vcp
CeMisc.inl
CeProperty.inl
CeTab.inl
CeWnd.inl
mssccprj.scc
vssver.scc
WinLib.dsp
WinLib.dsw
bitmap1.bmp
bitmap2.bmp
bmp00001.bmp
db5.bmp
DbView.dsp
dbView.dsw
dbView.plg
DbView.vcl
DbView.vcp
deldb.bp2
deldb5.bmp
delrec.bp2
delrecor.bmp
help16.bmp
help4.bmp
icon1.ico
icon2.ico
dbView.inf
dbView.ini
Setup.exe
magenic.bmp
magenic.ico
menu1_5.bmp
mssccprj.scc
vssver.scc
appicon.ico
bitmap1.bmp
bitmap2.bmp
bitmap3.bmp
bitmap4.bmp
bmp00001.bmp
bmp00002.bmp
db5.bmp
deldb.bp2
delrec.bp2
FtpView.dsp
ftpView.dsw
ftpView.plg
FtpView.vcl
FtpView.vcp
FtpView.vcw
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico171.ico
ico35.ico
icon1.ico
icon2.ico
imagelis.bmp
IMAGES.bmp
ftpView.inf
ftpView.ini
Setup.exe
vssver.scc
magenic.bmp
magenic.ico
mssccprj.scc
newmenu.bmp
options.bmp
options1.bmp
rcdata1.bin
seperato.bmp
toolbar1.bmp
vssver.scc
WinCe.dsw
WinCe.vcw
#ifndef __CeLabel_h__
#define __CeLabel_h__

#include "CeWnd.h"
#include "CeCombo.h"

class CeStatic : public CeWnd
{
// Constructors
public:
	CeStatic();
	BOOL Create(LPCTSTR lpszText, DWORD dwStyle,
				const RECT& rect, HWND hParentWnd, UINT nID = 0xffff, HINSTANCE hInst = NULL);

// Attributes
	HICON SetIcon(HICON hIcon);
	HICON GetIcon() const;
	HBITMAP SetBitmap(HBITMAP hBitmap);
	HBITMAP GetBitmap() const;

	// Note: you set the text through the normal Get/SetWindowText() calls

// Implementation
public:
	virtual ~CeStatic();
};

///////////////////////////////////////////////////////////////////////////////

class CeEdit: public CeWnd
{
public:
	BOOL Create(LPCTSTR lpszText, DWORD dwStyle, DWORD dwExStyle, const RECT& rect, HWND hParentWnd, UINT nID, HINSTANCE hInst=NULL);

	int Enable(BOOL fEnable);
	int GetText(LPTSTR lpch, int cchMax);
	int GetTextLength();
	int SetText(LPCTSTR lpsz);
	void LimitText(int cchMax);
	int GetLineCount();
	int GetLine(int line, LPCTSTR lpch, int cchMax);
	void GetRect(LPRECT lprc);
	void SetRect(LPCRECT lprc);
	void SetRectNoPaint(LPCRECT lprc);
	int GetSel();
	void SetSel(int ichStart, int ichEnd);
	void ReplaceSel(LPCTSTR lpszReplace);
	BOOL GetModify();
	void SetModify(BOOL fModified);
	int ScrollCaret();
	int LineFromChar(int ich);
	int LineIndex(int line);
	int LineLength(int line);
	void Scroll(int dv, int dh);
	int CanUndo();
	int Undo();
	void EmptyUndoBuffer();
	void SetTabStops(int cTabs, int* lpTabs);
	int FmtLines(BOOL fAddEOL);
	int GetFirstVisibleLine();
	int SetReadOnly(BOOL fReadOnly);

	int GetPasswordChar();
	void SetPasswordChar(TCHAR ch);
};

///////////////////////////////////////////////////////////////////////////////

class CeButton: public CeWnd
{
// Construction
public:
	BOOL Create(LPCTSTR lpszText, DWORD dwStyle, DWORD dwExStyle, const RECT& rect, HWND hParentWnd, UINT nID, HINSTANCE hInst)
		{ return CeWnd::Create(_T("BUTTON"), hParentWnd, rect, lpszText, dwStyle, dwExStyle, nID, hInst); }
};


///////////////////////////////////////////////////////////////////////////////

class CeDateTime: public CeWnd
{
// Construction
public:
	CeDateTime();
	virtual ~CeDateTime();
	BOOL Create(LPCTSTR lpszText, DWORD dwStyle, DWORD dwExStyle, const RECT& rect, HWND hParentWnd, UINT nID, HINSTANCE hInst=NULL);

// Attributes
	DWORD GetSystemtime(LPSYSTEMTIME pst) const;
	BOOL SetSystemtime(DWORD gd, LPSYSTEMTIME pst);
	DWORD GetRange(LPSYSTEMTIME rgst) const;
	BOOL SetRange(DWORD gdtr, LPSYSTEMTIME rgst);
	BOOL SetFormat(LPCTSTR sz);
	COLORREF SetMonthCalColor(int iColor, COLORREF clr);
	COLORREF GetMonthCalColor(int iColor);
	HWND GetMonthCal() const;
	void SetMonthCalFont(HFONT FONT, BOOL fRedraw);
	HFONT GetMonthCalFont() const;

// Operations
};

///////////////////////////////////////////////////////////////////////////////

class CeLabelEdit : public CeWnd
{
public:
// Constants
	typedef enum tagTYPE
	{
		leEdit = 1,
		leEditLookup = 2,
		leCombo = 3,
		leDate = 4,
		leTime = 5,
		leTimeInterval = 6,
		leEditNumeric = 7,
	}
	EDITTYPE;

	enum tagLABELEDITSPECIALSTYLE
	{
		LESS_LABEL = 0x1,
		LESS_UNDERLINE  = 0x2,
	};

	enum tagLABELEDITNOTIFY
	{
		LEN_CONTROLCREATE = 1,
		LEN_LOOKUP = 2,
		LEN_CHANGED = 3,
		LEN_PASSTHRU = 4,
		LEN_CONTROLDESTROY = 5,
	};

// Auxilary structures
	typedef struct tagNOTIFYPASSTHRU
	{
		int idCtrl;		// (int) wParam;
		LPNMHDR pnmh;	//(LPNMHDR) lParam; 
	}
	NOTIFYPASSTHRU;

	typedef struct tagCOMMANDPASSTHRU
	{
		WORD wNotifyCode;	// HIWORD(wParam)
		WORD wCtrlId;		// LOWORD(wParam)
		HWND hwndCtrl;	// lParam
	}
	COMMANDPASSTHRU;

	typedef union tagPASSTHRU
	{
		NOTIFYPASSTHRU	notify;
		COMMANDPASSTHRU command;
	}
	PASSTHRU;

private:
	EDITTYPE m_wType;		// which type of control

	CeCombo m_combo;		// combobox for combo types
	DWORD m_dwCombo;
	int m_nCombo;

	BYTE m_fStyles;			// underline, empty text, etc

	CeDateTime m_date;		// calendar control for calendar types

	CeEdit m_edit;			// edit control for edit types
	HWND m_hBuddy;			// buddy control for numeric spinners

	bool m_bDown;			// true if calendar and calendar is dropped also used for button lookup down
	HFONT m_hFont;			// control's font
	bool m_bReadOnly;		// true if control is in a readonly state

// Construction
public:
	CeLabelEdit(EDITTYPE wType = leEdit);
	virtual BOOL Create(DWORD dwStyle, DWORD dwStyleEx, const RECT& rect, HWND hWndParent, UINT nID, HINSTANCE hInst = NULL);
	BOOL ReplaceWindow(UINT nID, HWND hParent, DWORD dwStyle, HINSTANCE hInst = NULL);

// Attributes
public:
	bool IsReadOnly() const
		{ return m_bReadOnly; }

// Operations
public:
	bool SetReadOnly(bool bReadyOnly = true)
		{ bool b = m_bReadOnly;	m_bReadOnly	= bReadyOnly; return b; }
	void SetType(EDITTYPE wType)
		{ m_wType = wType; }
	EDITTYPE GetType() const
		{ return m_wType; }
	int GetComboSel() const
		{ ASSERT(m_wType == leCombo); return m_nCombo; }
	DWORD GetComboSelData() const
		{ ASSERT(m_wType == leCombo); return m_dwCombo; }
	void SetComboSel(int nSel)
		{ ASSERT(m_wType == leCombo); m_nCombo = nSel; }

	void SetSpecialStyle(int fStyles)
		{ m_fStyles = (BYTE) fStyles; }
	int GetSpecialStyle() const
		{ return m_fStyles; }

// Overrides -- for derived classes
public:
	virtual void OnControlCreate(HWND hControl);
	virtual void OnLookup();
	virtual LPARAM OnPassThru(PASSTHRU* pPassThru);
	virtual void OnChanged();
	virtual void OnControlDestroy(HWND hControl);

protected:
	BOOL AddSpinner();

	virtual int OnCreate( LPCREATESTRUCT lpCS, bool& bHandled ); 
	virtual void OnPaint( bool& bHandled );
	virtual BOOL OnEraseBkgnd( HDC hDC, bool& bHandled );
	virtual void OnSize( UINT nType, int cx, int cy, bool& bHandled );
	virtual void OnLButtonDown( UINT nFlags, POINT point, bool& bHandled );
	virtual void OnLButtonUp( UINT nFlags, POINT point, bool& bHandled );
	virtual void OnMouseMove( UINT nFlags, POINT point, bool& bHandled );
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam, bool& bHandled);
	virtual LRESULT OnNotify(int nCtrlId, LPNMHDR pNMH, bool& bHandled);

	virtual LRESULT OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
	virtual void OnSetFocus(HWND hOldWnd, bool& bHandled);
	virtual void OnKillFocus(HWND hNewWnd, bool& bHandled);
};

#include "CeLabel.inl"

#endif // __CeLabel_h__

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)

Share

About the Author

Kenny G

United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 5 Oct 2000
Article Copyright 2000 by Kenny G
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid