Slight 1 pixel adjustment on the position of the radio button bitmap.
[wine/hacks.git] / include / windowsx.h
blob7e28af68ebe0fb61dc8138870c71e7d98d4ec4cc
1 /* Copyright (C) 1999 Corel Corporation (Paul Quinn) */
3 #ifndef __WINE_WINDOWSX_H
4 #define __WINE_WINDOWSX_H
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 #define _INC_WINDOWSX
12 #define GET_WM_VSCROLL_CODE(wp, lp) LOWORD(wp)
13 #define GET_WM_VSCROLL_POS(wp, lp) HIWORD(wp)
14 #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)(lp)
15 #define GET_WM_VSCROLL_MPS(code, pos, hwnd) (WPARAM)MAKELONG(code, pos), (LONG)(hwnd)
18 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
19 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
20 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
21 #define GET_WM_COMMAND_MPS(id, hwnd, cmd) (WPARAM)MAKELONG(id, cmd), (LONG)(hwnd)
23 #define WM_CTLCOLOR 0x0019
25 #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
26 #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)(lp)
27 #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) (WORD)(msg - WM_CTLCOLORMSGBOX)
28 #define GET_WM_CTLCOLOR_MSG(type) (WORD)(WM_CTLCOLORMSGBOX+(type))
29 #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) (WPARAM)(hdc), (LONG)(hwnd)
31 #define GET_WM_VKEYTOITEM_CODE(wp, lp) (int)(short)LOWORD(wp)
32 #define GET_WM_VKEYTOITEM_ITEM(wp, lp) HIWORD(wp)
33 #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)(lp)
34 #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) (WPARAM)MAKELONG(item, code), (LONG)(hwnd)
36 /****** USER Macro APIs ******************************************************/
38 #define GetWindowInstance(hwnd) ((HMODULE)GetWindowLong(hwnd, GWL_HINSTANCE))
40 #define GetWindowStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_STYLE))
41 #define GetWindowExStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_EXSTYLE))
43 #define GetWindowOwner(hwnd) GetWindow(hwnd, GW_OWNER)
45 #define GetFirstChild(hwnd) GetTopWindow(hwnd)
46 #define GetFirstSibling(hwnd) GetWindow(hwnd, GW_HWNDFIRST)
47 #define GetLastSibling(hwnd) GetWindow(hwnd, GW_HWNDLAST)
48 #define GetNextSibling(hwnd) GetWindow(hwnd, GW_HWNDNEXT)
49 #define GetPrevSibling(hwnd) GetWindow(hwnd, GW_HWNDPREV)
51 #define GetWindowID(hwnd) GetDlgCtrlID(hwnd)
53 #define SetWindowRedraw(hwnd, fRedraw) \
54 ((void)SendMessage(hwnd, WM_SETREDRAW, (WPARAM)(BOOL)(fRedraw), 0L))
55 #define SubclassWindow(hwnd, lpfn) \
56 ((WNDPROC)SetWindowLong((hwnd), GWL_WNDPROC, (LPARAM)(WNDPROC)(lpfn)))
58 #define IsMinimized(hwnd) IsIconic(hwnd)
59 #define IsMaximized(hwnd) IsZoomed(hwnd)
60 #define IsRestored(hwnd) ((GetWindowStyle(hwnd) & (WS_MINIMIZE | WS_MAXIMIZE)) == 0L)
61 #define SetWindowFont(hwnd, hfont, fRedraw) \
62 FORWARD_WM_SETFONT((hwnd), (hfont), (fRedraw), SendMessage)
64 #define GetWindowFont(hwnd) FORWARD_WM_GETFONT((hwnd), SendMessage)
66 #define MapWindowRect(hwndFrom, hwndTo, lprc) \
67 MapWindowPoints((hwndFrom), (hwndTo), (POINT *)(lprc), 2)
69 #define IsLButtonDown() (GetKeyState(VK_LBUTTON) < 0)
70 #define IsRButtonDown() (GetKeyState(VK_RBUTTON) < 0)
71 #define IsMButtonDown() (GetKeyState(VK_MBUTTON) < 0)
73 #define SubclassDialog(hwndDlg, lpfn) \
74 ((DLGPROC)SetWindowLong(hwndDlg, DWL_DLGPROC, (LPARAM)(DLGPROC)(lpfn)))
76 #define DeletePen(hpen) DeleteObject((HGDIOBJ)(HPEN)(hpen))
77 #define SelectPen(hdc, hpen) ((HPEN)SelectObject((hdc), (HGDIOBJ)(HPEN)(hpen)))
78 #define GetStockPen(i) ((HPEN)GetStockObject(i))
80 #define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr))
81 #define SelectBrush(hdc, hbr) ((HBRUSH)SelectObject((hdc), (HGDIOBJ)(HBRUSH)(hbr)))
82 #define GetStockBrush(i) ((HBRUSH)GetStockObject(i))
84 #define DeletePalette(hpal) DeleteObject((HGDIOBJ)(HPALETTE)(hpal))
86 #define DeleteFont(hfont) DeleteObject((HGDIOBJ)(HFONT)(hfont))
87 #define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT) (hfont)))
88 #define GetStockFont(i) ((HFONT)GetStockObject(i))
89 #define DeleteBitmap(hbm) DeleteObject((HGDIOBJ)(HBITMAP)(hbm))
90 #define SelectBitmap(hdc, hbm) ((HBITMAP)SelectObject((hdc), (HGDIOBJ)(HBITMAP)(hbm)))
91 #define InsetRect(lprc, dx, dy) InflateRect((lprc), -(dx), -(dy))
93 /* COMBOBOX Message APIs */
94 #define ComboBox_GetCount(hwndCtl) \
95 ((int)(DWORD)SendMessage((hwndCtl), CB_GETCOUNT, 0L, 0L))
97 #define ComboBox_GetCurSel(hwndCtl) \
98 ((int)(DWORD)SendMessage((hwndCtl), CB_GETCURSEL, 0L, 0L))
100 #define ComboBox_SetCurSel(hwndCtl, index) \
101 ((int)(DWORD)SendMessage((hwndCtl), CB_SETCURSEL, (WPARAM)(int)(index), 0L))
103 #define ComboBox_GetLBTextLen(hwndCtl, index) \
104 ((int)(DWORD)SendMessage((hwndCtl), CB_GETLBTEXTLEN, (WPARAM)(int)(index), 0L))
106 #define ComboBox_DeleteString(hwndCtl, index) \
107 ((int)(DWORD)SendMessage((hwndCtl), CB_DELETESTRING, (WPARAM)(int)(index), 0L))
109 #define ComboBox_FindString(hwndCtl, indexStart, lpszFind) \
110 ((int)(DWORD)SendMessage((hwndCtl), CB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
112 #define ComboBox_ResetContent(hwndCtl) \
113 ((int)(DWORD)SendMessage((hwndCtl), CB_RESETCONTENT, 0L, 0L))
115 #define ComboBox_AddString(hwndCtl, lpsz) \
116 ((int)(DWORD)SendMessage((hwndCtl), CB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(lpsz)))
117 #define ComboBox_GetLBTextLen(hwndCtl, index) \
118 ((int)(DWORD)SendMessage((hwndCtl), CB_GETLBTEXTLEN, (WPARAM)(int)(index), 0L))
119 #define ComboBox_GetLBText(hwndCtl, index, lpszBuffer) \
120 ((int)(DWORD)SendMessage((hwndCtl), CB_GETLBTEXT, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpszBuffer)))
122 #define ComboBox_GetDroppedState(hwndCtl) \
123 ((BOOL)(DWORD)SendMessage((hwndCtl), CB_GETDROPPEDSTATE, 0L, 0L))
124 #define ComboBox_GetDroppedControlRect(hwndCtl, lprc) \
125 ((void)SendMessage((hwndCtl), CB_GETDROPPEDCONTROLRECT, 0L, (LPARAM)(RECT *)(lprc)))
127 /****** ListBox control message APIs *****************************************/
129 #define ListBox_Enable(hwndCtl, fEnable) EnableWindow((hwndCtl), (fEnable))
130 #define ListBox_GetCount(hwndCtl) \
131 ((int)(DWORD)SendMessage((hwndCtl), LB_GETCOUNT, 0L, 0L))
132 #define ListBox_ResetContent(hwndCtl) \
133 ((BOOL)(DWORD)SendMessage((hwndCtl), LB_RESETCONTENT, 0L, 0L))
135 #define ListBox_GetItemData(hwndCtl, index) \
136 ((LRESULT)(DWORD)SendMessage((hwndCtl), LB_GETITEMDATA, (WPARAM)(int)(index), 0L))
138 #define ListBox_GetCurSel(hwndCtl) \
139 ((int)(DWORD)SendMessage((hwndCtl), LB_GETCURSEL, 0L, 0L))
140 #define ListBox_SetCurSel(hwndCtl, index) \
141 ((int)(DWORD)SendMessage((hwndCtl), LB_SETCURSEL, (WPARAM)(int)(index), 0L))
143 #define ListBox_AddString(hwndCtl, lpsz) \
144 ((int)(DWORD)SendMessage((hwndCtl), LB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(lpsz)))
145 #define ListBox_InsertString(hwndCtl, index, lpsz) \
146 ((int)(DWORD)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpsz)))
148 #define ListBox_AddItemData(hwndCtl, data) \
149 ((int)(DWORD)SendMessage((hwndCtl), LB_ADDSTRING, 0L, (LPARAM)(data)))
150 #define ListBox_InsertItemData(hwndCtl, index, data) \
151 ((int)(DWORD)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(data)))
153 #define ListBox_FindString(hwndCtl, indexStart, lpszFind) \
154 ((int)(DWORD)SendMessage((hwndCtl), LB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
155 #define ListBox_FindStringExact(hwndCtl, indexStart, lpszFind) \
156 ((int)(DWORD)SendMessage((hwndCtl), LB_FINDSTRINGEXACT, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
158 #define Edit_LineFromChar(hwndCtl, ich) \
159 ((int)(DWORD)SendMessage((hwndCtl), EM_LINEFROMCHAR, (WPARAM)(int)(ich), 0L))
160 #define Edit_LineIndex(hwndCtl, line) \
161 ((int)(DWORD)SendMessage((hwndCtl), EM_LINEINDEX, (WPARAM)(int)(line), 0L))
162 #define Edit_LineLength(hwndCtl, line) \
163 ((int)(DWORD)SendMessage((hwndCtl), EM_LINELENGTH, (WPARAM)(int)(line), 0L))
165 /****** Edit control message APIs ********************************************/
167 #define Edit_SetSel(hwndCtl, ichStart, ichEnd) \
168 ((void)SendMessage((hwndCtl), EM_SETSEL, (ichStart), (ichEnd)))
170 #define Edit_GetText(hwndCtl, lpch, cchMax) GetWindowText((hwndCtl), (lpch), (cchMax))
171 #define Edit_GetTextLength(hwndCtl) GetWindowTextLength(hwndCtl)
172 #define Edit_SetText(hwndCtl, lpsz) SetWindowText((hwndCtl), (lpsz))
174 #define Edit_GetModify(hwndCtl) \
175 ((BOOL)(DWORD)SendMessage((hwndCtl), EM_GETMODIFY, 0L, 0L))
176 #define Edit_SetModify(hwndCtl, fModified) \
177 ((void)SendMessage((hwndCtl), EM_SETMODIFY, (WPARAM)(UINT)(fModified), 0L))
179 /* void Cls_OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT * lpMeasureItem) */
180 #define HANDLE_WM_MEASUREITEM(hwnd, wParam, lParam, fn) \
181 ((fn)((hwnd), (MEASUREITEMSTRUCT *)(lParam)), 0L)
182 #define FORWARD_WM_MEASUREITEM(hwnd, lpMeasureItem, fn) \
183 (void)(fn)((hwnd), WM_MEASUREITEM, (WPARAM)(((MEASUREITEMSTRUCT *)lpMeasureItem)->CtlID), (LPARAM)(MEASUREITEMSTRUCT *)(lpMeasureItem))
185 /* void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) */
186 #define HANDLE_WM_COMMAND(hwnd, wParam, lParam, fn) \
187 ((fn)((hwnd), (int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
188 #define FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, fn) \
189 (void)(fn)((hwnd), WM_COMMAND, MAKEWPARAM((UINT)(id),(UINT)(codeNotify)), (LPARAM)(HWND)(hwndCtl))
191 /* void Cls_OnTimer(HWND hwnd, UINT id) */
192 #define HANDLE_WM_TIMER(hwnd, wParam, lParam, fn) ((fn)((hwnd), (UINT)(wParam)), 0L)
193 #define FORWARD_WM_TIMER(hwnd, id, fn) (void)(fn)((hwnd), WM_TIMER, (WPARAM)(UINT)(id), 0L)
195 /* void Cls_OnInitMenuPopup(HWND hwnd, HMENU hMenu, UINT item, BOOL fSystemMenu) */
196 #define HANDLE_WM_INITMENUPOPUP(hwnd, wParam, lParam, fn) \
197 ((fn)((hwnd), (HMENU)(wParam), (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
198 #define FORWARD_WM_INITMENUPOPUP(hwnd, hMenu, item, fSystemMenu, fn) \
199 (void)(fn)((hwnd), WM_INITMENUPOPUP, (WPARAM)(HMENU)(hMenu), MAKELPARAM((item),(fSystemMenu)))
201 /* UINT Cls_OnNCHitTest(HWND hwnd, int x, int y) */
202 #define HANDLE_WM_NCHITTEST(hwnd, wParam, lParam, fn) \
203 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam))
204 #define FORWARD_WM_NCHITTEST(hwnd, x, y, fn) \
205 (UINT)(DWORD)(fn)((hwnd), WM_NCHITTEST, 0L, MAKELPARAM((x), (y)))
207 /* HFONT Cls_OnGetFont(HWND hwnd) */
208 #define HANDLE_WM_GETFONT(hwnd, wParam, lParam, fn) (LRESULT)(DWORD)(UINT)(HFONT)(fn)(hwnd)
209 #define FORWARD_WM_GETFONT(hwnd, fn) (HFONT)(UINT)(DWORD)(fn)((hwnd), WM_GETFONT, 0L, 0L)
211 /* void Cls_OnSetFont(HWND hwndCtl, HFONT hfont, BOOL fRedraw) */
212 #define HANDLE_WM_SETFONT(hwnd, wParam, lParam, fn) \
213 ((fn)((hwnd), (HFONT)(wParam), (BOOL)(lParam)), 0L)
214 #define FORWARD_WM_SETFONT(hwnd, hfont, fRedraw, fn) \
215 (void)(fn)((hwnd), WM_SETFONT, (WPARAM)(HFONT)(hfont), (LPARAM)(BOOL)(fRedraw))
217 /* void Cls_OnGetMinMaxInfo(HWND hwnd, LPMINMAXINFO lpMinMaxInfo) */
218 #define HANDLE_WM_GETMINMAXINFO(hwnd, wParam, lParam, fn) \
219 ((fn)((hwnd), (LPMINMAXINFO)(lParam)), 0L)
220 #define FORWARD_WM_GETMINMAXINFO(hwnd, lpMinMaxInfo, fn) \
221 (void)(fn)((hwnd), WM_GETMINMAXINFO, 0L, (LPARAM)(LPMINMAXINFO)(lpMinMaxInfo))
223 /* void Cls_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT lpDrawItem) */
224 #define HANDLE_WM_DRAWITEM(hwnd, wParam, lParam, fn) \
225 ((fn)((hwnd), (const DRAWITEMSTRUCT *)(lParam)), 0L)
226 #define FORWARD_WM_DRAWITEM(hwnd, lpDrawItem, fn) \
227 (void)(fn)((hwnd), WM_DRAWITEM, (WPARAM)(((const DRAWITEMSTRUCT *)lpDrawItem)->CtlID), (LPARAM)(const DRAWITEMSTRUCT *)(lpDrawItem))
229 /****** C runtime porting macros ****************************************/
231 #define _ncalloc calloc
232 #define _nexpand _expand
233 #define _ffree free
234 #define _fmalloc malloc
235 #define _fmemccpy _memccpy
236 #define _fmemchr memchr
237 #define _fmemcmp memcmp
238 #define _fmemcpy memcpy
239 #define _fmemicmp _memicmp
240 #define _fmemmove memmove
241 #define _fmemset memset
242 #define _fmsize _msize
243 #define _frealloc realloc
244 #define _fstrcat strcat
245 #define _fstrchr strchr
246 #define _fstrcmp strcmp
247 #define _fstrcpy strcpy
248 #define _fstrcspn strcspn
249 #define _fstrdup _strdup
250 #define _fstricmp _stricmp
251 #define _fstrlen strlen
252 #define _fstrlwr _strlwr
253 #define _fstrncat strncat
254 #define _fstrncmp strncmp
255 #define _fstrncpy strncpy
256 #define _fstrnicmp _strnicmp
257 #define _fstrnset _strnset
258 #define _fstrpbrk strpbrk
259 #define _fstrrchr strrchr
260 #define _fstrrev _strrev
261 #define _fstrset _strset
262 #define _fstrspn strspn
263 #define _fstrstr strstr
264 #define _fstrtok strtok
265 #define _fstrupr _strupr
266 #define _nfree free
267 #define _nmalloc malloc
268 #define _nmsize _msize
269 #define _nrealloc realloc
270 #define _nstrdup _strdup
271 #define hmemcpy16 MoveMemory
273 #ifdef __cplusplus
275 #endif
277 #endif