diff --git a/core/sys/windows/gdi32.odin b/core/sys/windows/gdi32.odin index 2caf42753..15d5567c7 100644 --- a/core/sys/windows/gdi32.odin +++ b/core/sys/windows/gdi32.odin @@ -14,7 +14,7 @@ foreign gdi32 { hdc: HDC, pbmih: ^BITMAPINFOHEADER, flInit: DWORD, - pjBits: ^VOID, + pjBits: VOID, pbmi: ^BITMAPINFO, iUsage: UINT, ) -> HBITMAP --- @@ -23,7 +23,7 @@ foreign gdi32 { hdc: HDC, pbmi: ^BITMAPINFO, usage: UINT, - ppvBits: ^^VOID, + ppvBits: VOID, hSection: HANDLE, offset: DWORD, ) -> HBITMAP --- @@ -38,7 +38,7 @@ foreign gdi32 { ySrc: c_int, SrcWidth: c_int, SrcHeight: c_int, - lpBits: ^VOID, + lpBits: VOID, lpbmi: ^BITMAPINFO, iUsage: UINT, rop: DWORD, diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin index 9a4a1ab5e..bd6eba24e 100644 --- a/core/sys/windows/types.odin +++ b/core/sys/windows/types.odin @@ -312,6 +312,65 @@ CREATESTRUCTW:: struct { dwExStyle: DWORD, } +// MessageBox() Flags +MB_OK :: 0x00000000 +MB_OKCANCEL :: 0x00000001 +MB_ABORTRETRYIGNORE :: 0x00000002 +MB_YESNOCANCEL :: 0x00000003 +MB_YESNO :: 0x00000004 +MB_RETRYCANCEL :: 0x00000005 +MB_CANCELTRYCONTINUE :: 0x00000006 + +MB_ICONHAND :: 0x00000010 +MB_ICONQUESTION :: 0x00000020 +MB_ICONEXCLAMATION :: 0x00000030 +MB_ICONASTERISK :: 0x00000040 +MB_USERICON :: 0x00000080 +MB_ICONWARNING :: MB_ICONEXCLAMATION +MB_ICONERROR :: MB_ICONHAND +MB_ICONINFORMATION :: MB_ICONASTERISK +MB_ICONSTOP :: MB_ICONHAND + +MB_DEFBUTTON1 :: 0x00000000 +MB_DEFBUTTON2 :: 0x00000100 +MB_DEFBUTTON3 :: 0x00000200 +MB_DEFBUTTON4 :: 0x00000300 + +MB_APPLMODAL :: 0x00000000 +MB_SYSTEMMODAL :: 0x00001000 +MB_TASKMODAL :: 0x00002000 +MB_HELP :: 0x00004000 // Help Button + +MB_NOFOCUS :: 0x00008000 +MB_SETFOREGROUND :: 0x00010000 +MB_DEFAULT_DESKTOP_ONLY :: 0x00020000 +MB_TOPMOST :: 0x00040000 +MB_RIGHT :: 0x00080000 +MB_RTLREADING :: 0x00100000 + +MB_SERVICE_NOTIFICATION :: 0x00200000 +MB_SERVICE_NOTIFICATION_NT3X :: 0x00040000 + +MB_TYPEMASK :: 0x0000000F +MB_ICONMASK :: 0x000000F0 +MB_DEFMASK :: 0x00000F00 +MB_MODEMASK :: 0x00003000 +MB_MISCMASK :: 0x0000C000 + +// Dialog Box Command IDs +IDOK :: 1 +IDCANCEL :: 2 +IDABORT :: 3 +IDRETRY :: 4 +IDIGNORE :: 5 +IDYES :: 6 +IDNO :: 7 +IDCLOSE :: 8 +IDHELP :: 9 +IDTRYAGAIN :: 10 +IDCONTINUE :: 11 +IDTIMEOUT :: 32000 + CS_VREDRAW : UINT : 0x0001 CS_HREDRAW : UINT : 0x0002 CS_DBLCLKS : UINT : 0x0008 @@ -399,6 +458,30 @@ SW_RESTORE : c_int : 9 SW_SHOWDEFAULT : c_int : 10 SW_FORCEMINIMIZE : c_int : 11 +// SetWindowPos Flags +SWP_NOSIZE :: 0x0001 +SWP_NOMOVE :: 0x0002 +SWP_NOZORDER :: 0x0004 +SWP_NOREDRAW :: 0x0008 +SWP_NOACTIVATE :: 0x0010 +SWP_FRAMECHANGED :: 0x0020 // The frame changed: send WM_NCCALCSIZE +SWP_SHOWWINDOW :: 0x0040 +SWP_HIDEWINDOW :: 0x0080 +SWP_NOCOPYBITS :: 0x0100 +SWP_NOOWNERZORDER :: 0x0200 // Don't do owner Z ordering +SWP_NOSENDCHANGING :: 0x0400 // Don't send WM_WINDOWPOSCHANGING + +SWP_DRAWFRAME :: SWP_FRAMECHANGED +SWP_NOREPOSITION :: SWP_NOOWNERZORDER + +SWP_DEFERERASE :: 0x2000 // same as SWP_DEFERDRAWING +SWP_ASYNCWINDOWPOS :: 0x4000 // same as SWP_CREATESPB + +HWND_TOP :: 0 +HWND_BOTTOM :: 1 +HWND_TOPMOST :: -1 +HWND_NOTOPMOST :: -2 + CW_USEDEFAULT : c_int : -2147483648 SIZE_RESTORED :: 0 @@ -416,6 +499,15 @@ WMSZ_BOTTOM :: 6 WMSZ_BOTTOMLEFT :: 7 WMSZ_BOTTOMRIGHT :: 8 +// Key State Masks for Mouse Messages +MK_LBUTTON :: 0x0001 +MK_RBUTTON :: 0x0002 +MK_SHIFT :: 0x0004 +MK_CONTROL :: 0x0008 +MK_MBUTTON :: 0x0010 +MK_XBUTTON1 :: 0x0020 +MK_XBUTTON2 :: 0x0040 + _IDC_APPSTARTING := rawptr(uintptr(32650)) _IDC_ARROW := rawptr(uintptr(32512)) _IDC_CROSS := rawptr(uintptr(32515)) @@ -837,6 +929,15 @@ FILE_TYPE_PIPE :: 0x0003 RECT :: struct {left, top, right, bottom: LONG} POINT :: struct {x, y: LONG} +WINDOWPOS :: struct { + hwnd: HWND, + hwndInsertAfter: HWND, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + flags: UINT, +} when size_of(uintptr) == 4 { WSADATA :: struct { diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin index fc001f26b..2336878ef 100644 --- a/core/sys/windows/user32.odin +++ b/core/sys/windows/user32.odin @@ -97,6 +97,15 @@ foreign user32 { LoadCursorW :: proc(hInstance: HINSTANCE, lpCursorName: LPCWSTR) -> HCURSOR --- GetClientRect :: proc(hWnd: HWND, lpRect: ^RECT) -> BOOL --- + SetWindowPos :: proc( + hWnd: HWND, + hWndInsertAfter: HWND, + X: c_int, + Y: c_int, + cx: c_int, + cy: c_int, + uFlags: UINT, + ) -> BOOL --- GetWindowDC :: proc(hWnd: HWND) -> HDC --- GetDC :: proc(hWnd: HWND) -> HDC --- @@ -111,6 +120,11 @@ foreign user32 { GetKeyState :: proc(nVirtKey: c_int) -> SHORT --- GetAsyncKeyState :: proc(vKey: c_int) -> SHORT --- + + MessageBoxA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT) -> c_int --- + MessageBoxW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT) -> c_int --- + MessageBoxExA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT, wLanguageId: WORD) -> c_int --- + MessageBoxExW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT, wLanguageId: WORD) -> c_int --- } CreateWindowA :: #force_inline proc "stdcall" (