Moved some 16-bit functions from windows/cursoricon.c to
[wine/multimedia.git] / dlls / user / user16.c
blob04b62bc41e6ede356a6748e3b810c6f6bb178df5
1 /*
2 * Misc 16-bit USER functions
4 * Copyright 2002 Patrik Stridvall
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "wine/winuser16.h"
22 #include "winbase.h"
24 /* handle to handle 16 conversions */
25 #define HANDLE_16(h32) (LOWORD(h32))
26 #define HBITMAP_16(h32) (LOWORD(h32))
27 #define HCURSOR_16(h32) (LOWORD(h32))
28 #define HICON_16(h32) (LOWORD(h32))
30 /* handle16 to handle conversions */
31 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
32 #define HBRUSH_32(h16) ((HBRUSH)(ULONG_PTR)(h16))
33 #define HCURSOR_32(h16) ((HCURSOR)(ULONG_PTR)(h16))
34 #define HDC_32(h16) ((HDC)(ULONG_PTR)(h16))
35 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
36 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
38 WORD WINAPI DestroyIcon32(HGLOBAL16, UINT16);
41 /***********************************************************************
42 * SetCursor (USER.69)
44 HCURSOR16 WINAPI SetCursor16(HCURSOR16 hCursor)
46 return HCURSOR_16(SetCursor(HCURSOR_32(hCursor)));
49 /***********************************************************************
50 * ShowCursor (USER.71)
52 INT16 WINAPI ShowCursor16(BOOL16 bShow)
54 return ShowCursor(bShow);
57 /***********************************************************************
58 * DrawIcon (USER.84)
60 BOOL16 WINAPI DrawIcon16(HDC16 hdc, INT16 x, INT16 y, HICON16 hIcon)
62 return DrawIcon(HDC_32(hdc), x, y, HICON_32(hIcon));
65 /***********************************************************************
66 * IconSize (USER.86)
68 * See "Undocumented Windows". Used by W2.0 paint.exe.
70 DWORD WINAPI IconSize16(void)
72 return MAKELONG(GetSystemMetrics(SM_CYICON), GetSystemMetrics(SM_CXICON));
75 /***********************************************************************
76 * LoadCursor (USER.173)
78 HCURSOR16 WINAPI LoadCursor16(HINSTANCE16 hInstance, LPCSTR name)
80 return HCURSOR_16(LoadCursorA(HINSTANCE_32(hInstance), name));
84 /***********************************************************************
85 * LoadIcon (USER.174)
87 HICON16 WINAPI LoadIcon16(HINSTANCE16 hInstance, LPCSTR name)
89 return HICON_16(LoadIconA(HINSTANCE_32(hInstance), name));
92 /**********************************************************************
93 * LoadBitmap (USER.175)
95 HBITMAP16 WINAPI LoadBitmap16(HINSTANCE16 hInstance, LPCSTR name)
97 return HBITMAP_16(LoadBitmapA(HINSTANCE_32(hInstance), name));
100 /***********************************************************************
101 * GetCursor (USER.247)
103 HCURSOR16 WINAPI GetCursor16(void)
105 return HCURSOR_16(GetCursor());
108 /***********************************************************************
109 * GlobalAddAtom (USER.268)
111 ATOM WINAPI GlobalAddAtom16(LPCSTR lpString)
113 return GlobalAddAtomA(lpString);
116 /***********************************************************************
117 * GlobalDeleteAtom (USER.269)
119 ATOM WINAPI GlobalDeleteAtom16(ATOM nAtom)
121 return GlobalDeleteAtom(nAtom);
124 /***********************************************************************
125 * GlobalFindAtom (USER.270)
127 ATOM WINAPI GlobalFindAtom16(LPCSTR lpString)
129 return GlobalFindAtomA(lpString);
132 /***********************************************************************
133 * GlobalGetAtomName (USER.271)
135 UINT16 WINAPI GlobalGetAtomName16(ATOM nAtom, LPSTR lpBuffer, INT16 nSize)
137 return GlobalGetAtomNameA(nAtom, lpBuffer, nSize);
140 /***********************************************************************
141 * LoadImage (USER.389)
144 HANDLE16 WINAPI LoadImage16(HINSTANCE16 hinst, LPCSTR name, UINT16 type,
145 INT16 desiredx, INT16 desiredy, UINT16 loadflags)
147 return HANDLE_16(LoadImageA(HINSTANCE_32(hinst), name, type, desiredx,
148 desiredy, loadflags));
151 /******************************************************************************
152 * CopyImage (USER.390) Creates new image and copies attributes to it
155 HICON16 WINAPI CopyImage16(HANDLE16 hnd, UINT16 type, INT16 desiredx,
156 INT16 desiredy, UINT16 flags)
158 return HICON_16(CopyImage(HANDLE_32(hnd), (UINT)type, (INT)desiredx,
159 (INT)desiredy, (UINT)flags));
162 /**********************************************************************
163 * DrawIconEx (USER.394)
165 BOOL16 WINAPI DrawIconEx16(HDC16 hdc, INT16 xLeft, INT16 yTop, HICON16 hIcon,
166 INT16 cxWidth, INT16 cyWidth, UINT16 istep,
167 HBRUSH16 hbr, UINT16 flags)
169 return DrawIconEx(HDC_32(hdc), xLeft, yTop, HICON_32(hIcon), cxWidth, cyWidth,
170 istep, HBRUSH_32(hbr), flags);
173 /**********************************************************************
174 * GetIconInfo (USER.395)
176 BOOL16 WINAPI GetIconInfo16(HICON16 hIcon, LPICONINFO16 iconinfo)
178 ICONINFO ii32;
179 BOOL16 ret = GetIconInfo(HICON_32(hIcon), &ii32);
181 iconinfo->fIcon = ii32.fIcon;
182 iconinfo->xHotspot = ii32.xHotspot;
183 iconinfo->yHotspot = ii32.yHotspot;
184 iconinfo->hbmMask = ii32.hbmMask;
185 iconinfo->hbmColor = ii32.hbmColor;
186 return ret;
189 /***********************************************************************
190 * CreateCursor (USER.406)
192 HCURSOR16 WINAPI CreateCursor16(HINSTANCE16 hInstance,
193 INT16 xHotSpot, INT16 yHotSpot,
194 INT16 nWidth, INT16 nHeight,
195 LPCVOID lpANDbits, LPCVOID lpXORbits)
197 CURSORICONINFO info;
199 info.ptHotSpot.x = xHotSpot;
200 info.ptHotSpot.y = yHotSpot;
201 info.nWidth = nWidth;
202 info.nHeight = nHeight;
203 info.nWidthBytes = 0;
204 info.bPlanes = 1;
205 info.bBitsPerPixel = 1;
207 return CreateCursorIconIndirect16(HINSTANCE_32(hInstance), &info, lpANDbits,
208 lpXORbits);
211 /**********************************************************************
212 * CreateIconFromResourceEx (USER.450)
214 * FIXME: not sure about exact parameter types
216 HICON16 WINAPI CreateIconFromResourceEx16(LPBYTE bits, UINT16 cbSize,
217 BOOL16 bIcon, DWORD dwVersion,
218 INT16 width, INT16 height,
219 UINT16 cFlag)
221 return HICON_16(CreateIconFromResourceEx(bits, cbSize, bIcon, dwVersion,
222 width, height, cFlag));
225 /***********************************************************************
226 * DestroyIcon (USER.457)
228 BOOL16 WINAPI DestroyIcon16(HICON16 hIcon)
230 return DestroyIcon32(hIcon, 0);
233 /***********************************************************************
234 * DestroyCursor (USER.458)
236 BOOL16 WINAPI DestroyCursor16(HCURSOR16 hCursor)
238 return DestroyIcon32(hCursor, 0);