]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: private.h | |
45fcbf3b | 3 | // Purpose: Private declarations: as this header is only included by |
77ffb593 | 4 | // wxWidgets itself, it may contain identifiers which don't start |
45fcbf3b DW |
5 | // with "wx". |
6 | // Author: Julian Smart | |
0e320a79 | 7 | // Modified by: |
45fcbf3b | 8 | // Created: 01/02/97 |
0e320a79 | 9 | // RCS-ID: $Id$ |
45fcbf3b | 10 | // Copyright: (c) Julian Smart |
65571936 | 11 | // Licence: wxWindows licence |
0e320a79 DW |
12 | ///////////////////////////////////////////////////////////////////////////// |
13 | ||
93599ac0 SN |
14 | #ifndef _WX_OS2_PRIVATE_H_ |
15 | #define _WX_OS2_PRIVATE_H_ | |
0e320a79 | 16 | |
b86737ee | 17 | #define INCL_BASE |
45fcbf3b | 18 | #define INCL_PM |
20947e08 | 19 | #define INCL_GPI |
61243a51 | 20 | #define INCL_WINSYS |
f6bcfd97 | 21 | #define INCL_SHLERRORS |
7e1e6965 | 22 | #define INCL_DOS |
45fcbf3b | 23 | #include <os2.h> |
7e1e6965 | 24 | |
93599ac0 | 25 | #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA) |
7e1e6965 WS |
26 | |
27 | typedef struct _SPBCDATA { | |
28 | ULONG cbSize; /* Size of control block. */ | |
29 | ULONG ulTextLimit; /* Entryfield text limit. */ | |
30 | LONG lLowerLimit; /* Spin lower limit (numeric only). */ | |
31 | LONG lUpperLimit; /* Spin upper limit (numeric only). */ | |
32 | ULONG idMasterSpb; /* ID of the servant's master spinbutton. */ | |
33 | PVOID pHWXCtlData; /* Handwriting control data structure flag. */ | |
34 | } SPBCDATA; | |
35 | ||
36 | typedef SPBCDATA *PSPBCDATA; | |
37 | ||
74707ecf | 38 | #endif |
0e320a79 | 39 | |
f5b5c15c DW |
40 | #include "wx/fontenc.h" |
41 | ||
45fcbf3b DW |
42 | class WXDLLEXPORT wxFont; |
43 | class WXDLLEXPORT wxWindow; | |
74707ecf | 44 | class WXDLLEXPORT wxString; |
db16e5c3 | 45 | class WXDLLEXPORT wxBitmap; |
45fcbf3b DW |
46 | |
47 | // --------------------------------------------------------------------------- | |
48 | // private constants | |
49 | // --------------------------------------------------------------------------- | |
50 | ||
511ac294 DW |
51 | // |
52 | // Constant strings for control names and classes | |
53 | // | |
54 | ||
55 | // | |
56 | // Controls | |
57 | // | |
58 | WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr; | |
59 | WXDLLEXPORT_DATA(extern const wxChar*) wxCanvasNameStr; | |
60 | WXDLLEXPORT_DATA(extern const wxChar*) wxCheckBoxNameStr; | |
61 | WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr; | |
62 | WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr; | |
63 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; | |
64 | WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; | |
65 | WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr; | |
66 | WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBoxNameStr; | |
67 | WXDLLEXPORT_DATA(extern const wxChar*) wxListBoxNameStr; | |
68 | WXDLLEXPORT_DATA(extern const wxChar*) wxStaticTextNameStr; | |
69 | WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr; | |
70 | WXDLLEXPORT_DATA(extern const wxChar*) wxMultiTextNameStr; | |
71 | WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr; | |
72 | WXDLLEXPORT_DATA(extern const wxChar*) wxRadioBoxNameStr; | |
73 | WXDLLEXPORT_DATA(extern const wxChar*) wxRadioButtonNameStr; | |
74 | WXDLLEXPORT_DATA(extern const wxChar*) wxBitmapRadioButtonNameStr; | |
75 | WXDLLEXPORT_DATA(extern const wxChar*) wxScrollBarNameStr; | |
76 | WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr; | |
77 | WXDLLEXPORT_DATA(extern const wxChar*) wxStaticNameStr; | |
78 | WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlWindowNameStr; | |
79 | WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr; | |
80 | WXDLLEXPORT_DATA(extern const wxChar*) wxVirtListBoxNameStr; | |
81 | WXDLLEXPORT_DATA(extern const wxChar*) wxButtonBarNameStr; | |
82 | WXDLLEXPORT_DATA(extern const wxChar*) wxEnhDialogNameStr; | |
83 | WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; | |
84 | WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr; | |
85 | WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr; | |
86 | WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr; | |
87 | WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorPromptStr; | |
88 | WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorDefaultWildcardStr; | |
89 | WXDLLEXPORT_DATA(extern const wxChar*) wxInternalErrorStr; | |
90 | WXDLLEXPORT_DATA(extern const wxChar*) wxFatalErrorStr; | |
91 | WXDLLEXPORT_DATA(extern const wxChar*) wxTreeCtrlNameStr; | |
92 | WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogNameStr; | |
93 | WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogDefaultFolderStr; | |
94 | ||
95 | // | |
96 | // Class names | |
97 | // | |
98 | WXDLLEXPORT_DATA(extern const wxChar*) wxFrameClassName; | |
99 | WXDLLEXPORT_DATA(extern const wxChar*) wxFrameClassNameNoRedraw; | |
100 | WXDLLEXPORT_DATA(extern const wxChar*) wxMDIFrameClassName; | |
101 | WXDLLEXPORT_DATA(extern const wxChar*) wxMDIFrameClassNameNoRedraw; | |
102 | WXDLLEXPORT_DATA(extern const wxChar*) wxMDIChildFrameClassName; | |
103 | WXDLLEXPORT_DATA(extern const wxChar*) wxMDIChildFrameClassNameNoRedraw; | |
104 | WXDLLEXPORT_DATA(extern const wxChar*) wxPanelClassName; | |
105 | WXDLLEXPORT_DATA(extern const wxChar*) wxPanelClassNameNR; | |
106 | WXDLLEXPORT_DATA(extern const wxChar*) wxCanvasClassName; | |
107 | WXDLLEXPORT_DATA(extern const wxChar*) wxCanvasClassNameNR; | |
108 | ||
45fcbf3b DW |
109 | // --------------------------------------------------------------------------- |
110 | // standard icons from the resources | |
111 | // --------------------------------------------------------------------------- | |
112 | ||
22e0b22b | 113 | #ifdef __WXPM__ |
bd3b171d | 114 | |
45fcbf3b DW |
115 | WXDLLEXPORT_DATA(extern HICON) wxSTD_FRAME_ICON; |
116 | WXDLLEXPORT_DATA(extern HICON) wxSTD_MDIPARENTFRAME_ICON; | |
117 | WXDLLEXPORT_DATA(extern HICON) wxSTD_MDICHILDFRAME_ICON; | |
118 | WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_FRAME_ICON; | |
119 | WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDIPARENTFRAME_ICON; | |
120 | WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDICHILDFRAME_ICON; | |
121 | WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT; | |
122 | ||
22e0b22b | 123 | #endif |
bd3b171d | 124 | |
45fcbf3b DW |
125 | // --------------------------------------------------------------------------- |
126 | // this defines a CASTWNDPROC macro which casts a pointer to the type of a | |
127 | // window proc for PM. | |
128 | // MPARAM is a void * but is really a 32-bit value | |
129 | // --------------------------------------------------------------------------- | |
130 | ||
131 | typedef MRESULT (APIENTRY * WndProcCast) (HWND, ULONG, MPARAM, MPARAM); | |
132 | #define CASTWNDPROC (WndProcCast) | |
133 | ||
134 | #if wxUSE_ITSY_BITSY | |
135 | #define IBS_HORZCAPTION 0x4000L | |
136 | #define IBS_VERTCAPTION 0x8000L | |
137 | ||
86de7616 DW |
138 | UINT APIENTRY ibGetCaptionSize( HWND hWnd ) ; |
139 | UINT APIENTRY ibSetCaptionSize( HWND hWnd, UINT nSize ) ; | |
140 | MRESULT APIENTRY ibDefWindowProc( HWND hWnd, ULONG ulMsg, MPARAM wParam, MPARAM lParam ) ; | |
141 | VOID APIENTRY ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ; | |
45fcbf3b DW |
142 | #endif // wxUSE_ITSY_BITSY |
143 | ||
144 | /* | |
145 | * Decide what window classes we're going to use | |
146 | * for this combination of CTl3D/FAFA settings | |
0e320a79 DW |
147 | */ |
148 | ||
45fcbf3b DW |
149 | #define STATIC_CLASS _T("STATIC") |
150 | #define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE) | |
86de7616 | 151 | #define CHECK_CLASS _T("BUTTON") |
45fcbf3b | 152 | #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP) |
7e1e6965 | 153 | #define CHECK_IS_FAFA FALSE |
86de7616 | 154 | #define RADIO_CLASS _T("BUTTON" ) |
45fcbf3b DW |
155 | #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE) |
156 | #define RADIO_SIZE 20 | |
7e1e6965 | 157 | #define RADIO_IS_FAFA FALSE |
45fcbf3b DW |
158 | #define PURE_WINDOWS |
159 | /* PM has no group box button style | |
160 | #define GROUP_CLASS "BUTTON" | |
161 | #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE) | |
162 | */ | |
163 | ||
164 | /* | |
165 | #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE) | |
166 | #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE) | |
167 | */ | |
168 | ||
169 | // --------------------------------------------------------------------------- | |
170 | // misc macros | |
171 | // --------------------------------------------------------------------------- | |
172 | ||
173 | #define MEANING_CHARACTER '0' | |
174 | #define DEFAULT_ITEM_WIDTH 200 | |
175 | #define DEFAULT_ITEM_HEIGHT 80 | |
176 | ||
177 | // Scale font to get edit control height | |
178 | #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2) | |
179 | ||
22e0b22b | 180 | #ifdef __WXPM__ |
bd3b171d | 181 | |
45fcbf3b DW |
182 | // Generic subclass proc, for panel item moving/sizing and intercept |
183 | // EDIT control VK_RETURN messages | |
86de7616 | 184 | extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message, WXWPARAM wParam, WXLPARAM lParam); |
45fcbf3b | 185 | |
bd3b171d SN |
186 | #endif |
187 | ||
45fcbf3b DW |
188 | // --------------------------------------------------------------------------- |
189 | // constants which might miss from some compilers' headers | |
190 | // --------------------------------------------------------------------------- | |
191 | ||
192 | #if !defined(WS_EX_CLIENTEDGE) | |
008089f6 | 193 | #define WS_EX_CLIENTEDGE 0x00000200L |
45fcbf3b DW |
194 | #endif |
195 | ||
196 | #ifndef ENDSESSION_LOGOFF | |
197 | #define ENDSESSION_LOGOFF 0x80000000 | |
198 | #endif | |
199 | ||
7e1e6965 WS |
200 | #ifndef PMERR_INVALID_PARM |
201 | #define PMERR_INVALID_PARM 0x1303 | |
202 | #endif | |
203 | ||
204 | #ifndef PMERR_INVALID_PARAMETERS | |
205 | #define PMERR_INVALID_PARAMETERS 0x1208 | |
206 | #endif | |
207 | ||
208 | #ifndef BOOKERR_INVALID_PARAMETERS | |
209 | #define BOOKERR_INVALID_PARAMETERS -1 | |
210 | #endif | |
211 | ||
212 | #ifndef DLGC_ENTRYFIELD | |
213 | #define DLGC_ENTRYFIELD 0x0001 | |
214 | #endif | |
215 | ||
216 | #ifndef DLGC_BUTTON | |
217 | #define DLGC_BUTTON 0x0002 | |
218 | #endif | |
219 | ||
220 | #ifndef DLGC_MLE | |
221 | #define DLGC_MLE 0x0400 | |
222 | #endif | |
223 | ||
224 | #ifndef DP_NORMAL | |
225 | #define DP_NORMAL 0 | |
226 | #endif | |
227 | ||
45fcbf3b DW |
228 | // --------------------------------------------------------------------------- |
229 | // debug messages -- OS/2 has no native debug output system | |
230 | // --------------------------------------------------------------------------- | |
231 | ||
232 | // --------------------------------------------------------------------------- | |
233 | // macros to make casting between WXFOO and FOO a bit easier: the GetFoo() | |
234 | // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes | |
235 | // an argument which should be a pointer or reference to the object of the | |
236 | // corresponding class (this depends on the macro) | |
237 | // --------------------------------------------------------------------------- | |
238 | ||
239 | #define GetHwnd() ((HWND)GetHWND()) | |
240 | #define GetHwndOf(win) ((HWND)((win)->GetHWND())) | |
241 | // old name | |
242 | #define GetWinHwnd GetHwndOf | |
243 | ||
244 | #define GetHdc() ((HDC)GetHDC()) | |
245 | #define GetHdcOf(dc) ((HDC)(dc).GetHDC()) | |
246 | ||
8bb6da4a DW |
247 | #define GetHbitmap() ((HBITMAP)GetHBITMAP()) |
248 | #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP()) | |
249 | ||
45fcbf3b DW |
250 | #define GetHicon() ((HICON)GetHICON()) |
251 | #define GetHiconOf(icon) ((HICON)(icon).GetHICON()) | |
252 | ||
253 | #define GetHaccel() ((HACCEL)GetHACCEL()) | |
254 | #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL())) | |
255 | ||
256 | #define GetHmenu() ((HMENU)GetHMenu()) | |
257 | #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu()) | |
258 | ||
8bb6da4a DW |
259 | #define GetHcursor() ((HCURSOR)GetHCURSOR()) |
260 | #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) | |
261 | ||
262 | #define GetHfont() ((HFONT)GetHFONT()) | |
263 | #define GetHfontOf(font) ((HFONT)(font).GetHFONT()) | |
264 | ||
77ffb593 | 265 | // OS/2 convention of the mask is opposed to the wxWidgets one, so we need |
8bb6da4a DW |
266 | // to invert the mask each time we pass one/get one to/from Windows |
267 | extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0); | |
268 | ||
45fcbf3b DW |
269 | // --------------------------------------------------------------------------- |
270 | // global data | |
271 | // --------------------------------------------------------------------------- | |
272 | ||
273 | // The MakeProcInstance version of the function wxSubclassedGenericControlProc | |
283ed244 | 274 | WXDLLEXPORT_DATA(extern int) wxGenericControlSubClassProc; |
45fcbf3b DW |
275 | WXDLLEXPORT_DATA(extern wxChar*) wxBuffer; |
276 | WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance; | |
277 | ||
278 | // --------------------------------------------------------------------------- | |
279 | // global functions | |
280 | // --------------------------------------------------------------------------- | |
281 | ||
282 | extern "C" | |
283 | { | |
284 | WXDLLEXPORT HINSTANCE wxGetInstance(); | |
285 | } | |
286 | ||
bd3b171d SN |
287 | WXDLLEXPORT void wxSetInstance(HINSTANCE hInst); |
288 | ||
d4ca5c8c SN |
289 | #include "wx/thread.h" |
290 | static inline MRESULT MySendMsg(HWND hwnd, ULONG ulMsgid, | |
291 | MPARAM mpParam1, MPARAM mpParam2) | |
292 | { | |
293 | MRESULT vRes; | |
294 | vRes = ::WinSendMsg(hwnd, ulMsgid, mpParam1, mpParam2); | |
295 | #if wxUSE_THREADS | |
296 | if (!wxThread::IsMain()) | |
297 | ::WinPostMsg(hwnd, ulMsgid, mpParam1, mpParam2); | |
298 | #endif | |
299 | return vRes; | |
300 | } | |
301 | #define WinSendMsg MySendMsg | |
302 | ||
22e0b22b | 303 | #ifdef __WXPM__ |
bd3b171d | 304 | |
008089f6 DW |
305 | WXDLLEXPORT void wxDrawBorder( HPS hPS |
306 | ,RECTL& rRect | |
307 | ,WXDWORD dwStyle | |
308 | ); | |
309 | ||
45fcbf3b DW |
310 | WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd); |
311 | ||
e99762c0 | 312 | WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font); |
1b75810c DW |
313 | |
314 | WXDLLEXPORT void wxConvertVectorFontSize( FIXED fxPointSize | |
315 | ,PFATTRS pFattrs | |
316 | ); | |
e99762c0 DW |
317 | WXDLLEXPORT void wxFillLogFont( LOGFONT* pLogFont |
318 | ,PFACENAMEDESC pFaceName | |
f140b352 | 319 | ,HPS* phPS |
7d921159 | 320 | ,bool* pbInternalPS |
cc95f4f9 DW |
321 | ,long* pflId |
322 | ,wxString& sFaceName | |
323 | ,wxFont* pFont | |
e99762c0 | 324 | ); |
cc95f4f9 DW |
325 | WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int nCharSet); |
326 | WXDLLEXPORT void wxOS2SelectMatchingFontByName( PFATTRS vFattrs | |
327 | ,PFACENAMEDESC pFaceName | |
328 | ,PFONTMETRICS pFM | |
329 | ,int nNumFonts | |
330 | ,const wxFont* pFont | |
331 | ); | |
e99762c0 DW |
332 | WXDLLEXPORT wxFont wxCreateFontFromLogFont( LOGFONT* pLogFont |
333 | ,PFONTMETRICS pFM | |
334 | ,PFACENAMEDESC pFace | |
335 | ); | |
edf1dfa1 | 336 | WXDLLEXPORT int wxGpiStrcmp(wxChar* s0, wxChar* s1); |
45fcbf3b DW |
337 | |
338 | WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); | |
339 | WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); | |
340 | ||
341 | // Find maximum size of window/rectangle | |
342 | WXDLLEXPORT extern void wxFindMaxSize(WXHWND hwnd, RECT *rect); | |
343 | ||
344 | WXDLLEXPORT wxWindow* wxFindControlFromHandle(WXHWND hWnd); | |
345 | WXDLLEXPORT void wxAddControlHandle(WXHWND hWnd, wxWindow *item); | |
346 | ||
347 | // Safely get the window text (i.e. without using fixed size buffer) | |
348 | WXDLLEXPORT extern wxString wxGetWindowText(WXHWND hWnd); | |
349 | ||
350 | // get the window class name | |
351 | WXDLLEXPORT extern wxString wxGetWindowClass(WXHWND hWnd); | |
352 | ||
353 | // get the window id (should be unsigned, hence this is not wxWindowID which | |
354 | // is, for mainly historical reasons, signed) | |
355 | WXDLLEXPORT extern WXWORD wxGetWindowId(WXHWND hWnd); | |
356 | ||
914589c2 DW |
357 | // Convert a PM Error code to a string |
358 | WXDLLEXPORT extern wxString wxPMErrorToStr(ERRORID vError); | |
359 | ||
45fcbf3b DW |
360 | // Does this window style specify any border? |
361 | inline bool wxStyleHasBorder(long style) | |
362 | { | |
363 | return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER | | |
364 | wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0; | |
365 | } | |
366 | ||
3011bf2b DW |
367 | inline RECTL wxGetWindowRect(HWND hWnd) |
368 | { | |
369 | RECTL vRect; | |
370 | ||
371 | ::WinQueryWindowRect(hWnd, &vRect); | |
372 | return vRect; | |
373 | } // end of wxGetWindowRect | |
374 | ||
3c299c3a DW |
375 | WXDLLEXPORT extern void wxOS2SetFont( HWND hWnd |
376 | ,const wxFont& rFont | |
377 | ); | |
378 | ||
008089f6 | 379 | |
db16e5c3 DW |
380 | WXDLLEXPORT extern bool wxCheckWindowWndProc( WXHWND hWnd |
381 | ,WXFARPROC fnWndProc | |
3011bf2b | 382 | ); |
db16e5c3 DW |
383 | WXDLLEXPORT extern wxBitmap wxDisableBitmap( const wxBitmap& rBmp |
384 | ,long lColor | |
385 | ); | |
386 | ||
bd3b171d SN |
387 | #include "wx/colour.h" |
388 | ||
9794cae1 | 389 | WXDLLEXPORT extern COLORREF wxColourToRGB(const wxColour& rColor); |
3011bf2b | 390 | |
22e0b22b | 391 | #endif // __WXPM__ |
bd3b171d SN |
392 | |
393 | #endif // _WX_PRIVATE_H_ |