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 __CeMgr_h__
#define __CeMgr_h__

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "CeMisc.h"
#include "CeArray.h"

enum eChildFlags
{
   //
   // o Anchoring to the left is easy - no action has to be taken.
   // o Anchoring to the right takes work - we preserve the distance of the right
   //   edge of the child to the right edge of the parent.

   // o Anchoring to the top is easy - no action has to be taken.
   // o Anchoring to the bottom takes work - we preserve the distance of the bottom
   //   edge of the child to the bottom edge of the parent.

   // o With "absolute" height/width adjustments, change is equal to parent.
   // o With "proportional" height/width adjustments, change is proportional
   //   to parent change.

   // Use these to maintain the distance from the edge of a control to the edge of
   // it's parent.
   //
   AL_ANCHOR_LEFT         =  0x00001,
   AL_ANCHOR_RIGHT        =  0x00002,
   AL_ANCHOR_TOP          =  0x00004,
   AL_ANCHOR_BOTTOM       =  0x00008,

   AL_ANCHOR_TOPLEFT      =  AL_ANCHOR_TOP|AL_ANCHOR_LEFT,
   AL_ANCHOR_TOPRIGHT     =  AL_ANCHOR_TOP|AL_ANCHOR_RIGHT,
   AL_ANCHOR_BOTLEFT      =  AL_ANCHOR_BOTTOM|AL_ANCHOR_LEFT,
   AL_ANCHOR_BOTRIGHT     =  AL_ANCHOR_BOTTOM|AL_ANCHOR_RIGHT,

   AL_ANCHOR_ALL		  =  AL_ANCHOR_TOP|AL_ANCHOR_LEFT|AL_ANCHOR_BOTTOM|AL_ANCHOR_RIGHT,

   //
   // Use these to adjust height or width by the same pixel count as the
   // parent's height/width change.
   //
   AL_ADJUST_WIDTH        =  0x00010,
   AL_ADJUST_HEIGHT       =  0x00020,
   AL_ADJUST_SIZE		  =  AL_ADJUST_WIDTH|AL_ADJUST_HEIGHT,

   //
   // Use these to adjust height or width such that original ratios
   // to original parent height/width are maintained.
   //
   AL_PROP_ADJUST_WIDTH   =  0x00040,
   AL_PROP_ADJUST_HEIGHT  =  0x00080,
   AL_PROP_ADJUST_SIZE	  =  AL_PROP_ADJUST_WIDTH|AL_PROP_ADJUST_HEIGHT,

   //
   // Use these to adjust vertical or horizontal position such that
   // position is maintained if you imagine parent's coordinate system
   // to be scaled (rather than extended).  (For instance, a control
   // in the center of the parent would remain in the center of the parent
   // after a resize if both of these flags are true.)
   //
   AL_PROP_ADJUST_HORZPOS = 0x00100,
   AL_PROP_ADJUST_VERTPOS = 0x00200,

   //
   // AL_ELASTIC is just shorthand - it causes a control to proportionately
   // move and size.
   //
   AL_ELASTIC             = AL_PROP_ADJUST_WIDTH|AL_PROP_ADJUST_HEIGHT|AL_PROP_ADJUST_HORZPOS|AL_PROP_ADJUST_VERTPOS,

   //
   // Use this to cause a static text label that precedes a control (in tab order)
   // to automatically track with the control itself.  Distance from the right edge
   // of the label to the left edge of the control is maintained.  (Vertical adjustment
   // also made.)
   //
   AL_FIX_LABEL           = 0x01000,

   //
   // the same as AL_FIX_LABEL but it assumes the label is above the control and doesn't
   // allocate horizontal spacing for it
   //
   AL_FIX_LABEL_ABOVE     = 0x02000,

   //
   // Keeps the spinner along the right border and keeps the vertical size equal
   // to the childs size
   //
   AL_FIX_SPINNER         = 0x04000,
};

class CeChildMgr
{

protected:
	class CeChildInfo
	{
	public:
	   CeChildInfo();

	   HWND m_hWndChild;
	   DWORD m_nFlags;				// AL_*** constants, generally OR'd together.
	   CeRect m_rcOriginal;			// Original rectangle for hWnd in parent's client coordinates
	   CeSize m_sizeMin;				// Smallest allowable size, default to size of NC area

	   CeRect m_rcMove;				// Where to move it after sizing

	   CeSize m_sizeAssocLabelDelta;	// Distance from right edge of associated label (hAssocWnd) to left edge of hWnd
									// (as well as top of label to top of hWnd).
									// Only used if AL_FIX_ASSOC_LABEL specified.
	   HWND m_hWndLabel;			// Handle to associated window, or label.  
	   CeRect m_rcLabel;				// Labels rectangle

	   CeSize m_sizeAssocSpinDelta;	// Distance from left edge of associated label (hAssocWnd) to right edge of hWnd
									// (as well as top of label to top of hWnd).
									// Only used if AL_FIX_SPINNER specified.
	   HWND m_hWndSpinner;			// Handle to spinner
	   CeRect m_rcSpinner;			// Spinners rectangle
	};

	CeArray<CeChildInfo> m_arrayInfo;
	HWND m_hWnd;					// parents handle

	CeRect m_rcOriginal;
	CeRect m_rcLastParent;			// Last size
   
public:
	CeChildMgr();
	virtual ~CeChildMgr();

	int Manage(HWND hChild, UINT nFlags);
	void OnSize(UINT nType, int cx, int cy);

	// Offset ALL child controls by size, this function
	// works for all children, not just the managed ones
	static void OffsetChildren(HWND hWnd, CeSize size);

	// Iterates thourhg the child windows on a dialog
	// or other window and excludes the children from the
	// clipping rectangle of the parent so when erasing the
	// background (eg, OnSize()) the background doesn't 
	// flash like hell
	static void ValidateChildBkgnd(HDC hDC, HWND hWnd);

	// Adjusts the parent rectangle, useful for things like
	// adding dialog bars to the parents client area
	// and then adjust the controls with fixed distances
	// to the parents borders
	void AdjustArea(const SIZE& sizeDelta, BOOL bTopLeft);

protected:
	SIZE CalcSize(CeChildInfo *pInfo, CeRect &rcParent);
	static void MsgBoxCurrentSize(HWND hWnd);

	// Call this when handling WM_GETMINMAXINFO, for example:
	// lpMMI->ptMinTrackSize = CAutoLayout::SizeDialogToScreen(250,210);
	static POINT SizeDialogToScreen(int nDialogX, int nDialogY);

	// This works...but there is not much that you can do with it.
	BOOL DetectCollision();
};

#endif // __CeMgr_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 | Mobile
Web04 | 2.8.141022.1 | Last Updated 5 Oct 2000
Article Copyright 2000 by Kenny G
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid