]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/os2/private.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / os2 / private.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/os2/private.h
3// Purpose: Private declarations: as this header is only included by
4// wxWidgets itself, it may contain identifiers which don't start
5// with "wx".
6// Author: Julian Smart
7// Modified by:
8// Created: 01/02/97
9// Copyright: (c) Julian Smart
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_OS2_PRIVATE_H_
14#define _WX_OS2_PRIVATE_H_
15
16#define INCL_BASE
17#define INCL_PM
18#define INCL_GPI
19#define INCL_WINSYS
20#define INCL_GPIERRORS
21#define INCL_DOS
22#define INCL_DOSPROCESS
23#define INCL_DOSERRORS
24#define INCL_WIN
25#define INCL_WINATOM
26#define INCL_SHLERRORS
27
28#include <os2.h>
29
30#if wxONLY_WATCOM_EARLIER_THAN(1,4)
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
40#if defined(__WATCOMC__) && defined(__WXMOTIF__)
41 #include <os2def.h>
42 #define I_NEED_OS2_H
43 #include <X11/Xmd.h>
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 }
50 #endif
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;
62 }
63#endif
64
65#if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
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
78#endif
79
80#include "wx/dlimpexp.h"
81#include "wx/fontenc.h"
82
83class WXDLLIMPEXP_FWD_CORE wxFont;
84class WXDLLIMPEXP_FWD_CORE wxWindow;
85class WXDLLIMPEXP_FWD_BASE wxString;
86class WXDLLIMPEXP_FWD_CORE wxBitmap;
87
88// ---------------------------------------------------------------------------
89// private constants
90// ---------------------------------------------------------------------------
91
92//
93// Constant strings for control names and classes
94//
95
96//
97// Controls
98//
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[];
129
130//
131// Class names
132//
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;
143
144// ---------------------------------------------------------------------------
145// standard icons from the resources
146// ---------------------------------------------------------------------------
147
148#ifdef __WXPM__
149
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;
157
158#endif
159
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
169/*
170 * Decide what window classes we're going to use
171 * for this combination of CTl3D/FAFA settings
172 */
173
174#define STATIC_CLASS wxT("STATIC")
175#define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
176#define CHECK_CLASS wxT("BUTTON")
177#define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
178#define CHECK_IS_FAFA FALSE
179#define RADIO_CLASS wxT("BUTTON" )
180#define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
181#define RADIO_SIZE 20
182#define RADIO_IS_FAFA FALSE
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
205#ifdef __WXPM__
206
207// Generic subclass proc, for panel item moving/sizing and intercept
208// EDIT control VK_RETURN messages
209extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message, WXWPARAM wParam, WXLPARAM lParam);
210
211#endif
212
213// ---------------------------------------------------------------------------
214// constants which might miss from some compilers' headers
215// ---------------------------------------------------------------------------
216
217#if !defined(WS_EX_CLIENTEDGE)
218 #define WS_EX_CLIENTEDGE 0x00000200L
219#endif
220
221#ifndef ENDSESSION_LOGOFF
222 #define ENDSESSION_LOGOFF 0x80000000
223#endif
224
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
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
272#define GetHbitmap() ((HBITMAP)GetHBITMAP())
273#define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
274
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
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
290// OS/2 convention of the mask is opposed to the wxWidgets one, so we need
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);
293extern HBITMAP wxCopyBmp(HBITMAP hbmp, bool flip=false, int w=0, int h=0);
294
295// ---------------------------------------------------------------------------
296// global data
297// ---------------------------------------------------------------------------
298
299#ifdef __WXPM__
300// The MakeProcInstance version of the function wxSubclassedGenericControlProc
301WXDLLIMPEXP_DATA_CORE(extern int) wxGenericControlSubClassProc;
302WXDLLIMPEXP_DATA_CORE(extern wxChar*) wxBuffer;
303WXDLLIMPEXP_DATA_CORE(extern HINSTANCE) wxhInstance;
304#endif
305
306// ---------------------------------------------------------------------------
307// global functions
308// ---------------------------------------------------------------------------
309
310#ifdef __WXPM__
311extern "C"
312{
313WXDLLIMPEXP_CORE HINSTANCE wxGetInstance();
314}
315
316WXDLLIMPEXP_CORE void wxSetInstance(HINSTANCE hInst);
317#endif
318
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
333#ifdef __WXPM__
334
335WXDLLIMPEXP_CORE void wxDrawBorder( HPS hPS
336 ,RECTL& rRect
337 ,WXDWORD dwStyle
338 );
339
340WXDLLIMPEXP_CORE wxWindow* wxFindWinFromHandle(WXHWND hWnd);
341
342WXDLLIMPEXP_CORE void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font);
343
344WXDLLIMPEXP_CORE void wxConvertVectorFontSize( FIXED fxPointSize
345 ,PFATTRS pFattrs
346 );
347WXDLLIMPEXP_CORE void wxFillLogFont( LOGFONT* pLogFont
348 ,PFACENAMEDESC pFaceName
349 ,HPS* phPS
350 ,bool* pbInternalPS
351 ,long* pflId
352 ,wxString& sFaceName
353 ,wxFont* pFont
354 );
355WXDLLIMPEXP_CORE wxFontEncoding wxGetFontEncFromCharSet(int nCharSet);
356WXDLLIMPEXP_CORE void wxOS2SelectMatchingFontByName( PFATTRS vFattrs
357 ,PFACENAMEDESC pFaceName
358 ,PFONTMETRICS pFM
359 ,int nNumFonts
360 ,const wxFont* pFont
361 );
362WXDLLIMPEXP_CORE wxFont wxCreateFontFromLogFont( LOGFONT* pLogFont
363 ,PFONTMETRICS pFM
364 ,PFACENAMEDESC pFace
365 );
366WXDLLIMPEXP_CORE int wxGpiStrcmp(wxChar* s0, wxChar* s1);
367
368WXDLLIMPEXP_CORE void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos);
369WXDLLIMPEXP_CORE void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos);
370
371// Find maximum size of window/rectangle
372WXDLLIMPEXP_CORE extern void wxFindMaxSize(WXHWND hwnd, RECT *rect);
373
374WXDLLIMPEXP_CORE wxWindow* wxFindControlFromHandle(WXHWND hWnd);
375WXDLLIMPEXP_CORE void wxAddControlHandle(WXHWND hWnd, wxWindow *item);
376
377// Safely get the window text (i.e. without using fixed size buffer)
378WXDLLIMPEXP_CORE extern wxString wxGetWindowText(WXHWND hWnd);
379
380// get the window class name
381WXDLLIMPEXP_CORE extern wxString wxGetWindowClass(WXHWND hWnd);
382
383// get the window id (should be unsigned, hence this is not wxWindowID which
384// is, for mainly historical reasons, signed)
385WXDLLIMPEXP_CORE extern WXWORD wxGetWindowId(WXHWND hWnd);
386
387// Convert a PM Error code to a string
388WXDLLIMPEXP_BASE extern wxString wxPMErrorToStr(ERRORID vError);
389
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
397inline RECTL wxGetWindowRect(HWND hWnd)
398{
399 RECTL vRect;
400
401 ::WinQueryWindowRect(hWnd, &vRect);
402 return vRect;
403} // end of wxGetWindowRect
404
405WXDLLIMPEXP_CORE extern void wxOS2SetFont( HWND hWnd
406 ,const wxFont& rFont
407 );
408
409
410WXDLLIMPEXP_CORE extern bool wxCheckWindowWndProc( WXHWND hWnd
411 ,WXFARPROC fnWndProc
412 );
413WXDLLIMPEXP_CORE extern wxBitmap wxDisableBitmap( const wxBitmap& rBmp
414 ,long lColor
415 );
416#if wxUSE_GUI
417class wxColour;
418WXDLLIMPEXP_CORE extern COLORREF wxColourToRGB(const wxColour& rColor);
419#endif
420
421#endif // __WXPM__
422
423#endif // _WX_OS2_PRIVATE_H_