Add more win32 bindings

This commit is contained in:
bplu4t2f
2026-01-03 12:07:47 +01:00
parent 7e39669fd1
commit 808c14f60f
3 changed files with 78 additions and 2 deletions

View File

@@ -34,7 +34,6 @@ foreign gdi32 {
SetDCBrushColor :: proc(hdc: HDC, color: COLORREF) -> COLORREF ---
GetDCBrushColor :: proc(hdc: HDC) -> COLORREF ---
PatBlt :: proc(hdc: HDC, x, y, w, h: INT, rop: DWORD) -> BOOL ---
Rectangle :: proc(hdc: HDC, left, top, right, bottom: INT) -> BOOL ---
CreateFontW :: proc(cHeight, cWidth, cEscapement, cOrientation, cWeight: INT, bItalic, bUnderline, bStrikeOut, iCharSet, iOutPrecision: DWORD, iClipPrecision, iQuality, iPitchAndFamily: DWORD, pszFaceName: LPCWSTR) -> HFONT ---
CreateFontIndirectW :: proc(lplf: ^LOGFONTW) -> HFONT ---
@@ -70,12 +69,20 @@ foreign gdi32 {
RealizePalette :: proc(hdc: HDC) -> UINT ---
SetTextColor :: proc(hdc: HDC, color: COLORREF) -> COLORREF ---
RoundRect :: proc(hdc: HDC, left: INT, top: INT, right: INT, bottom: INT, width: INT, height: INT) -> BOOL ---
SetPixel :: proc(hdc: HDC, x: INT, y: INT, color: COLORREF) -> COLORREF ---
GdiTransparentBlt :: proc(hdcDest: HDC, xoriginDest, yoriginDest, wDest, hDest: INT, hdcSrc: HDC, xoriginSrc, yoriginSrc, wSrc, hSrc: INT, crTransparent: UINT) -> BOOL ---
GdiGradientFill :: proc(hdc: HDC, pVertex: PTRIVERTEX, nVertex: ULONG, pMesh: PVOID, nCount: ULONG, ulMode: ULONG) -> BOOL ---
GdiAlphaBlend :: proc(hdcDest: HDC, xoriginDest, yoriginDest, wDest, hDest: INT, hdcSrc: HDC, xoriginSrc, yoriginSrc, wSrc, hSrc: INT, ftn: BLENDFUNCTION) -> BOOL ---
// Filled Shape Functions
Rectangle :: proc(hdc: HDC, left, top, right, bottom: c_int) -> BOOL ---
Ellipse :: proc(hdc: HDC, left, top, right, bottom: c_int) -> BOOL ---
RoundRect :: proc(hdc: HDC, left, top, right, bottom, width, height: c_int) -> BOOL ---
Pie :: proc(hdc: HDC, left, right, top, bottom, xr1, yr1, xr2, yr2: c_int) -> BOOL ---
Chord :: proc(hdc: HDC, x1, y1, x2, y2, x3, y3, x4, y4: c_int) -> BOOL ---
Polygon :: proc(hdc: HDC, apt: [^]POINT, cpt: c_int) -> BOOL ---
PolyPolygon :: proc(hdc: HDC, apt: [^]POINT, asz: [^]c_int, csz: c_int) -> BOOL ---
}
@(require_results)

View File

@@ -58,6 +58,7 @@ foreign user32 {
IsZoomed :: proc(hwnd: HWND) -> BOOL ---
BringWindowToTop :: proc(hWnd: HWND) -> BOOL ---
GetTopWindow :: proc(hWnd: HWND) -> HWND ---
GetWindow :: proc(hwnd: HWND, uCmd: UINT) -> HWND ---
SetForegroundWindow :: proc(hWnd: HWND) -> BOOL ---
GetForegroundWindow :: proc() -> HWND ---
GetDesktopWindow :: proc() -> HWND ---
@@ -279,6 +280,7 @@ foreign user32 {
FillRect :: proc(hDC: HDC, lprc: ^RECT, hbr: HBRUSH) -> c_int ---
FrameRect :: proc(hDC: HDC, lprc: ^RECT, hbr: HBRUSH) -> c_int ---
InvertRect :: proc(hDC: HDC, lprc: ^RECT) -> BOOL ---
EqualRect :: proc(lprc1, lprc2: ^RECT) -> BOOL ---
OffsetRect :: proc(lprc1: ^RECT, dx, dy: INT) -> BOOL ---
InflateRect :: proc(lprc1: ^RECT, dx, dy: INT) -> BOOL ---
@@ -939,3 +941,13 @@ ESB_DISABLE_UP :: 0x0001
ESB_DISABLE_DOWN :: 0x0002
ESB_DISABLE_LTUP :: ESB_DISABLE_LEFT
ESB_DISABLE_RTDN :: ESB_DISABLE_RIGHT
// Command constants for GetWindow
GW_HWNDFIRST :: 0
GW_HWNDLAST :: 1
GW_HWNDNEXT :: 2
GW_HWNDPREV :: 3
GW_OWNER :: 4
GW_CHILD :: 5
GW_ENABLEDPOPUP :: 6
GW_MAX :: 6

View File

@@ -14,5 +14,62 @@ PMARGINS :: ^MARGINS
@(default_calling_convention="system")
foreign uxtheme {
IsThemeActive :: proc() -> BOOL ---
GetWindowTheme :: proc(hwnd: HWND) -> HTHEME ---
SetWindowTheme :: proc(hWnd: HWND, pszSubAppName, pszSubIdList: LPCWSTR) -> HRESULT ---
// Buffered painting and buffered animation
BufferedPaintInit :: proc() -> HRESULT ---
BufferedPaintUnInit :: proc() -> HRESULT ---
BeginBufferedPaint :: proc(hdcTarget: HDC, prcTarget: ^RECT, dwFormat: BP_BUFFERFORMAT, pPaintParams: ^BP_PAINTPARAMS, phdc: ^HDC) -> HPAINTBUFFER ---
EndBufferedPaint :: proc(hBufferedPaint: HPAINTBUFFER, fUpdateTarget: BOOL) -> HRESULT ---
GetBufferedPaintTargetRect :: proc(hBufferedPaint: HPAINTBUFFER, prc: ^RECT) -> HRESULT ---
GetBufferedPaintTargetDC :: proc(hBufferedPaint: HPAINTBUFFER) -> HDC ---
GetBufferedPaintDC :: proc(hBufferedPaint: HPAINTBUFFER) -> HDC ---
GetBufferedPaintBits :: proc(hBufferedPaint, ppbBuffer: ^[^]RGBQUAD, pcxRow: ^c_int) -> HRESULT ---
BufferedPaintClear :: proc(hBufferedPaint: HPAINTBUFFER, prc: ^RECT) -> HRESULT ---
BufferedPaintSetAlpha :: proc(hBufferedPaint: HPAINTBUFFER, prc: ^RECT, alpha: BYTE) -> HRESULT ---
BufferedPaintStopAllAnimations :: proc(hwnd: HWND) -> HRESULT ---
BeginBufferedAnimation :: proc(hwnd: HWND, hdcTarget: HDC, prcTarget: ^RECT, dwFormat: BP_BUFFERFORMAT, pPaintParams: ^BP_PAINTPARAMS, pAnimationParams: ^BP_ANIMATIONPARAMS, phdcFrom: ^HDC, phdcTo: ^HDC) -> HANIMATIONBUFFER ---
BufferedPaintRenderAnimation :: proc(hwnd: HWND, hdcTarget: HDC) -> BOOL ---
}
HTHEME :: distinct HANDLE
HPAINTBUFFER :: distinct HANDLE
HANIMATIONBUFFER :: distinct HANDLE
BP_BUFFERFORMAT :: enum c_int {
BPBF_COMPATIBLEBITMAP,
BPBF_DIB,
BPBF_TOPDOWNDIB,
BPBF_TOPDOWNMONODIB,
}
BP_ANIMATIONSTYLE :: enum c_int {
BPAS_NONE,
BPAS_LINEAR,
BPAS_CUBIC,
BPAS_SINE,
}
// Constants for BP_PAINTPARAMS.dwFlags
BPPF_ERASE :: 0x0001
BPPF_NOCLIP :: 0x0002
BPPF_NONCLIENT :: 0x0004
BP_ANIMATIONPARAMS :: struct {
cbSize: DWORD,
dwFlags: DWORD,
style: BP_ANIMATIONSTYLE,
dwDuration: DWORD,
}
BP_PAINTPARAMS :: struct {
cbSize: DWORD,
dwFlags: DWORD,
prcExclude: ^RECT,
pBlendFunction: ^BLENDFUNCTION,
}