📄 internals.h
字号:
//// $Id: internals.h,v 1.8 2000/11/24 09:19:23 ymwei Exp $//// internals.h: this head file declares all internal types and data.//// Copyright (c) 1999, Wei Yongming.//// Create date: 1999.05.22//#ifndef GUI_INTERNALS_H #define GUI_INTERNALS_H#ifdef __cplusplusextern "C" {#endif /* __cplusplus */typedef struct _ZORDERNODE{ HWND hWnd; // Handle of window struct _ZORDERNODE* pNext; // Next window}ZORDERNODE;typedef ZORDERNODE* PZORDERNODE;typedef struct _ZORDERINFO{ int nNumber; // Number of windows HWND hWnd; // Handle of host window PZORDERNODE pTopMost; // the top most Z order node// pthread_mutex_t lock; // the mutex lock}ZORDERINFO;typedef ZORDERINFO* PZORDERINFO;typedef struct _SCROLLWINDOWINFO{ int iOffx; int iOffy; const RECT* rc1; const RECT* rc2;}SCROLLWINDOWINFO;typedef SCROLLWINDOWINFO* PSCROLLWINDOWINFO;#define SBS_NORMAL 0x00#define SBS_DISABLED 0x01#define SBS_HIDE 0x02typedef struct _SCROLLBARINFO { int minPos; // min value of scroll range. int maxPos; // max value of scroll range. int curPos; // current scroll pos. int pageStep; // steps per page. int barStart; // start pixel of bar. int barLen; // length of bar. BYTE status; // status of scroll bar.}SCROLLBARINFO;typedef SCROLLBARINFO* PSCROLLBARINFO;typedef struct _CARETINFO { int x; // position of caret int y; void* pNormal; // normal bitmap. void* pXored; // bit-Xored bitmap. PBITMAP pBitmap; // user defined caret bitmap. int nWidth; // size of caret int nHeight; int nBytesNr; // number of bitmap bytes. int nEffWidth; // effective width int nEffHeight; // effective height; BOOL fBlink; // does blink? BOOL fShow; // show or hide currently. HWND hOwner; // the window owns the caret. UINT uTime; // the blink time.}CARETINFO;typedef CARETINFO* PCARETINFO;typedef struct _QMSG{ MSG Msg; struct _QMSG* next; BOOL fromheap;}QMSG;typedef QMSG* PQMSG;typedef struct _SYNCMSG{ MSG Msg; int retval; sem_t sem_handle; struct _SYNCMSG* pNext;}SYNCMSG;typedef SYNCMSG* PSYNCMSG;#define DEF_MSGQUEUE_LEN 16// the MSGQUEUE struct is a internal struct.// using semaphores to implement message queue.typedef struct _MSGQUEUE{ DWORD dwState; // message queue states pthread_mutex_t lock; // lock sem_t wait; // wait semaphores PQMSG pFirstNotifyMsg; // head of the notify message queue PQMSG pLastNotifyMsg; // tail of the notify message queue PSYNCMSG pFirstSyncMsg; // head of the sync message queue PSYNCMSG pLastSyncMsg; // tail of the sync message queue MSG* msg; // post message buffer int len; // buffer len int readpos, writepos; // positions for reading and writing /* * One thread can only support eight timers. * And number of all timers in a MiniGUI applicatoin is 16. */ HWND TimerOwner[8]; // Timer owner int TimerID[8]; // timer identifiers. BYTE TimerMask; // used timer slots mask}MSGQUEUE;typedef MSGQUEUE* PMSGQUEUE;// Free QMSG list#define SIZE_QMSG_HEAP 64typedef struct _FREEQMSGLIST{ pthread_mutex_t lock; PQMSG head; PQMSG tail; int nr; PQMSG heap; int free;}FREEQMSGLIST;typedef FREEQMSGLIST* PFREEQMSGLIST;BOOL InitFreeQMSGList (void);void DestroyFreeQMSGList (void);BOOL InitMsgQueue (PMSGQUEUE pMsgQueue, int iBufferLen);void DestroyMsgQueue (PMSGQUEUE pMsgQueue);// this struct is an internal structtypedef struct _MAINWIN{ /* * These fields are similiar with CONTROL struct. */ short DataType; // the data type. short WinType; // the window type. int left, top; // the position and size of main window. int right, bottom; int cl, ct; // the position and size of client area. int cr, cb; DWORD dwStyle; // the styles of main window. DWORD dwExStyle; // the extended styles of main window. int iBkColor; // the background color. HMENU hMenu; // handle of menu. HACCEL hAccel; // handle of accelerator table. HCURSOR hCursor; // handle of cursor. HICON hIcon; // handle of icon. HMENU hSysMenu; // handle of system menu. HDC privCDC; // the private client DC. INVRGN InvRgn; // the invalid region of this main window. PGCRINFO pGCRInfo; // pointer to global clip region info struct. PZORDERNODE pZOrderNode; // the Z order node. PCARETINFO pCaretInfo; // pointer to system caret info struct. DWORD dwAddData; // the additional data. DWORD dwAddData2; // the second addtional data. int (*MainWindowProc)(HWND, int, WPARAM, LPARAM); // the address of main window procedure. char* spCaption; // the caption of main window. int id; // the identifier of main window. SCROLLBARINFO vscroll; // the vertical scroll bar information. SCROLLBARINFO hscroll; // the horizital scroll bar information. struct _MAINWIN* pMainWin; // the main window that contains this window. // for main window, always be NULL. HWND hParent; // the parent of this window. // for main window, always be HWND_DESKTOP. /* * Child windows. */ HWND hFirstChild; // the handle of first child window. HWND hActiveChild; // the currently active child window. HWND hOldUnderPointer; // the old child window under pointer. /* * Main Window hosting. * The following members are only implemented for main window. */ struct _MAINWIN* pHosting; // the hosting main window. struct _MAINWIN* pFirstHosted; // the first hosted main window. struct _MAINWIN* pNextHosted; // the next hosted main window. PMSGQUEUE pMessages; // the message queue. GCRINFO GCRInfo; // the global clip region info struct. // put here to avoid invoking malloc function. pthread_t th; // the thread which creates this main window.}MAINWIN;typedef MAINWIN* PMAINWIN;/************************* Initialization/Termination ************************/BOOL InitGUI (void);void TerminateGUI (int rcByGUI);BOOL InitGDI( void );void TerminateGDI( void );BOOL InitFixStr (void);void TerminateFixStr (void);BOOL InitMenu (void);void TerminateMenu (void);void InitMainWinMetrics(void);BOOL InitDesktop (void);void TerminateDesktop (void);PMAINWIN GetMainWindow (HWND hWnd); // return main window contains hWnd.PMAINWIN MainWindow (HWND hWnd); // check whether hWnd is main window // and return pointer to main window hWnd.PMSGQUEUE GetMsgQueue (HWND hWnd); // return message queue of window.PGCRINFO GetGCRgnInfo (HWND hWnd); // return global clipping region of window.extern RECT g_rcScr;#define SIZE_CLIPRECTHEAP 100#define SIZE_INVRECTHEAP 150#ifdef __cplusplus}#endif /* __cplusplus */#endif // GUI_INTERNALS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -