📄 dialog.h
字号:
/*
* BREW Extension Library
* Copyright (c) 2003-2005 ANYSOFT.CN
* All Rights Reserved.
*/
/*!-----------------------------------
@file
@brief [Dialog] 对话框控件
对话框控件,包括MessageBox,ListBox,InputBox
-----------------------------------*/
#ifndef __DIALOG_H
#define __DIALOG_H
/*!
@defgroup Dialog Dialog Module/对话框控件模块
*/
#include "CommonDef.H"
#include "AEEText.H"
#include "AppFrame.H"
#include "CommonCtl.h"
/////////////////////////////////////////////////////////
class AppArbiter;
/////////////////////////////////////////////////////////
#define EVT_DIALOG (EVT_USER+1024)
#define EVT_MSGBOX (EVT_DIALOG+1)
#define EVT_INPUTBOX (EVT_DIALOG+2)
#define EVT_LISTBOX (EVT_DIALOG+3)
#define BTN_HL 1
#define BTN_OK 0
#define BTN_CANCEL 2
#define BTN_YES 4
#define BTN_NO 6
#define BTN_RETRY 8
#define BTN_IGNORE 10
#define BTN_ABORT 12
#define BOX_CX 96
#define BOX_CY 113
#define BTN_COUNT 14
#define BTN_CX 48
#define BTN_CY 28
#define _BUF_LEN 32
//////////////////////////////////////////////////
#include "BEL_res.h"
//////////////////////////////////////////////////
#define MB_OK BTN_OK
#define MB_CANCEL BTN_CANCEL
#define MB_YES BTN_YES
#define MB_NO BTN_NO
#define MB_RETRY BTN_RETRY
#define MB_IGONRE BTN_IGNORE
#define MB_ABORT BTN_ABORT
#define MB_NONE -1
#define MAX_MSG_LEN 32
#define _MAX_BTN 2
/*!
@ingroup Dialog
@brief 对话框基类
*/
class CDialog:public VisibleObj
{
public:
CDialog();
~CDialog();
virtual BOOL Create(AppView* pView,AEEApplet* pApp,const char* pszResFile);
virtual void Release();
virtual AppResult Enable() {return SUCCESS;}
virtual AppResult Disable() {return SUCCESS;}
virtual AppResult Open() {return SUCCESS;};
virtual AppResult Close() {return SUCCESS;};
virtual AppResult Update() {return SUCCESS;};
void Show(BOOL bShow);
BOOL IsVisible(){return m_bShow;};
protected:
AEEApplet* m_pApp;
AppView* m_pView;
BOOL m_bShow;
int m_nX;
int m_nY;
DWORD m_dwDlgID;
IImage* m_pImgBox;
IImage* m_pImgBtn;
};
typedef CDialog* PCDialog;
/////////////////////////////////////////////////////////
// MsgBox
/*!
@ingroup Dialog
@brief 消息框,采用IImage接口显示背景和按钮,IStatic接口显示文字
*/
class CMsgBox:public CDialog
{
public:
CMsgBox();
~CMsgBox();
virtual BOOL Create(AppView* pView,AEEApplet* pApp,const char* pszResFile);
virtual void Release();
virtual AppResult Update();
virtual BOOL OnEvent(AEEEvent evtCode,WORD wParam,DWORD dwParam);
BOOL ShowMsg(const AECHAR* pwszTxt,int nBtn1 = MB_OK,int nBtn2 = MB_NONE,DWORD dwDlgID = 0);
BOOL ShowMsg(const char* pszResFile,int16 nTxtID,int nBtn1 = MB_OK,int nBtn2 = MB_NONE,DWORD dwDlgID = 0);
protected:
IStatic* m_pCtlTxt;
int m_nBtnCount;
int m_nBtn[_MAX_BTN];
int m_nBtnActive;
int m_nBtnX[_MAX_BTN];
};
typedef CMsgBox* PCMsgBox;
/////////////////////////////////////////////////////////////////
// InputBox
#define IB_OK BTN_OK
#define IB_CANCEL BTN_CANCEL
#define MAX_TITLE_LEN 8
/*!
@ingroup Dialog
@brief 输入框,采用IImage接口显示背景和按钮,BelTextCtl接口实现输入
*/
class CInputBox:public CDialog
{
public:
CInputBox();
~CInputBox();
virtual BOOL Create(AppView* pView,AEEApplet* pApp,const char* pszResFile);
virtual void Release();
virtual AppResult Enable();
virtual AppResult Disable();
virtual AppResult Update();
virtual BOOL OnEvent(AEEEvent evtCode,WORD wParam,DWORD dwParam);
BOOL GetInput(AECHAR* pwszBuf,WORD wMaxLen,AECHAR* pwszTitle = NULL,DWORD dwDlgID = 0);
BOOL GetInput(AECHAR* pwszBuf,WORD wMaxLen,const char* pszResFile = NULL,int16 nTitleID = -1,DWORD dwDlgID = 0);
void ReadOnly(BOOL bReadOnly);
void EnableMask(BOOL bEnable);
void FilterDigit(BOOL bFilter);
protected:
BELTextCtl* m_pCtlTxt;
int m_nBtnActive;
WORD m_wMaxLen;
AECHAR* m_pwszBuf;
BOOL m_bReadOnly;
};
typedef CInputBox* PCInputBox;
/////////////////////////////////////////////////////////////////
// ListBox
#define LB_CANCEL -1
/*!
@ingroup Dialog
@brief 列表框,采用IImage接口显示背景和按钮,IMenuCtl实现列表
*/
class CListBox:public CDialog
{
public:
CListBox();
~CListBox();
virtual BOOL Create(AppView* pView,AEEApplet* pApp,const char* pszResFile);
virtual void Release();
virtual AppResult Update();
virtual BOOL OnEvent(AEEEvent evtCode,WORD wParam,DWORD dwParam);
BOOL ShowList(int nItemCount,AECHAR* pwszItemTxt[],AECHAR* pwszTitle = NULL,DWORD dwDlgID = 0);
BOOL ShowList(const char* pszResFile,int nItemCount,int16* pnItemTxtID,int16 nTitleID = -1,DWORD dwDlgID = 0);
protected:
IMenuCtl* m_pCtlMenu;
int m_nBtnActive;
};
typedef CListBox* PCListBox;
/////////////////////////////////////////////////////////////////
BOOL IsEmpty(AECHAR* pwszStr);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -