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