]> git.saurik.com Git - wxWidgets.git/blame - src/msw/microwin.c
Updated to Scintilla 1.67
[wxWidgets.git] / src / msw / microwin.c
CommitLineData
bf7b3e2b
JS
1/*
2/////////////////////////////////////////////////////////////////////////////
3// Name: microwin.cpp
4// Purpose: Extra implementation for MicroWindows
5// Author: Julian Smart
6// Created: 2001-05-31
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
77ffb593 9// Licence: wxWidgets licence
bf7b3e2b
JS
10/////////////////////////////////////////////////////////////////////////////
11
12*/
13
bf7b3e2b
JS
14#include "mwtypes.h"
15#include "windows.h"
16#include "wintern.h"
17#include "device.h"
8cb172b4 18#include "wx/msw/microwin.h"
bf7b3e2b
JS
19
20void GdMoveCursor(MWCOORD x, MWCOORD y);
21void MwSetCursor(HWND wp, PMWCURSOR pcursor);
22
23BOOL SetCursorPos(int x, int y)
24{
25 GdMoveCursor(x, y);
26 return TRUE;
27}
28
29HCURSOR SetCursor(HCURSOR hCursor)
30{
31 /* TODO */
32 return 0;
33}
34
35int GetScrollPosWX (HWND hWnd, int iSBar)
36{
37 int pos = 0;
38 if (GetScrollPos(hWnd, iSBar, & pos))
39 return pos;
40 else
41 return 0;
42}
43
44BOOL ScrollWindow(HWND hWnd, int xAmount, int yAmount,
45 CONST RECT* lpRect, CONST RECT* lpClipRect)
46{
47 /* TODO */
48 return FALSE;
49}
50
51HWND WindowFromPoint(POINT pt)
52{
53 /* TODO */
54 return 0;
55}
56
57SHORT GetKeyState(int nVirtKey)
58{
59 /* TODO */
60 return 0;
61}
62
63HWND SetParent(HWND hWndChild, HWND hWndNewParent)
64{
65 /* TODO */
66 return 0;
67}
68
69VOID DragAcceptFiles(HWND hWnd, BOOL b)
70{
71 /* TODO */
72}
73
74BOOL IsDialogMessage(HWND hWnd, MSG* msg)
75{
76 /* TODO */
77 return FALSE;
78}
79
80DWORD GetMessagePos(VOID)
81{
82 /* TODO */
83 return 0;
84}
85
86BOOL IsIconic(HWND hWnd)
87{
88 /* TODO */
89 return FALSE;
90}
91
92int SetMapMode(HDC hDC, int mode)
93{
94 return MM_TEXT;
95}
96
97int GetMapMode(HDC hDC)
98{
99 return MM_TEXT;
100}
101
102HCURSOR LoadCursor(HINSTANCE hInst, int cursor)
103{
104 /* TODO */
105 return 0;
106}
107
108DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz)
109{
110 /* TODO */
111 name[0] = 0;
112 return 0;
113}
114
115VOID DestroyIcon(HICON hIcon)
116{
117 /* TODO */
118}
119
120COLORREF GetTextColor(HDC hdc)
121{
122 if (!hdc)
123 return CLR_INVALID;
124 return hdc->textcolor ;
125}
126
127COLORREF GetBkColor(HDC hdc)
128{
129 if (!hdc)
130 return CLR_INVALID;
131 return hdc->bkcolor ;
132}
133
134HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b)
135{
136 /* TODO */
137 return 0;
138}
139
140BOOL IntersectClipRect(HDC hdc, int x, int y,
141 int right, int bottom)
142{
143 /* TODO */
144 HRGN rgn = CreateRectRgn(x, y, right, bottom);
145
146 BOOL ret = (ExtSelectClipRgn(hdc, rgn, RGN_AND) != ERROR);
147 DeleteObject(rgn);
148 return ret;
149}
150
151BOOL GetClipBox(HDC hdc, RECT* rect)
152{
153 MWCLIPREGION* r;
154 MWRECT mwrect;
155
156 if (!hdc->region)
157 return FALSE;
158
159 r = ((MWRGNOBJ*) hdc->region)->rgn;
160 GdGetRegionBox(r, & mwrect);
161 rect->left = mwrect.left;
162 rect->top = mwrect.top;
163 rect->right = mwrect.right;
164 rect->bottom = mwrect.bottom;
165
166 return TRUE;
167}
168
169BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
170{
171 /* TODO */
172 return FALSE;
173}
174
175BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize)
176{
177 /* TODO */
178 return FALSE;
179}
180
181BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint)
182{
183 /* TODO */
184 return FALSE;
185}
186
187BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize)
188{
189 /* TODO */
190 return FALSE;
191}
192
193BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize)
194{
195 /* TODO */
196 return FALSE;
197}
198
199BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags)
200{
201 /* TODO */
202 return FALSE;
203}
204
205int SetPolyFillMode(HDC hdc, int mode)
206{
207 /* TODO */
208 return 0;
209}
210
211BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2)
212{
213 /* TODO */
214 return Rectangle(hdc, left, top, right, bottom);
215}
216
217BOOL MaskBlt(HDC hdc, int x, int y, int w, int h,
218 HDC hDCSource, int xSrc, int ySrc, HBITMAP hBitmapMask, int xMask, int yMask, DWORD rop)
219{
220 /* TODO */
221 return FALSE;
222}
223
224UINT RealizePalette(HDC hDC)
225{
226 /* TODO */
227 return 0;
228}
229
230BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint)
231{
232 /* TODO */
233 return FALSE;
234}
235
236int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj)
237{
238 if (sz == sizeof(LOGFONT))
239 {
240 LOGFONT* logFont = (LOGFONT*) logObj;
241 MWFONTINFO fi;
242 HFONT hFont = (HFONT) hObj;
243
244 GdGetFontInfo(((MWFONTOBJ*) hFont)->pfont, &fi);
245
246 /* FIXME many items are guessed for the time being*/
247 logFont->lfHeight = fi.height;
248
249 /* reversed for kaffe port
250 logFont->tmAscent = fi.height - fi.baseline;
251 logFont->tmDescent= fi.baseline;
252 */
253
254 logFont->lfWidth = fi.widths['x'];
255 logFont->lfWeight = FW_NORMAL;
256 logFont->lfEscapement = 0;
257 logFont->lfOrientation = 0;
258 logFont->lfOutPrecision = OUT_OUTLINE_PRECIS;
259 logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
260 logFont->lfQuality = DEFAULT_QUALITY;
261 logFont->lfItalic = 0;
262 logFont->lfUnderline = 0;
263 logFont->lfStrikeOut = 0;
264 /* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/
265 logFont->lfPitchAndFamily = fi.fixed?
266 FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH);
267 logFont->lfCharSet = OEM_CHARSET;
268 /* TODO I don't know how to get the font name. May
269 * test for different font classes.
270 */
271 logFont->lfFaceName[0] = 0;
272#if 0
273 strncpy(logFont->lfFaceName, ??, sizeof(logFont->lfFaceName));
274#endif
275 return sz;
276 }
277 else
278 {
279 return 0;
280 }
281}
62e1ba75
JS
282
283/* Not in wingdi.c in earlier versions of MicroWindows */
284#if 0
285HBITMAP WINAPI
286CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight)
287{
288 MWBITMAPOBJ * hbitmap;
289 int size;
290 int linelen;
291
292 if(!hdc)
293 return NULL;
294
295 nWidth = MWMAX(nWidth, 1);
296 nHeight = MWMAX(nHeight, 1);
297
298 /* calc memory allocation size and linelen from width and height*/
299 if(!GdCalcMemGCAlloc(hdc->psd, nWidth, nHeight, 0, 0, &size, &linelen))
300 return NULL;
301
302 /* allocate gdi object*/
303 hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size);
304 if(!hbitmap)
305 return NULL;
306 hbitmap->hdr.type = OBJ_BITMAP;
307 hbitmap->hdr.stockobj = FALSE;
308 hbitmap->width = nWidth;
309 hbitmap->height = nHeight;
310
311 /* create compatible with hdc*/
312 hbitmap->planes = hdc->psd->planes;
313 hbitmap->bpp = hdc->psd->bpp;
314 hbitmap->linelen = linelen;
315 hbitmap->size = size;
316
317 return (HBRUSH)hbitmap;
318}
319#endif
320
321/* Attempt by JACS to create arbitrary bitmap
322 * TODO: make use of lpData
323 */
324
325HBITMAP WINAPI
326CreateBitmap( int nWidth, int nHeight, int nPlanes, int bPP, LPCVOID lpData)
327{
328 MWBITMAPOBJ * hbitmap;
329 int size;
330 int linelen;
331
332 HDC hScreenDC;
333
334 hScreenDC = GetDC(NULL);
335
336 nWidth = MWMAX(nWidth, 1);
337 nHeight = MWMAX(nHeight, 1);
338
339 /* calc memory allocation size and linelen from width and height*/
340 if(!GdCalcMemGCAlloc(hScreenDC->psd, nWidth, nHeight, nPlanes, bPP, &size, &linelen))
341 {
342 ReleaseDC(NULL, hScreenDC);
343 return NULL;
344 }
345 ReleaseDC(NULL, hScreenDC);
346
347 /* allocate gdi object*/
348 hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size);
349 if(!hbitmap)
350 return NULL;
351 hbitmap->hdr.type = OBJ_BITMAP;
352 hbitmap->hdr.stockobj = FALSE;
353 hbitmap->width = nWidth;
354 hbitmap->height = nHeight;
355
356 /* create with specified parameters */
357 hbitmap->planes = nPlanes;
358 hbitmap->bpp = bPP;
359 hbitmap->linelen = linelen;
360 hbitmap->size = size;
361
362 /* TODO: copy data */
363
364 return (HBRUSH)hbitmap;
365}