⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ndialog.h

📁 EVC环境下用SDK开发WINCE的应用程序
💻 H
字号:
// NDialog.h: interface for the CNDialog class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_NDIALOG_H__83545811_5E37_476B_ABDD_BCBCBDAD8DDE__INCLUDED_)
#define AFX_NDIALOG_H__83545811_5E37_476B_ABDD_BCBCBDAD8DDE__INCLUDED_

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

#include "NWnd.h"

//
// the max number of map dialogs created simultaneously.
// 
#define MAX_DLG 20
//
// the max number of child window of a dlg.
//
#define MAX_CHILD 30

class CNDialog:public CNWnd
{
public:
	// uID -- Specifies the dialog box template, we set it to 
	//        an invalid sourceID here, so we cannot instant
	//        this base class.
	CNDialog(CNWnd* pParent = NULL, UINT uID = -1);
	virtual ~CNDialog();

protected:
	virtual void OnClose();
	virtual BOOL OnEraseBkgnd(HDC hdc) ;
	virtual void OnActivate(UINT nState, HWND hWndOther, BOOL bMinimized );
	virtual HBRUSH OnCtlColor(HDC hdc,HWND hwnd, UINT nCtlColor);
	virtual HRGN GetUpdateRgn();
	virtual void OnLButtonUp(UINT nFlags, POINT point);
	virtual LRESULT WndProc(HWND hWnd, UINT uMsg,
		WPARAM wParam, LPARAM lParam);
	
public:
	HWND	Create( UINT uID = -1 , CNWnd* pParentWnd = NULL); 
	virtual BOOL DestroyWindow();
	virtual int DoModal();
	virtual int EndDialog(int nResult);

	virtual void OnIdle();

private:
	UINT	m_uTemplateID;
//	CNWnd	*m_pNWndParent;
	
	int RunModalLoop();
	BOOL ContinueModal();

	int  m_nModalResult;
	BOOL m_bContinueModal;


protected:

	virtual BOOL OnInitDialog();


#ifdef PC_VERSION
	// we design the dialog templates in EVC, the dialog base units 
	// is different from wince, so adjust the size and pos of all child
	// windows.
	BOOL SetChildWindowPos(float ratioX, float ratioY);
#endif


public:
	//
	// Maintain a stack to record all Dialogs that have been created.
	//
	// when UIMainWnd received a message from other thread,
	// we dispatch it to all dialogs or the top one(or to say the activated one)
	// depending on circumstance.
	static CNDialog* sm_pDlg[MAX_DLG];
	static UINT sm_nNextDlg;
	static void AddDlg(CNDialog* pDlg);
	static BOOL RemoveDlg(CNDialog* pDlg);
	// Find out the dlg attached with hDlg, 
	// if not found, return NULL
	static CNDialog* FromHandle(HWND hDlg);


	// all child window (subclassed or created by the class 
	// derived from CNWnd) saved in this array.
	CNWnd* m_pChildWnd[MAX_CHILD];
	UINT m_nNextChildWnd;
	void AddChildWnd(CNWnd* pWnd);
	BOOL RemoveChildWnd(CNWnd* pWnd);

	// the region is a combine region of all child windows that 
	// are visible when erase background or paint, we must 
	// clip child windows.
	HRGN m_hRgnClipChild;
	HRGN GetChildRgn() { return m_hRgnClipChild; }
	// call this function to initialize child region or reset
	// the region when some child windows become visible or invisible.
	// pChild -- if pChild is not null, the window it points will be
	//           assumed visible(if bVisible=TRUE) or invisible(if bVisible=FALSE),
	//			 ignore its window style being visible or invisible.
	// bVisible -- TRUE:  set it as visible
	//          -- FALSE: set it as invisible.
	void ResetChildRgn(CNWnd *pChild = NULL, BOOL bVisible = TRUE);

	// Normally we draw all controls in memDC, when finished we copy it 
	// to screen. in some special case, we cannot do it in this way,
	// we need to draw the controls in screen directly, so when we copy 
	// memDC to screen we must clip these controls.
	// so we maintain the following clip region to copy the right part of 
	// memDC to screen.
	HRGN m_hRgnCopyScr;

	DECLARE_MESSAGE_MAP()
};


#endif // !defined(AFX_NDIALOG_H__83545811_5E37_476B_ABDD_BCBCBDAD8DDE__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -