]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/private.h
no changes, just remove #if'd out code
[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
b5dbe15d
VS
81class WXDLLIMPEXP_FWD_CORE wxFont;
82class WXDLLIMPEXP_FWD_CORE wxWindow;
83class WXDLLIMPEXP_FWD_BASE wxString;
84class WXDLLIMPEXP_FWD_CORE 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//
53a2db12
FM
97WXDLLIMPEXP_DATA_CORE(extern const char) wxButtonNameStr[];
98WXDLLIMPEXP_DATA_CORE(extern const char) wxCheckBoxNameStr[];
99WXDLLIMPEXP_DATA_CORE(extern const char) wxChoiceNameStr[];
100WXDLLIMPEXP_DATA_CORE(extern const char) wxComboBoxNameStr[];
101WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr[];
102WXDLLIMPEXP_DATA_CORE(extern const char) wxFrameNameStr[];
103WXDLLIMPEXP_DATA_CORE(extern const char) wxGaugeNameStr[];
104WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBoxNameStr[];
105WXDLLIMPEXP_DATA_CORE(extern const char) wxListBoxNameStr[];
106WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticLineNameStr[];
107WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticTextNameStr[];
108WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBitmapNameStr[];
109WXDLLIMPEXP_DATA_CORE(extern const char) wxPanelNameStr[];
110WXDLLIMPEXP_DATA_CORE(extern const char) wxRadioBoxNameStr[];
111WXDLLIMPEXP_DATA_CORE(extern const char) wxRadioButtonNameStr[];
112WXDLLIMPEXP_DATA_CORE(extern const char) wxBitmapRadioButtonNameStr[];
113WXDLLIMPEXP_DATA_CORE(extern const char) wxScrollBarNameStr[];
114WXDLLIMPEXP_DATA_CORE(extern const char) wxSliderNameStr[];
115WXDLLIMPEXP_DATA_CORE(extern const char) wxTextCtrlNameStr[];
116WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr[];
117WXDLLIMPEXP_DATA_CORE(extern const char) wxStatusLineNameStr[];
118WXDLLIMPEXP_DATA_CORE(extern const char) wxGetTextFromUserPromptStr[];
119WXDLLIMPEXP_DATA_CORE(extern const char) wxMessageBoxCaptionStr[];
120WXDLLIMPEXP_DATA_CORE(extern const char) wxFileSelectorPromptStr[];
121WXDLLIMPEXP_DATA_CORE(extern const char) wxFileSelectorDefaultWildcardStr[];
122WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxInternalErrorStr;
123WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxFatalErrorStr;
124WXDLLIMPEXP_DATA_CORE(extern const char) wxTreeCtrlNameStr[];
125WXDLLIMPEXP_DATA_CORE(extern const char) wxDirDialogNameStr[];
126WXDLLIMPEXP_DATA_CORE(extern const char) wxDirDialogDefaultFolderStr[];
511ac294
DW
127
128//
129// Class names
130//
53a2db12
FM
131WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxFrameClassName;
132WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxFrameClassNameNoRedraw;
133WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxMDIFrameClassName;
134WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxMDIFrameClassNameNoRedraw;
135WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxMDIChildFrameClassName;
136WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxMDIChildFrameClassNameNoRedraw;
137WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxPanelClassName;
138WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxPanelClassNameNR;
139WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxCanvasClassName;
140WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxCanvasClassNameNR;
511ac294 141
45fcbf3b
DW
142// ---------------------------------------------------------------------------
143// standard icons from the resources
144// ---------------------------------------------------------------------------
145
22e0b22b 146#ifdef __WXPM__
bd3b171d 147
53a2db12
FM
148WXDLLIMPEXP_DATA_CORE(extern HICON) wxSTD_FRAME_ICON;
149WXDLLIMPEXP_DATA_CORE(extern HICON) wxSTD_MDIPARENTFRAME_ICON;
150WXDLLIMPEXP_DATA_CORE(extern HICON) wxSTD_MDICHILDFRAME_ICON;
151WXDLLIMPEXP_DATA_CORE(extern HICON) wxDEFAULT_FRAME_ICON;
152WXDLLIMPEXP_DATA_CORE(extern HICON) wxDEFAULT_MDIPARENTFRAME_ICON;
153WXDLLIMPEXP_DATA_CORE(extern HICON) wxDEFAULT_MDICHILDFRAME_ICON;
154WXDLLIMPEXP_DATA_CORE(extern HFONT) wxSTATUS_LINE_FONT;
45fcbf3b 155
22e0b22b 156#endif
bd3b171d 157
45fcbf3b
DW
158// ---------------------------------------------------------------------------
159// this defines a CASTWNDPROC macro which casts a pointer to the type of a
160// window proc for PM.
161// MPARAM is a void * but is really a 32-bit value
162// ---------------------------------------------------------------------------
163
164typedef MRESULT (APIENTRY * WndProcCast) (HWND, ULONG, MPARAM, MPARAM);
165#define CASTWNDPROC (WndProcCast)
166
45fcbf3b
DW
167/*
168 * Decide what window classes we're going to use
169 * for this combination of CTl3D/FAFA settings
0e320a79
DW
170 */
171
45fcbf3b
DW
172#define STATIC_CLASS _T("STATIC")
173#define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
86de7616 174#define CHECK_CLASS _T("BUTTON")
45fcbf3b 175#define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
7e1e6965 176#define CHECK_IS_FAFA FALSE
86de7616 177#define RADIO_CLASS _T("BUTTON" )
45fcbf3b
DW
178#define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
179#define RADIO_SIZE 20
7e1e6965 180#define RADIO_IS_FAFA FALSE
45fcbf3b
DW
181#define PURE_WINDOWS
182/* PM has no group box button style
183#define GROUP_CLASS "BUTTON"
184#define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
185*/
186
187/*
188#define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
189#define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
190*/
191
192// ---------------------------------------------------------------------------
193// misc macros
194// ---------------------------------------------------------------------------
195
196#define MEANING_CHARACTER '0'
197#define DEFAULT_ITEM_WIDTH 200
198#define DEFAULT_ITEM_HEIGHT 80
199
200// Scale font to get edit control height
201#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
202
22e0b22b 203#ifdef __WXPM__
bd3b171d 204
45fcbf3b
DW
205// Generic subclass proc, for panel item moving/sizing and intercept
206// EDIT control VK_RETURN messages
86de7616 207extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message, WXWPARAM wParam, WXLPARAM lParam);
45fcbf3b 208
bd3b171d
SN
209#endif
210
45fcbf3b
DW
211// ---------------------------------------------------------------------------
212// constants which might miss from some compilers' headers
213// ---------------------------------------------------------------------------
214
215#if !defined(WS_EX_CLIENTEDGE)
008089f6 216 #define WS_EX_CLIENTEDGE 0x00000200L
45fcbf3b
DW
217#endif
218
219#ifndef ENDSESSION_LOGOFF
220 #define ENDSESSION_LOGOFF 0x80000000
221#endif
222
7e1e6965
WS
223#ifndef PMERR_INVALID_PARM
224 #define PMERR_INVALID_PARM 0x1303
225#endif
226
227#ifndef PMERR_INVALID_PARAMETERS
228 #define PMERR_INVALID_PARAMETERS 0x1208
229#endif
230
231#ifndef BOOKERR_INVALID_PARAMETERS
232 #define BOOKERR_INVALID_PARAMETERS -1
233#endif
234
235#ifndef DLGC_ENTRYFIELD
236 #define DLGC_ENTRYFIELD 0x0001
237#endif
238
239#ifndef DLGC_BUTTON
240 #define DLGC_BUTTON 0x0002
241#endif
242
243#ifndef DLGC_MLE
244 #define DLGC_MLE 0x0400
245#endif
246
247#ifndef DP_NORMAL
248 #define DP_NORMAL 0
249#endif
250
45fcbf3b
DW
251// ---------------------------------------------------------------------------
252// debug messages -- OS/2 has no native debug output system
253// ---------------------------------------------------------------------------
254
255// ---------------------------------------------------------------------------
256// macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
257// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
258// an argument which should be a pointer or reference to the object of the
259// corresponding class (this depends on the macro)
260// ---------------------------------------------------------------------------
261
262#define GetHwnd() ((HWND)GetHWND())
263#define GetHwndOf(win) ((HWND)((win)->GetHWND()))
264// old name
265#define GetWinHwnd GetHwndOf
266
267#define GetHdc() ((HDC)GetHDC())
268#define GetHdcOf(dc) ((HDC)(dc).GetHDC())
269
8bb6da4a
DW
270#define GetHbitmap() ((HBITMAP)GetHBITMAP())
271#define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
272
45fcbf3b
DW
273#define GetHicon() ((HICON)GetHICON())
274#define GetHiconOf(icon) ((HICON)(icon).GetHICON())
275
276#define GetHaccel() ((HACCEL)GetHACCEL())
277#define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
278
279#define GetHmenu() ((HMENU)GetHMenu())
280#define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
281
8bb6da4a
DW
282#define GetHcursor() ((HCURSOR)GetHCURSOR())
283#define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
284
285#define GetHfont() ((HFONT)GetHFONT())
286#define GetHfontOf(font) ((HFONT)(font).GetHFONT())
287
77ffb593 288// OS/2 convention of the mask is opposed to the wxWidgets one, so we need
8bb6da4a
DW
289// to invert the mask each time we pass one/get one to/from Windows
290extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0);
a4e15a8d 291extern HBITMAP wxCopyBmp(HBITMAP hbmp, bool flip=false, int w=0, int h=0);
8bb6da4a 292
45fcbf3b
DW
293// ---------------------------------------------------------------------------
294// global data
295// ---------------------------------------------------------------------------
296
fbf618df 297#ifdef __WXPM__
45fcbf3b 298// The MakeProcInstance version of the function wxSubclassedGenericControlProc
53a2db12
FM
299WXDLLIMPEXP_DATA_CORE(extern int) wxGenericControlSubClassProc;
300WXDLLIMPEXP_DATA_CORE(extern wxChar*) wxBuffer;
301WXDLLIMPEXP_DATA_CORE(extern HINSTANCE) wxhInstance;
55034339 302#endif
45fcbf3b
DW
303
304// ---------------------------------------------------------------------------
305// global functions
306// ---------------------------------------------------------------------------
307
fbf618df 308#ifdef __WXPM__
45fcbf3b
DW
309extern "C"
310{
53a2db12 311WXDLLIMPEXP_CORE HINSTANCE wxGetInstance();
45fcbf3b
DW
312}
313
53a2db12 314WXDLLIMPEXP_CORE void wxSetInstance(HINSTANCE hInst);
55034339 315#endif
bd3b171d 316
d4ca5c8c
SN
317#include "wx/thread.h"
318static inline MRESULT MySendMsg(HWND hwnd, ULONG ulMsgid,
319 MPARAM mpParam1, MPARAM mpParam2)
320{
321 MRESULT vRes;
322 vRes = ::WinSendMsg(hwnd, ulMsgid, mpParam1, mpParam2);
323#if wxUSE_THREADS
324 if (!wxThread::IsMain())
325 ::WinPostMsg(hwnd, ulMsgid, mpParam1, mpParam2);
326#endif
327 return vRes;
328}
329#define WinSendMsg MySendMsg
330
22e0b22b 331#ifdef __WXPM__
bd3b171d 332
53a2db12 333WXDLLIMPEXP_CORE void wxDrawBorder( HPS hPS
008089f6
DW
334 ,RECTL& rRect
335 ,WXDWORD dwStyle
336 );
337
53a2db12 338WXDLLIMPEXP_CORE wxWindow* wxFindWinFromHandle(WXHWND hWnd);
45fcbf3b 339
53a2db12 340WXDLLIMPEXP_CORE void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font);
1b75810c 341
53a2db12 342WXDLLIMPEXP_CORE void wxConvertVectorFontSize( FIXED fxPointSize
1b75810c
DW
343 ,PFATTRS pFattrs
344 );
53a2db12 345WXDLLIMPEXP_CORE void wxFillLogFont( LOGFONT* pLogFont
e99762c0 346 ,PFACENAMEDESC pFaceName
f140b352 347 ,HPS* phPS
7d921159 348 ,bool* pbInternalPS
cc95f4f9
DW
349 ,long* pflId
350 ,wxString& sFaceName
351 ,wxFont* pFont
e99762c0 352 );
53a2db12
FM
353WXDLLIMPEXP_CORE wxFontEncoding wxGetFontEncFromCharSet(int nCharSet);
354WXDLLIMPEXP_CORE void wxOS2SelectMatchingFontByName( PFATTRS vFattrs
cc95f4f9
DW
355 ,PFACENAMEDESC pFaceName
356 ,PFONTMETRICS pFM
357 ,int nNumFonts
358 ,const wxFont* pFont
359 );
53a2db12 360WXDLLIMPEXP_CORE wxFont wxCreateFontFromLogFont( LOGFONT* pLogFont
e99762c0
DW
361 ,PFONTMETRICS pFM
362 ,PFACENAMEDESC pFace
363 );
53a2db12 364WXDLLIMPEXP_CORE int wxGpiStrcmp(wxChar* s0, wxChar* s1);
45fcbf3b 365
53a2db12
FM
366WXDLLIMPEXP_CORE void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos);
367WXDLLIMPEXP_CORE void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos);
45fcbf3b
DW
368
369// Find maximum size of window/rectangle
53a2db12 370WXDLLIMPEXP_CORE extern void wxFindMaxSize(WXHWND hwnd, RECT *rect);
45fcbf3b 371
53a2db12
FM
372WXDLLIMPEXP_CORE wxWindow* wxFindControlFromHandle(WXHWND hWnd);
373WXDLLIMPEXP_CORE void wxAddControlHandle(WXHWND hWnd, wxWindow *item);
45fcbf3b
DW
374
375// Safely get the window text (i.e. without using fixed size buffer)
53a2db12 376WXDLLIMPEXP_CORE extern wxString wxGetWindowText(WXHWND hWnd);
45fcbf3b
DW
377
378// get the window class name
53a2db12 379WXDLLIMPEXP_CORE extern wxString wxGetWindowClass(WXHWND hWnd);
45fcbf3b
DW
380
381// get the window id (should be unsigned, hence this is not wxWindowID which
382// is, for mainly historical reasons, signed)
53a2db12 383WXDLLIMPEXP_CORE extern WXWORD wxGetWindowId(WXHWND hWnd);
45fcbf3b 384
914589c2 385// Convert a PM Error code to a string
0e2a14e5 386WXDLLIMPEXP_BASE extern wxString wxPMErrorToStr(ERRORID vError);
914589c2 387
45fcbf3b
DW
388// Does this window style specify any border?
389inline bool wxStyleHasBorder(long style)
390{
391 return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER |
392 wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
393}
394
3011bf2b
DW
395inline RECTL wxGetWindowRect(HWND hWnd)
396{
397 RECTL vRect;
398
399 ::WinQueryWindowRect(hWnd, &vRect);
400 return vRect;
401} // end of wxGetWindowRect
402
53a2db12 403WXDLLIMPEXP_CORE extern void wxOS2SetFont( HWND hWnd
3c299c3a
DW
404 ,const wxFont& rFont
405 );
406
008089f6 407
53a2db12 408WXDLLIMPEXP_CORE extern bool wxCheckWindowWndProc( WXHWND hWnd
db16e5c3 409 ,WXFARPROC fnWndProc
3011bf2b 410 );
53a2db12 411WXDLLIMPEXP_CORE extern wxBitmap wxDisableBitmap( const wxBitmap& rBmp
db16e5c3
DW
412 ,long lColor
413 );
5c80fea8 414#if wxUSE_GUI
fcc9c05e 415class wxColour;
53a2db12 416WXDLLIMPEXP_CORE extern COLORREF wxColourToRGB(const wxColour& rColor);
5c80fea8 417#endif
3011bf2b 418
22e0b22b 419#endif // __WXPM__
bd3b171d 420
0e2a14e5 421#endif // _WX_OS2_PRIVATE_H_