source: trunk/include/win/windowsx.h@ 4

Last change on this file since 4 was 4, checked in by ktk, 26 years ago

Import

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