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