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