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