2 /////////////////////////////////////////////////////////////////////////////
4 // Purpose: Extra implementation for MicroWindows
5 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #pragma implementation "microwin.h"
22 #include "wx/msw/microwin.h"
24 void GdMoveCursor(MWCOORD x
, MWCOORD y
);
25 void MwSetCursor(HWND wp
, PMWCURSOR pcursor
);
27 BOOL
SetCursorPos(int x
, int y
)
33 HCURSOR
SetCursor(HCURSOR hCursor
)
39 int GetScrollPosWX (HWND hWnd
, int iSBar
)
42 if (GetScrollPos(hWnd
, iSBar
, & pos
))
48 BOOL
ScrollWindow(HWND hWnd
, int xAmount
, int yAmount
,
49 CONST RECT
* lpRect
, CONST RECT
* lpClipRect
)
55 HWND
WindowFromPoint(POINT pt
)
61 SHORT
GetKeyState(int nVirtKey
)
67 HWND
SetParent(HWND hWndChild
, HWND hWndNewParent
)
73 VOID
DragAcceptFiles(HWND hWnd
, BOOL b
)
78 BOOL
IsDialogMessage(HWND hWnd
, MSG
* msg
)
84 DWORD
GetMessagePos(VOID
)
90 BOOL
IsIconic(HWND hWnd
)
96 int SetMapMode(HDC hDC
, int mode
)
101 int GetMapMode(HDC hDC
)
106 HCURSOR
LoadCursor(HINSTANCE hInst
, int cursor
)
112 DWORD
GetModuleFileName(HINSTANCE hInst
, LPSTR name
, DWORD sz
)
119 VOID
DestroyIcon(HICON hIcon
)
124 COLORREF
GetTextColor(HDC hdc
)
128 return hdc
->textcolor
;
131 COLORREF
GetBkColor(HDC hdc
)
135 return hdc
->bkcolor
;
138 HPALETTE
SelectPalette(HDC hdc
, HPALETTE hPalette
, BOOL b
)
144 BOOL
IntersectClipRect(HDC hdc
, int x
, int y
,
145 int right
, int bottom
)
148 HRGN rgn
= CreateRectRgn(x
, y
, right
, bottom
);
150 BOOL ret
= (ExtSelectClipRgn(hdc
, rgn
, RGN_AND
) != ERROR
);
155 BOOL
GetClipBox(HDC hdc
, RECT
* rect
)
163 r
= ((MWRGNOBJ
*) hdc
->region
)->rgn
;
164 GdGetRegionBox(r
, & mwrect
);
165 rect
->left
= mwrect
.left
;
166 rect
->top
= mwrect
.top
;
167 rect
->right
= mwrect
.right
;
168 rect
->bottom
= mwrect
.bottom
;
173 BOOL
DrawIconEx(HDC hdc
, int x
, int y
, HICON hIcon
, int w
, int h
, UINT istepIfAniCur
, HBRUSH hbrFlickerFreeDraw
, UINT diFlags
)
179 BOOL
SetViewportExtEx(HDC hdc
, int x
, int y
, LPSIZE lpSize
)
185 BOOL
SetViewportOrgEx(HDC hdc
, int x
, int y
, LPPOINT lpPoint
)
191 BOOL
SetWindowExtEx(HDC hdc
, int x
, int y
, LPSIZE lpSize
)
197 BOOL
SetWindowOrgEx(HDC hdc
, int x
, int y
, LPPOINT lpSize
)
203 BOOL
ExtFloodFill(HDC hdc
, int x
, int y
, COLORREF col
, UINT flags
)
209 int SetPolyFillMode(HDC hdc
, int mode
)
215 BOOL
RoundRect(HDC hdc
, int left
, int top
, int right
, int bottom
, int r1
, int r2
)
218 return Rectangle(hdc
, left
, top
, right
, bottom
);
221 BOOL
MaskBlt(HDC hdc
, int x
, int y
, int w
, int h
,
222 HDC hDCSource
, int xSrc
, int ySrc
, HBITMAP hBitmapMask
, int xMask
, int yMask
, DWORD rop
)
228 UINT
RealizePalette(HDC hDC
)
234 BOOL
SetBrushOrgEx(HDC hdc
, int xOrigin
, int yOrigin
, LPPOINT lpPoint
)
240 int GetObject(HGDIOBJ hObj
, int sz
, LPVOID logObj
)
242 if (sz
== sizeof(LOGFONT
))
244 LOGFONT
* logFont
= (LOGFONT
*) logObj
;
246 HFONT hFont
= (HFONT
) hObj
;
248 GdGetFontInfo(((MWFONTOBJ
*) hFont
)->pfont
, &fi
);
250 /* FIXME many items are guessed for the time being*/
251 logFont
->lfHeight
= fi
.height
;
253 /* reversed for kaffe port
254 logFont->tmAscent = fi.height - fi.baseline;
255 logFont->tmDescent= fi.baseline;
258 logFont
->lfWidth
= fi
.widths
['x'];
259 logFont
->lfWeight
= FW_NORMAL
;
260 logFont
->lfEscapement
= 0;
261 logFont
->lfOrientation
= 0;
262 logFont
->lfOutPrecision
= OUT_OUTLINE_PRECIS
;
263 logFont
->lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
264 logFont
->lfQuality
= DEFAULT_QUALITY
;
265 logFont
->lfItalic
= 0;
266 logFont
->lfUnderline
= 0;
267 logFont
->lfStrikeOut
= 0;
268 /* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/
269 logFont
->lfPitchAndFamily
= fi
.fixed
?
270 FF_DONTCARE
: (FF_DONTCARE
| TMPF_FIXED_PITCH
);
271 logFont
->lfCharSet
= OEM_CHARSET
;
272 /* TODO I don't know how to get the font name. May
273 * test for different font classes.
275 logFont
->lfFaceName
[0] = 0;
277 strncpy(logFont
->lfFaceName
, ??, sizeof(logFont
->lfFaceName
));