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

📄 basewnd.h

📁 C++实现的brew程序管理器例子
💻 H
字号:
/////////////////////////////////////////////////////////////////////
// Project : AppManager
// File: BaseWnd.h
// UI module of this project
// 2005/07/26
/////////////////////////////////////////////////////////////////////

#if !defined(AFX_BASEWND_H__765E6B4A_5A8E_4342_A28A_41B6E441B774__INCLUDED_)
#define AFX_BASEWND_H__765E6B4A_5A8E_4342_A28A_41B6E441B774__INCLUDED_

//---------------- Inculde ------------------
#include "Wnd.h"
#include "MenuCtl.h"
#include "Image.h"
//-------------------------------------------

//---------------- Define -------------------
#define BASEWND_TYPE_STATIC		0x0001
#define BASEWND_TYPE_MENU		0x0002
#define BASEWND_TYPE_DOUBLE		0X0003 //双菜单,带选项菜单

#define BASEWND_ACTIVE_BODY		0x0000
#define BASEWND_ACTIVE_SOFTKEY	0x0001
//-------------------------------------------

class CBaseWnd :
	public CWnd
{
public:
	CBaseWnd(uint16 wType = BASEWND_TYPE_STATIC);
	virtual ~CBaseWnd(void);
//property
protected:
	// Soft key menu control
	CMenuCtl *m_pSoftKeyMenu;
	// Static control
	CStatic *m_pStatic;
	// Menu control
	CMenuCtl *m_pMenuCtl;
	//选项菜单
	CMenuCtl *m_pMenuOption;
	// Window type, static or menu
	uint16 m_wWindowType;
	// Current active control
	uint16 m_wActiveCtl;
	//Window title text
	AECHAR *m_pTextTitle;
	//Window title icon image 
	CImage *m_pImgTitle;	

//method
public:
	// Function to create base window
	virtual boolean Create(CShell* pShell, CDisplay *pDisplay, const char *pszResFile, boolean bShow = TRUE);
	// Display base window
	virtual void Update(CDisplay *pDisplay);
	// Event handler of base window
	virtual boolean HandleEvent(AEEEvent evt, uint16 wParam, uint32 dwParam);
	// Pause the window
	virtual void Pause();
	// Resume the window
	virtual void Resume();
	// Set text of the static control, return success or not.
	// pwszText : The AECHAR string to set, if the string is NULL, it will clear static control
	boolean SetText(AECHAR *pwszText, AECHAR *pwszTitle);

	// Add a menu item to base window
	boolean AddItem(const char * pszResFile,uint16 wResID,uint16 nItemID,AECHAR * pText,uint32 lData);
	// Extend function to add a menu item to base window
	boolean AddItemEx(CtlAddItem * pai);
	// Extend function to add a menu item to bas window 
	boolean AddItemEx(const char * pszResFile, uint16 wResImgID, uint16 nResTextID, uint16 nItemID, AECHAR *pText, uint32 lData); 
	// add a menu item include a option item
	boolean AddItemOption(const char *pszResFile, uint16 wResImgID, uint16 nTextID, uint16 nItemID, uint32 lData);

	// Delete a special menu item
	boolean DeleteItem(uint16 nItemID);
	// Delete all menu items
	boolean DeleteAllItems();

	// Add a soft key item to base window
	boolean AddSoftkey(const char * pszResFile,uint16 wResID,uint16 nItemID,AECHAR * pText,uint32 lData);
	// Extend function to add a soft key item to base window
	boolean AddSoftkeyEx(CtlAddItem * pai);
	// Delete a special soft key item
	boolean DeleteSoftkey(uint16 nItemID);
	// Delete all soft key items
	boolean DeleteAllSoftkeys();
	//Set base window title 
	void SetWindowTitle(const char * pszResFile, uint16 wResTextID, uint16 wResImgID);
	void SetWindowTitle(AECHAR* pTitle);
	boolean SetSoftKeySel(uint16 keyID);
	boolean GetMenuItemData(uint16 itemID, uint32 *plData);
	//
	CMenuCtl *GetMenuCtl()
	{
		return m_pMenuCtl;
	}
	//
	CStatic *GetStatic()
	{
		return m_pStatic;
	}
};
#endif

⌨️ 快捷键说明

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