]> git.saurik.com Git - wxWidgets.git/blob - src/msw/microwin.c
added test for writing empty value to the config
[wxWidgets.git] / src / msw / microwin.c
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 */
13
14 #ifdef __GNUG__
15 #pragma implementation "microwin.h"
16 #endif
17
18 #include "mwtypes.h"
19 #include "windows.h"
20 #include "wintern.h"
21 #include "device.h"
22 #include "wx/msw/microwin.h"
23
24 void GdMoveCursor(MWCOORD x, MWCOORD y);
25 void MwSetCursor(HWND wp, PMWCURSOR pcursor);
26
27 BOOL SetCursorPos(int x, int y)
28 {
29 GdMoveCursor(x, y);
30 return TRUE;
31 }
32
33 HCURSOR SetCursor(HCURSOR hCursor)
34 {
35 /* TODO */
36 return 0;
37 }
38
39 int GetScrollPosWX (HWND hWnd, int iSBar)
40 {
41 int pos = 0;
42 if (GetScrollPos(hWnd, iSBar, & pos))
43 return pos;
44 else
45 return 0;
46 }
47
48 BOOL ScrollWindow(HWND hWnd, int xAmount, int yAmount,
49 CONST RECT* lpRect, CONST RECT* lpClipRect)
50 {
51 /* TODO */
52 return FALSE;
53 }
54
55 HWND WindowFromPoint(POINT pt)
56 {
57 /* TODO */
58 return 0;
59 }
60
61 SHORT GetKeyState(int nVirtKey)
62 {
63 /* TODO */
64 return 0;
65 }
66
67 HWND SetParent(HWND hWndChild, HWND hWndNewParent)
68 {
69 /* TODO */
70 return 0;
71 }
72
73 VOID DragAcceptFiles(HWND hWnd, BOOL b)
74 {
75 /* TODO */
76 }
77
78 BOOL IsDialogMessage(HWND hWnd, MSG* msg)
79 {
80 /* TODO */
81 return FALSE;
82 }
83
84 DWORD GetMessagePos(VOID)
85 {
86 /* TODO */
87 return 0;
88 }
89
90 BOOL IsIconic(HWND hWnd)
91 {
92 /* TODO */
93 return FALSE;
94 }
95
96 int SetMapMode(HDC hDC, int mode)
97 {
98 return MM_TEXT;
99 }
100
101 int GetMapMode(HDC hDC)
102 {
103 return MM_TEXT;
104 }
105
106 HCURSOR LoadCursor(HINSTANCE hInst, int cursor)
107 {
108 /* TODO */
109 return 0;
110 }
111
112 DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz)
113 {
114 /* TODO */
115 name[0] = 0;
116 return 0;
117 }
118
119 VOID DestroyIcon(HICON hIcon)
120 {
121 /* TODO */
122 }
123
124 COLORREF GetTextColor(HDC hdc)
125 {
126 if (!hdc)
127 return CLR_INVALID;
128 return hdc->textcolor ;
129 }
130
131 COLORREF GetBkColor(HDC hdc)
132 {
133 if (!hdc)
134 return CLR_INVALID;
135 return hdc->bkcolor ;
136 }
137
138 HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b)
139 {
140 /* TODO */
141 return 0;
142 }
143
144 BOOL IntersectClipRect(HDC hdc, int x, int y,
145 int right, int bottom)
146 {
147 /* TODO */
148 HRGN rgn = CreateRectRgn(x, y, right, bottom);
149
150 BOOL ret = (ExtSelectClipRgn(hdc, rgn, RGN_AND) != ERROR);
151 DeleteObject(rgn);
152 return ret;
153 }
154
155 BOOL GetClipBox(HDC hdc, RECT* rect)
156 {
157 MWCLIPREGION* r;
158 MWRECT mwrect;
159
160 if (!hdc->region)
161 return FALSE;
162
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;
169
170 return TRUE;
171 }
172
173 BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
174 {
175 /* TODO */
176 return FALSE;
177 }
178
179 BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize)
180 {
181 /* TODO */
182 return FALSE;
183 }
184
185 BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint)
186 {
187 /* TODO */
188 return FALSE;
189 }
190
191 BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize)
192 {
193 /* TODO */
194 return FALSE;
195 }
196
197 BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize)
198 {
199 /* TODO */
200 return FALSE;
201 }
202
203 BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags)
204 {
205 /* TODO */
206 return FALSE;
207 }
208
209 int SetPolyFillMode(HDC hdc, int mode)
210 {
211 /* TODO */
212 return 0;
213 }
214
215 BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2)
216 {
217 /* TODO */
218 return Rectangle(hdc, left, top, right, bottom);
219 }
220
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)
223 {
224 /* TODO */
225 return FALSE;
226 }
227
228 UINT RealizePalette(HDC hDC)
229 {
230 /* TODO */
231 return 0;
232 }
233
234 BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint)
235 {
236 /* TODO */
237 return FALSE;
238 }
239
240 int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj)
241 {
242 if (sz == sizeof(LOGFONT))
243 {
244 LOGFONT* logFont = (LOGFONT*) logObj;
245 MWFONTINFO fi;
246 HFONT hFont = (HFONT) hObj;
247
248 GdGetFontInfo(((MWFONTOBJ*) hFont)->pfont, &fi);
249
250 /* FIXME many items are guessed for the time being*/
251 logFont->lfHeight = fi.height;
252
253 /* reversed for kaffe port
254 logFont->tmAscent = fi.height - fi.baseline;
255 logFont->tmDescent= fi.baseline;
256 */
257
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.
274 */
275 logFont->lfFaceName[0] = 0;
276 #if 0
277 strncpy(logFont->lfFaceName, ??, sizeof(logFont->lfFaceName));
278 #endif
279 return sz;
280 }
281 else
282 {
283 return 0;
284 }
285 }