aboutsummaryrefslogtreecommitdiff
path: root/core/sys
diff options
context:
space:
mode:
authorbplu4t2f <bplu4t2f@gmail.com>2026-01-03 12:07:47 +0100
committerbplu4t2f <bplu4t2f@gmail.com>2026-01-24 09:54:41 +0100
commit808c14f60f3753e9030de8a8d9086dacb341c414 (patch)
treed920db6dc757775e852ebab0fd8fd798b9d741ca /core/sys
parent7e39669fd1f4bc67a801d0dc5ba6eadffc7de3e5 (diff)
Add more win32 bindings
Diffstat (limited to 'core/sys')
-rw-r--r--core/sys/windows/gdi32.odin11
-rw-r--r--core/sys/windows/user32.odin12
-rw-r--r--core/sys/windows/ux_theme.odin57
3 files changed, 78 insertions, 2 deletions
diff --git a/core/sys/windows/gdi32.odin b/core/sys/windows/gdi32.odin
index 756ec5011..ad2243b56 100644
--- a/core/sys/windows/gdi32.odin
+++ b/core/sys/windows/gdi32.odin
@@ -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)
diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin
index cd3efdeb7..580c09b45 100644
--- a/core/sys/windows/user32.odin
+++ b/core/sys/windows/user32.odin
@@ -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
diff --git a/core/sys/windows/ux_theme.odin b/core/sys/windows/ux_theme.odin
index 4ce126c73..e19800246 100644
--- a/core/sys/windows/ux_theme.odin
+++ b/core/sys/windows/ux_theme.odin
@@ -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,
}