root / trunk / pysoy / include / windows.pxd

Revision 1265, 4.3 kB (checked in by ArcRiley, 5 months ago)

Pyrex 0.9.8.2 fixes :

  • now requires 0.9.8.2
  • nogil goes everywhere
  • a few functions got GIL-cleaned
  • still doesn't compile, but many steps closer
  • Property svn:keywords set to Id
Line 
1# PySoy Windows API Declarations
2#
3# Copyright (C) 2006,2007,2008 PySoy Group
4#
5#  This program is free software; you can redistribute it and/or modify
6#  it under the terms of the GNU Affero General Public License as published
7#  by the Free Software Foundation, either version 3 of the License, or
8#  (at your option) any later version.
9#
10#  This program is distributed in the hope that it will be useful,
11#  but WITHOUT ANY WARRANTY; without even the implied warranty of
12#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#  GNU Affero General Public License for more details.
14#
15#  You should have received a copy of the GNU Affero General Public License
16#  along with this program; if not, see http://www.gnu.org/licenses
17#
18# $Id$
19
20cdef extern from "windows.h" nogil :
21  ctypedef void* HDC # handle to device context
22  ctypedef void* HGLRC # handle to GL rendering context
23  ctypedef void* HWND # handle to window
24  ctypedef void* HINSTANCE
25  ctypedef void* HANDLE
26  ctypedef int BOOL
27  ctypedef long LONG
28  ctypedef unsigned long DWORD
29  ctypedef unsigned short WORD
30  ctypedef WORD ATOM
31  ctypedef unsigned int UINT
32  ctypedef long long LONGLONG
33  ctypedef unsigned int UINT_PTR
34  ctypedef long long LONG_PTR
35  ctypedef UINT_PTR WPARAM
36  ctypedef LONG_PTR LPARAM
37  ctypedef LONG_PTR LRESULT
38
39  ctypedef LRESULT (__stdcall *WNDPROC)(HWND, UINT, WPARAM, LPARAM)
40  cdef LRESULT DefWindowProc(HWND, UINT, WPARAM, LPARAM)
41
42  ctypedef struct RECT:
43    LONG left
44    LONG top
45    LONG right
46    LONG bottom
47
48  cdef BOOL AdjustWindowRectEx(RECT*, DWORD, BOOL, DWORD)
49
50  ctypedef struct WNDCLASS:
51    UINT style
52    WNDPROC lpfnWndProc
53    int cbClsExtra
54    int cbWndExtra
55    HINSTANCE hInstance
56    void* hIcon
57    void* hCursor
58    void* hBrush
59    char* lpszMenuName
60    char* lpszClassName
61
62  cdef void Sleep(DWORD)
63 
64  cdef LRESULT SendMessage(HWND, UINT, WPARAM, LPARAM)
65  cdef BOOL SendNotifyMessage(HWND, UINT, WPARAM, LPARAM)
66  cdef BOOL SetWindowText(HWND, char*)
67 
68  cdef ATOM RegisterClass(WNDCLASS*)
69
70  cdef HWND CreateWindow(char*, char*, DWORD, int, int, int, int,
71                         HWND, void*, HINSTANCE, void*)
72  cdef BOOL DestroyWindow(HWND)
73  cdef BOOL IsWindowVisible(HWND)
74  cdef BOOL ShowWindow(HWND, int)
75  cdef BOOL SetForegroundWindow(HWND)
76  cdef HDC GetDC(HWND)
77  cdef int ReleaseDC(HWND, HDC)
78  cdef BOOL DeleteDC(HDC)
79  cdef HGLRC wglCreateContext(HDC)
80  cdef BOOL wglMakeCurrent(HDC, HGLRC)
81  cdef BOOL wglDeleteContext(HGLRC)
82  cdef BOOL SwapBuffers(HDC)
83
84  cdef HANDLE GetCurrentThread()
85  cdef DWORD GetCurrentThreadId()
86
87  ctypedef struct POINT:
88    LONG x
89    LONG y
90  cdef WORD HIWORD(DWORD)
91  cdef WORD LOWORD(DWORD)
92  # Messages
93  ctypedef struct MSG:
94    HWND hwnd
95    UINT message
96    WPARAM wParam
97    LPARAM lParam
98    DWORD time
99    POINT pt
100  cdef BOOL PeekMessage(MSG*, HWND, UINT, UINT, UINT)
101  cdef BOOL GetMessage(MSG*, HWND, UINT, UINT)
102  cdef LRESULT DispatchMessage(MSG*)
103  cdef BOOL TranslateMessage(MSG*)
104
105  # Technically, this returns an HMODULE, but for our purposes, this is
106  # Good Enough.
107  cdef HINSTANCE GetModuleHandle(char*)
108  cdef void* LoadCursor(HINSTANCE, char*)
109  cdef char *IDC_ARROW
110
111  ctypedef struct FILETIME:
112    DWORD dwLowDateTime
113    DWORD dwHighDateTime
114  ctypedef union LARGE_INTEGER:
115    DWORD LowPart
116    LONG HighPart
117    LONGLONG QuadPart
118  cdef void GetSystemTimeAsFileTime(FILETIME*)
119
120  ctypedef enum:
121    CS_HREDRAW
122    CS_VREDRAW
123    CS_OWNDC
124
125    PM_REMOVE
126
127    WM_SIZE
128    WM_PAINT
129    WM_SETTEXT
130    WM_CLOSE
131    WM_KEYDOWN
132    WM_KEYUP
133    WM_CHAR
134
135    SW_SHOW
136
137    SIZE_MINIMIZED
138
139
140cdef extern from "support.c":
141  cdef ATOM register_class(HINSTANCE, WNDPROC)
142  cdef BOOL unregister_class(HINSTANCE)
143  cdef HWND make_window(HINSTANCE, char*, int, int, int, int, int)
144  cdef int set_pixel_format(HDC)
145  cdef BOOL set_window_pos(HWND window, int x, int y)
146  cdef BOOL get_window_pos(HWND window, int* x, int* y)
147  cdef BOOL set_window_size(HWND window, int width, int height)
148  cdef BOOL get_window_size(HWND window, int* width, int* height)
149  #cdef HDC get_display_hdc()
150  cdef void get_screen_info(int* width, int* height, int* depth)
151  cdef int minimize ( HWND window )
152  cdef int maximize ( HWND window )
153
154# vim: sts=2:sw=2:et
155
Note: See TracBrowser for help on using the browser.