Files
WinGUI/c_WinGUI.h
T
2026-07-28 23:35:51 +08:00

460 lines
14 KiB
C

#ifndef INCLUDED_C_WINGUI_H
#define INCLUDED_C_WINGUI_H
#ifndef INCLUDED_WINDOWS_H
#define INCLUDED_WINDOWS_H
#include <windows.h>
#endif /*INCLUDED_WINDOWS_H*/
#ifndef INCLUDED_WINDOWSX_H
#define INCLUDED_WINDOWSX_H
#include <windowsx.h>
#endif /*INCLUDED_WINDOWSX_H*/
#ifndef INCLUDED_C_WINAPP_H
#include <c_WinApp.h>
#endif /*INCLUDED_C_WINAPP_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
#define c_WinGUI_EventFn_WM_COMPACTING(fn) \
void fn(HWND hwnd, UINT compactRatio)
#define c_WinGUI_EventFn_WM_WININICHANGE(fn) \
void fn(HWND hwnd, LPCTSTR lpszSectionName)
#define c_WinGUI_EventFn_WM_SYSCOLORCHANGE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_QUERYNEWPALETTE(fn) \
WINBOOL fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_PALETTEISCHANGING(fn) \
void fn(HWND hwnd, HWND hwndPaletteChange)
#define c_WinGUI_EventFn_WM_PALETTECHANGED(fn) \
void fn(HWND hwnd, HWND hwndPaletteChange)
#define c_WinGUI_EventFn_WM_FONTCHANGE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_SPOOLERSTATUS(fn) \
void fn(HWND hwnd, UINT status, int cJobInQueue)
#define c_WinGUI_EventFn_WM_DEVMODECHANGE(fn) \
void fn(HWND hwnd, LPCTSTR lpszDeviceName)
#define c_WinGUI_EventFn_WM_TIMECHANGE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_POWER(fn) \
void fn(HWND hwnd, int code)
#define c_WinGUI_EventFn_WM_QUERYENDSESSION(fn) \
WINBOOL fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_ENDSESSION(fn) \
void fn(HWND hwnd, WINBOOL fEnding)
#define c_WinGUI_EventFn_WM_QUIT(fn) \
void fn(HWND hwnd, int exitCode)
#define c_WinGUI_EventFn_WM_SYSTEMERROR(fn) \
void fn()
#define c_WinGUI_EventFn_WM_CREATE(fn) \
WINBOOL fn(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
#define c_WinGUI_EventFn_WM_NCCREATE(fn) \
WINBOOL fn(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
#define c_WinGUI_EventFn_WM_DESTROY(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_NCDESTROY(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_SHOWWINDOW(fn) \
void fn(HWND hwnd, WINBOOL fShow, UINT status)
#define c_WinGUI_EventFn_WM_SETREDRAW(fn) \
void fn(HWND hwnd, WINBOOL fRedraw)
#define c_WinGUI_EventFn_WM_ENABLE(fn) \
void fn(HWND hwnd, WINBOOL fEnable)
#define c_WinGUI_EventFn_WM_SETTEXT(fn) \
void fn(HWND hwnd, LPCTSTR lpszText)
#define c_WinGUI_EventFn_WM_GETTEXT(fn) \
int fn(HWND hwnd, int cchTextMax, LPTSTR lpszText)
#define c_WinGUI_EventFn_WM_GETTEXTLENGTH(fn) \
int fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_WINDOWPOSCHANGING(fn) \
WINBOOL fn(HWND hwnd, LPWINDOWPOS lpwpos)
#define c_WinGUI_EventFn_WM_WINDOWPOSCHANGED(fn) \
void fn(HWND hwnd, const LPWINDOWPOS lpwpos)
#define c_WinGUI_EventFn_WM_MOVE(fn) \
void fn(HWND hwnd, int x, int y)
#define c_WinGUI_EventFn_WM_SIZE(fn) \
void fn(HWND hwnd, UINT state, int cx, int cy)
#define c_WinGUI_EventFn_WM_CLOSE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_QUERYOPEN(fn) \
WINBOOL fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_GETMINMAXINFO(fn) \
void fn(HWND hwnd, LPMINMAXINFO lpMinMaxInfo)
#define c_WinGUI_EventFn_WM_PAINT(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_ERASEBKGND(fn) \
WINBOOL fn(HWND hwnd, HDC hdc)
#define c_WinGUI_EventFn_WM_ICONERASEBKGND(fn) \
WINBOOL fn(HWND hwnd, HDC hdc)
#define c_WinGUI_EventFn_WM_NCPAINT(fn) \
void fn(HWND hwnd, HRGN hrgn)
#define c_WinGUI_EventFn_WM_NCCALCSIZE(fn) \
UINT fn(HWND hwnd, WINBOOL fCalcValidRects, NCCALCSIZE_PARAMS * lpcsp)
#define c_WinGUI_EventFn_WM_NCHITTEST(fn) \
UINT fn(HWND hwnd, int x, int y)
#define c_WinGUI_EventFn_WM_QUERYDRAGICON(fn) \
HICON fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_DROPFILES(fn) \
void fn(HWND hwnd, HDROP hdrop)
#define c_WinGUI_EventFn_WM_ACTIVATE(fn) \
void fn(HWND hwnd, UINT state, HWND hwndActDeact, WINBOOL fMinimized)
#define c_WinGUI_EventFn_WM_ACTIVATEAPP(fn) \
void fn(HWND hwnd, WINBOOL fActivate, DWORD dwThreadId)
#define c_WinGUI_EventFn_WM_NCACTIVATE(fn) \
WINBOOL fn(HWND hwnd, WINBOOL fActive, WPARAM hwndActDeact, LPARAM fMinimized)
#define c_WinGUI_EventFn_WM_SETFOCUS(fn) \
void fn(HWND hwnd, HWND hwndOldFocus)
#define c_WinGUI_EventFn_WM_KILLFOCUS(fn) \
void fn(HWND hwnd, HWND hwndNewFocus)
#define c_WinGUI_EventFn_WM_KEYDOWN(fn) \
void fn(HWND hwnd, UINT vk, WINBOOL fBool, int cRepeat, UINT flags)
#define c_WinGUI_EventFn_WM_KEYUP(fn) \
void fn(HWND hwnd, UINT vk, WINBOOL fBool, int cRepeat, UINT flags)
#define c_WinGUI_EventFn_WM_CHAR(fn) \
void fn(HWND hwnd, TCHAR ch, int cRepeat)
#define c_WinGUI_EventFn_WM_DEADCHAR(fn) \
void fn(HWND hwnd, TCHAR ch, int cRepeat)
#define c_WinGUI_EventFn_WM_SYSKEYDOWN(fn) \
void fn(HWND hwnd, UINT vk, WINBOOL fBool, int cRepeat, UINT flags)
#define c_WinGUI_EventFn_WM_SYSKEYUP(fn) \
void fn(HWND hwnd, UINT vk, WINBOOL fBool, int cRepeat, UINT flags)
#define c_WinGUI_EventFn_WM_SYSCHAR(fn) \
void fn(HWND hwnd, TCHAR ch, int cRepeat)
#define c_WinGUI_EventFn_WM_SYSDEADCHAR(fn) \
void fn(HWND hwnd, TCHAR ch, int cRepeat)
#define c_WinGUI_EventFn_WM_MOUSEMOVE(fn) \
void fn(HWND hwnd, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_LBUTTONDOWN(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_LBUTTONDBLCLK(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_LBUTTONUP(fn) \
void fn(HWND hwnd, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_RBUTTONDOWN(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_RBUTTONDBLCLK(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_RBUTTONUP(fn) \
void fn(HWND hwnd, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_MBUTTONDOWN(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_MBUTTONUP(fn) \
void fn(HWND hwnd, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_MOUSEWHEEL(fn) \
void fn(HWND hwnd, int xPos, int yPos, int zDelta, UINT fwKeys)
#define c_WinGUI_EventFn_WM_NCMOUSEMOVE(fn) \
void fn(HWND hwnd, int x, int y, UINT codeHitTest)
#define c_WinGUI_EventFn_WM_NCLBUTTONDOWN(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_NCLBUTTONUP(fn) \
void fn(HWND hwnd, int x, int y, UINT codeHitTest)
#define c_WinGUI_EventFn_WM_NCRBUTTONDOWN(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_NCRBUTTONUP(fn) \
void fn(HWND hwnd, int x, int y, UINT codeHitTest)
#define c_WinGUI_EventFn_WM_NCMBUTTONDOWN(fn) \
void fn(HWND hwnd, WINBOOL fDoubleClick, int x, int y, UINT keyFlags)
#define c_WinGUI_EventFn_WM_NCMBUTTONUP(fn) \
void fn(HWND hwnd, int x, int y, UINT codeHitTest)
#define c_WinGUI_EventFn_WM_MOUSEACTIVATE(fn) \
int fn(HWND hwnd, HWND hwndTopLevel, UINT codeHitTest, UINT msg)
#define c_WinGUI_EventFn_WM_CANCELMODE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_TIMER(fn) \
void fn(HWND hwnd, UINT id)
#define c_WinGUI_EventFn_WM_INITMENU(fn) \
void fn(HWND hwnd, HMENU hMenu)
#define c_WinGUI_EventFn_WM_INITMENUPOPUP(fn) \
void fn(HWND hwnd, HMENU hMenu, UINT item, WINBOOL fSystemMenu)
#define c_WinGUI_EventFn_WM_MENUSELECT(fn) \
void fn(HWND hwnd, HMENU hmenu, UINT item, HMENU hmenuPopup, UINT flags)
#define c_WinGUI_EventFn_WM_MENUCHAR(fn) \
DWORD fn(HWND hwnd, UINT ch, UINT flags, HMENU hmenu)
#define c_WinGUI_EventFn_WM_COMMAND(fn) \
void fn(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
#define c_WinGUI_EventFn_WM_HSCROLL(fn) \
void fn(HWND hwnd, HWND hwndCtl, UINT code, int pos)
#define c_WinGUI_EventFn_WM_VSCROLL(fn) \
void fn(HWND hwnd, HWND hwndCtl, UINT code, int pos)
#define c_WinGUI_EventFn_WM_CUT(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_COPY(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_PASTE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_CLEAR(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_UNDO(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_RENDERFORMAT(fn) \
HANDLE fn(HWND hwnd, UINT fmt)
#define c_WinGUI_EventFn_WM_RENDERALLFORMATS(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_DESTROYCLIPBOARD(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_DRAWCLIPBOARD(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_PAINTCLIPBOARD(fn) \
void fn(HWND hwnd, HWND hwndCBViewer, const LPPAINTSTRUCT lpPaintStruct)
#define c_WinGUI_EventFn_WM_SIZECLIPBOARD(fn) \
void fn(HWND hwnd, HWND hwndCBViewer, const LPRECT lprc)
#define c_WinGUI_EventFn_WM_VSCROLLCLIPBOARD(fn) \
void fn(HWND hwnd, HWND hwndCBViewer, UINT code, int pos)
#define c_WinGUI_EventFn_WM_HSCROLLCLIPBOARD(fn) \
void fn(HWND hwnd, HWND hwndCBViewer, UINT code, int pos)
#define c_WinGUI_EventFn_WM_ASKCBFORMATNAME(fn) \
void fn(HWND hwnd, int cchMax, LPTSTR rgchName)
#define c_WinGUI_EventFn_WM_CHANGECBCHAIN(fn) \
void fn(HWND hwnd, HWND hwndRemove, HWND hwndNext)
#define c_WinGUI_EventFn_WM_SETCURSOR(fn) \
WINBOOL fn(HWND hwnd, HWND hwndCursor, UINT codeHitTest, UINT msg)
#define c_WinGUI_EventFn_WM_SYSCOMMAND(fn) \
void fn(HWND hwnd, UINT cmd, int x, int y)
#define c_WinGUI_EventFn_WM_MDICREATE(fn) \
HWND fn(HWND hwnd, LPMDICREATESTRUCT lpmcs)
#define c_WinGUI_EventFn_WM_MDIDESTROY(fn) \
void fn(HWND hwnd, HWND hwndDestroy)
#define c_WinGUI_EventFn_WM_MDIACTIVATE(fn) \
void fn(HWND hwnd, WINBOOL fActive, HWND hwndActivate, HWND hwndDeactivate)
#define c_WinGUI_EventFn_WM_MDIRESTORE(fn) \
void fn(HWND hwnd, HWND hwndRestore)
#define c_WinGUI_EventFn_WM_MDINEXT(fn) \
HWND fn(HWND hwnd, HWND hwndCur, WINBOOL fPrev)
#define c_WinGUI_EventFn_WM_MDIMAXIMIZE(fn) \
void fn(HWND hwnd, HWND hwndMaximize)
#define c_WinGUI_EventFn_WM_MDITILE(fn) \
WINBOOL fn(HWND hwnd, UINT cmd)
#define c_WinGUI_EventFn_WM_MDICASCADE(fn) \
WINBOOL fn(HWND hwnd, UINT cmd)
#define c_WinGUI_EventFn_WM_MDIICONARRANGE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_MDIGETACTIVE(fn) \
HWND fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_MDISETMENU(fn) \
HMENU fn(HWND hwnd, WINBOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow)
#define c_WinGUI_EventFn_WM_CHILDACTIVATE(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_INITDIALOG(fn) \
WINBOOL fn(HWND hwnd, HWND hwndFocus, LPARAM lParam)
#define c_WinGUI_EventFn_WM_NEXTDLGCTL(fn) \
HWND fn(HWND hwnd, HWND hwndSetFocus, WINBOOL fNext)
#define c_WinGUI_EventFn_WM_PARENTNOTIFY(fn) \
void fn(HWND hwnd, UINT msg, HWND hwndChild, UINT idChild)
#define c_WinGUI_EventFn_WM_ENTERIDLE(fn) \
void fn(HWND hwnd, UINT source, HWND hwndSource)
#define c_WinGUI_EventFn_WM_GETDLGCODE(fn) \
UINT fn(HWND hwnd, LPMSG lpmsg)
#define c_WinGUI_EventFn_WM_CTLCOLORMSGBOX(fn) \
HBRUSH fn(HWND hwnd, HDC hdc, HWND hwndChild)
#define c_WinGUI_EventFn_WM_CTLCOLOREDIT(fn) \
HBRUSH fn(HWND hwnd, HDC hdc, HWND hwndChild)
#define c_WinGUI_EventFn_WM_CTLCOLORLISTBOX(fn) \
HBRUSH fn(HWND hwnd, HDC hdc, HWND hwndChild)
#define c_WinGUI_EventFn_WM_CTLCOLORBTN(fn) \
HBRUSH fn(HWND hwnd, HDC hdc, HWND hwndChild)
#define c_WinGUI_EventFn_WM_CTLCOLORDLG(fn) \
HBRUSH fn(HWND hwnd, HDC hdc, HWND hwndChild)
#define c_WinGUI_EventFn_WM_CTLCOLORSCROLLBAR(fn) \
HBRUSH fn(HWND hwnd, HDC hdc, HWND hwndChild)
#define c_WinGUI_EventFn_WM_CTLCOLORSTATIC(fn) \
HBRUSH fn(HWND hwnd, HDC hdc, HWND hwndChild)
#define c_WinGUI_EventFn_WM_SETFONT(fn) \
void fn(HWND hwnd, HFONT hfont, WINBOOL fRedraw)
#define c_WinGUI_EventFn_WM_GETFONT(fn) \
HFONT fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_DRAWITEM(fn) \
void fn(HWND hwnd, const DRAWITEMSTRUCT * lpDrawItem)
#define c_WinGUI_EventFn_WM_MEASUREITEM(fn) \
void fn(HWND hwnd, MEASUREITEMSTRUCT * lpMeasureItem)
#define c_WinGUI_EventFn_WM_DELETEITEM(fn) \
void fn(HWND hwnd, const DELETEITEMSTRUCT * lpDeleteItem)
#define c_WinGUI_EventFn_WM_COMPAREITEM(fn) \
int fn(HWND hwnd, const COMPAREITEMSTRUCT * lpCompareItem)
#define c_WinGUI_EventFn_WM_VKEYTOITEM(fn) \
int fn(HWND hwnd, UINT vk, HWND hwndListBox, int iCaret)
#define c_WinGUI_EventFn_WM_CHARTOITEM(fn) \
int fn(HWND hwnd, UINT ch, HWND hwndListBox, int iCaret)
#define c_WinGUI_EventFn_WM_QUEUESYNC(fn) \
void fn(HWND hwnd)
#define c_WinGUI_EventFn_WM_COMMNOTIFY(fn) \
void fn(HWND hwnd, int cid, UINT flags)
#define c_WinGUI_EventFn_WM_DISPLAYCHANGE(fn) \
void fn(HWND hwnd, UINT bitsPerPixel, UINT cxScreen, UINT cyScreen)
#define c_WinGUI_EventFn_WM_DEVICECHANGE(fn) \
WINBOOL fn(HWND hwnd, UINT uEvent, DWORD dwEventData)
#define c_WinGUI_EventFn_WM_CONTEXTMENU(fn) \
void fn(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos)
#define c_WinGUI_EventFn_WM_COPYDATA(fn) \
WINBOOL fn(HWND hwnd, HWND hwndFrom, PCOPYDATASTRUCT pcds)
#define c_WinGUI_EventFn_WM_HOTKEY(fn) \
void fn(HWND hwnd, int idHotKey, UINT fuModifiers, UINT vk)
#define c_WinGUI_EventFn_WM_USERDEFINED(fn) \
LRESULT fn(HWND hwnd, WPARAM wParam, LPARAM lParam)
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
#define c_WinGUI_EventMapBegin(fn) \
static LRESULT CALLBACK fn(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ \
switch (msg){
#define c_WinGUI_EventMap(message, fn) \
case message: return HANDLE_##message(hwnd, wParam, lParam, fn)
#define c_WinGUI_UDEventMap(message, fn) \
case message: return fn(hwnd, wParam, lParam)
#define c_WinGUI_EventMapEnd() \
default: return DefWindowProc(hwnd, msg, wParam, lParam); \
} \
}
#define c_WinGUI_EventHandlerDef(message, fn) \
static c_WinGUI_EventFn_##message(fn)
#define c_WinGUI_Main() \
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
#endif /*INCLUDED_C_WINGUI_H*/