📄 uiwnd.h
字号:
/*********************************************************************/
// 文 件 名: uiWnd.h
// 程序说明: 窗口控件
// 程序设计: 张学平
// 2001.10.23 设计完成 说明文档:R004-S229-0001
// 程序审查: 宋军霞
// 2002.01.28 审查完成 说明文档:R004-S229-0001
// 项目编号: R004-S229
// 版 本: V1.0
// 版 权: Reality Plus Technology (ShenZhen) Co.,Ltd.
/*********************************************************************/
#ifndef _GUI_WIN_H_
#define _GUI_WIN_H_
#include <pr2k.h>
#include <sys/syscall.h>
#include <kernel/linklist.h>
#include <typedefine.h>
#include <uiGui_Cfg.h>
#include <uiWm_Queue.h>
#include <uiControl.h>
#include <uiFont.h>
#include <uiMenu.h>
#include <uiBitmap.h>
#include <uiButton.h>
#include <uiCalendar.h>
#include <uiChkbtn.h>
#include <uiGraph.h>
#include <uiInfo_Box.h>
#include <uiLabel.h>
#include <uiListbox.h>
#include <uiMessage.h>
#include <uiSelector.h>
#include <uiSlider.h>
#include <uiSw_Kbd.h>
#include <uiTextEdit.h>
#include <uiTimepanel.h>
#include <uiTimer.h>
#include <uiViewPort.h>
#include <uiCaret.h>
#include <uiStringRC.h>
#include <uiIcon_Img.h>
#include <uiSound.h>
#include <uiprg_mgr.h>
// 窗口风格
#define GUIWIN_DIALOG 0x0001 /* this window is a dialog box */
#define GUIWIN_BORDER 0x0002 /* 边框 */
#define GUIWIN_BORDER_NONE 0x0000 // 无边框
#define GUIWIN_TITLE 0x0000 // 有标题条
#define GUIWIN_TITLE_NONE 0x0004 /* no title */
#define GUIWIN_HELP 0x0008 /* 帮助信息 */
#define GUIWIN_HELP_NONE 0x0000 /* 没有帮助信息 */
#define GUIWIN_CAPTION_CENTER 0x0010 /* caption display in center*/
#define GUIWIN_CAPTION_LEFT 0x0000 /* caption display in left*/
#define GUIWIN_IMAGE_SAVE 0x0020 /* save previous image for window */
#define GUIWIN_IMAGE_NOSAVE 0x0000 // don't save previous image for window */
#define GUIWIN_CLOSE 0x0000 /* 有close button */
#define GUIWIN_CLOSE_NONE 0x0040 /* 没有close button */
#define GUIWIN_MENU 0x0080 /* 菜单 */
#define GUIWIN_MENU_NONE 0x0000 /* 没有菜单 */
#define DIALOG_MASK 0x0057 // 对话框风格掩码
#define GUIWIN_ACTIVE 0x0000 /* 窗口处于活动状态 */
#define GUIWIN_NOT_ACTIVE 0x0001 /* 窗口处于不活动状态 */
#define TITLE_HEIGHT_ADD 4 // 标题条高度比字符高4点
#define WIN_BORDER_WIDTH 1 // 边框宽度
// 窗口中几个特殊部件数据结构
typedef struct tagWinCtrl
{
HNDL hClose; // 关闭按钮
HNDL hMenu; // 菜单
char *szHelp; // 帮助信息
} TWinCtrl;
#define GUI_WIN_CAPTION_SIZE 31 // 窗口标题的最大字符数
// 窗口控件数据结构
typedef struct tagGuiWindow
{
HNDL handle; /* handle is the pointer which point to this structure */
short type; /* 控件类型 */
short left, top; /* left-top point */
short right, bottom; /* right-bottom point */
short checkFlag ; /* to check the handle available or not */
WORD style ; /* contain controls in the window */
BYTE status ; /* 状态 */
BYTE font; /* 字体 */
struct dLinkList controlList ; /* contain controls in the window */
TGuiMessageQueue *messageQueue ; /* message queue */
struct tagGuiWindow *parent ; /* parent of sub-window */
char caption[GUI_WIN_CAPTION_SIZE+1] ; /* window caption*/
short backColor ; /* background color */
BYTE *screenBuffer ; /* background image buffer */
TWinCtrl tWinSysCtr ; /* ExitButton, Menu, Help */
int ownerThreadID; /* for resource recycle */
// by zhangxp 2003/06/11
WORD BackWindowStyle;
struct tagGuiWindow *pBackWindow;
/* all windows would be linked together */
struct tagGuiWindow *prev ;
struct tagGuiWindow *back ;
} TGuiWindow,TWindow;
extern TGuiWindow *gpWindowsList ; // 窗口链表
extern TGuiWindow *gpTopWindow ; // 顶层窗口
extern TGuiMessageQueue *SysMsgQueue; // 系统消息队列
#define GUIWIN_LEFT 0
#define GUIWIN_TOP 0
#define GUIWIN_RIGHT GUI_SCREEN_WIDTH-1
#define GUIWIN_BOTTOM GUI_SCREEN_HEIGHT-1
// show message
#define MESSAGE_LEFT 15
#define MESSAGE_TOP 60
#define MESSAGE_RIGHT 145
#define MESSAGE_BOTTOM 90
#define MESSAGE_INDENT 4
// 消息盒中的Button及其组合
#define GUIMB_OK 0x0000
#define GUIMB_OKCANCEL 0x0001
#define GUIMB_YESNO 0x0004
// 消息盒中的ICON
#define GUIMB_ICONSTOP 0x0010
#define GUIMB_ICONQUESTION 0x0020
#define GUIMB_ICONEXCLAMATION 0x0040
#define GUIMB_ICONWARNING 0x0080
#define GUIMB_ICONOK 0x0100
// 消息盒风格提取
#define GUIMB_TYPEMASK 0x000F
#define GUIMB_ICONMASK 0x01F0
// 消息盒的返回值
#define GUI_IDOK 1
#define GUI_IDCANCEL 2
#define GUI_IDYES 6
#define GUI_IDNO 7
// 消息盒的最小宽度和高度
//#define MSGBOX_MIN_WIDTH 120
//#define MSGBOX_MIN_HEIGHT 90
// OS保护
#define guiEnterWCS() enterKernelCriticalSection()
#define guiExitWCS() exitKernelCriticalSection()
// Window基本操作函数
DLL_EXP(HNDL) guiWindow_Create(HNDL hParentWnd, const char *caption,const char *szHelp,\
TMenuItemInfo *pMenuItemInfo, WORD style);
DLL_EXP(STATUS) guiWindow_Show(HNDL hWnd );
DLL_EXP(STATUS) guiWindow_Repaint(HNDL hWnd);
DLL_EXP(STATUS) guiWindow_ShowFrame(HNDL hWnd );
DLL_EXP(STATUS) guiWindow_ShowAllControl(HNDL hWnd );
DLL_EXP(STATUS) guiWindow_Delete(HNDL hWnd);
DLL_EXP(STATUS) guiWindow_Clear(HNDL hWnd);
DLL_EXP(STATUS) guiWindow_RemoveAllControl(HNDL hWnd);
DLL_EXP(STATUS) guiWindow_SetCaption(HNDL hWnd, const char* caption);
DLL_EXP(STATUS) guiWindow_GetCaption(HNDL hWnd, char* caption);
DLL_EXP(STATUS) guiWindow_SetBackColor(HNDL hWnd, short backColor);
DLL_EXP(STATUS) guiWindow_GetBackColor(HNDL hWnd, short *backColor);
DLL_EXP(STATUS) guiWindow_SetFont(HNDL hWnd, BYTE font);
DLL_EXP(STATUS) guiWindow_GetFont(HNDL hWnd, BYTE *font);
DLL_EXP(STATUS) guiWindow_SetLocation(HNDL hWnd, WORD left, WORD top, WORD right, WORD bottom);
DLL_EXP(STATUS) guiWindow_GetLocation(HNDL hWnd, WORD *left, WORD *top, WORD *right, WORD *bottom);
DLL_EXP(HNDL) guiWindow_QueryTop(void);
DLL_EXP(STATUS) guiWindow_AddMenu(HNDL hWnd, HNDL hMenu);
DLL_EXP(HNDL) guiWindow_GetMenu(HNDL hWnd);
DLL_EXP(void) guiWindow_RemoveMenu(HNDL hWnd, HNDL hMenu);
// GUI系统内部使用函数
void _guiWindow_ClearCaption(HNDL hWnd);
void _guiWindow_PaintFrame(HNDL hWnd);
void _guiWindow_PaintCaption(HNDL hWnd);
void _guiWindow_ReleaseResource(TGuiWindow *pWnd, BOOL bIsMainWin);
// Dialog基本操作函数
DLL_EXP(HNDL) guiDialog_Create (HNDL hParentWnd, int left, int top, int right, int bottom, \
const char *caption, WORD style);
DLL_EXP(STATUS) guiDialog_Show(HNDL hDialog);
DLL_EXP(STATUS) guiDialog_Close(HNDL hDialog);
DLL_EXP(STATUS) guiDialog_Delete(HNDL hDialog);
// 缺省消息盒
DLL_EXP(int) guiMessageBoxEx(int left, int top, int right, int bottom,\
const char *caption, const char *message, WORD style);
DLL_EXP(int) guiMessageBox(const char *caption, const char *message, WORD style);
// 输入对话框
DLL_EXP(int) guiInputDialog(const char *caption, char *szText, int maxLen,unsigned short kbdType);
DLL_EXP(HNDL) guiShowMessage(char *message);
DLL_EXP(STATUS) guiCloseMessage(HNDL hMessage);
// 帮助信息
DLL_EXP(STATUS) guiWindow_Help(void);
//#define tagWindow tagGuiWindow // 临时使用
#ifdef __WIN32__
#define ap_malloc sc_malloc
#define ap_free sc_free
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif // end of #ifdef _GUI_WINDOW_STRUC_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -