www.pudn.com > geomm1.zip > ExampleDialog.cpp


// ExampleDialog.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Sample.h" 
#include "ExampleDialog.h" 
#include "GeometryManager.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CExampleDialog dialog 
 
 
CExampleDialog::CExampleDialog(CWnd* pParent /*=NULL*/) 
	: CDialog(CExampleDialog::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CExampleDialog) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CExampleDialog::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CExampleDialog) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CExampleDialog, CDialog) 
	//{{AFX_MSG_MAP(CExampleDialog) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CExampleDialog message handlers 
 
BOOL CExampleDialog::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// initialize the geometry manager 
	// 
	// the default behavior is fine 
	// 
	HGEOM hGeom = GmStartDefinition(0); 
	ASSERT(hGeom); 
	if (hGeom) 
	{ 
		// add the top-level dialog group 
		// 
		// arrange its direct children vertically 
		// 
		HGMGROUP hTopDialog = GmAddTopDialog(hGeom, m_hWnd, GM_VERTICAL); 
		if (hTopDialog) 
		{ 
			// add the generic group for the static text and edit field 
			// 
			// arrange its direct children vertically 
			// give it a weight of 1 
			// 
			HGMGROUP hGroup1 = GmAddGroup(hGeom, hTopDialog, GM_VERTICAL, 1); 
			if (hGroup1) 
			{ 
				// add the static text group 
				// 
				// left-align and vertically center it 
				// give it a weight of 0 
				// 
				GmAddWnd(hGeom, hGroup1, ::GetDlgItem(m_hWnd, IDC_SI_LABEL), GM_LEFT | GM_VCENTER, 0); 
				 
				// add the multiline edit field group 
				// 
				// allow it to grow (in both directions) 
				// give it a weight of 1 
				// 
				GmAddWnd(hGeom, hGroup1, ::GetDlgItem(m_hWnd, IDC_SI), GM_GROW, 1); 
			} 
			 
			// add the generic group for the buttons 
			// 
			// right-align it 
			// arrange its direct children horizontally 
			// give it a weight of 0 
			// 
			hGroup1 = GmAddGroup(hGeom, hTopDialog, GM_RIGHT | GM_HORIZONTAL, 0); 
			if (hGroup1) 
			{ 
				// add the two buttons 
				// 
				// don't allow any growth 
				// give them a weight of 0 
				// 
				GmAddWnd(hGeom, hGroup1, ::GetDlgItem(m_hWnd, IDOK), 0, 0); 
				GmAddWnd(hGeom, hGroup1, ::GetDlgItem(m_hWnd, IDCANCEL), 0, 0); 
			} 
		} 
		 
		// end the definition and start the manager 
		// 
		GmEndDefinition(hGeom); 
	} 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
}