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
6 // Author: Julian Smart
10 // Copyright: (c) Julian Smart
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_OS2_PRIVATE_H_
15 #define _WX_OS2_PRIVATE_H_
21 #define INCL_SHLERRORS
27 #if wxONLY_WATCOM_EARLIER_THAN(1,4)
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
;}
37 #if defined(__WATCOMC__) && defined(__WXMOTIF__)
42 // include this header from here for many of the GUI related code
45 #include <Xm/VendorSP.h>
49 // provide Unix-like pipe()
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] )
57 wxFAIL_MSG(wxT("Implement first"));
62 #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
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. */
73 typedef SPBCDATA
*PSPBCDATA
;
77 #include "wx/dlimpexp.h"
78 #include "wx/fontenc.h"
80 class WXDLLEXPORT wxFont
;
81 class WXDLLEXPORT wxWindow
;
82 class WXDLLEXPORT wxString
;
83 class WXDLLEXPORT wxBitmap
;
85 // ---------------------------------------------------------------------------
87 // ---------------------------------------------------------------------------
90 // Constant strings for control names and classes
96 WXDLLEXPORT_DATA(extern const wxChar
) wxButtonNameStr
[];
97 WXDLLEXPORT_DATA(extern const wxChar
) wxCanvasNameStr
[];
98 WXDLLEXPORT_DATA(extern const wxChar
) wxCheckBoxNameStr
[];
99 WXDLLEXPORT_DATA(extern const wxChar
) wxChoiceNameStr
[];
100 WXDLLEXPORT_DATA(extern const wxChar
) wxComboBoxNameStr
[];
101 WXDLLEXPORT_DATA(extern const wxChar
) wxDialogNameStr
[];
102 WXDLLEXPORT_DATA(extern const wxChar
) wxFrameNameStr
[];
103 WXDLLEXPORT_DATA(extern const wxChar
) wxGaugeNameStr
[];
104 WXDLLEXPORT_DATA(extern const wxChar
) wxStaticBoxNameStr
[];
105 WXDLLEXPORT_DATA(extern const wxChar
) wxListBoxNameStr
[];
106 WXDLLEXPORT_DATA(extern const wxChar
) wxStaticTextNameStr
[];
107 WXDLLEXPORT_DATA(extern const wxChar
) wxStaticBitmapNameStr
[];
108 WXDLLEXPORT_DATA(extern const wxChar
) wxMultiTextNameStr
[];
109 WXDLLEXPORT_DATA(extern const wxChar
) wxPanelNameStr
[];
110 WXDLLEXPORT_DATA(extern const wxChar
) wxRadioBoxNameStr
[];
111 WXDLLEXPORT_DATA(extern const wxChar
) wxRadioButtonNameStr
[];
112 WXDLLEXPORT_DATA(extern const wxChar
) wxBitmapRadioButtonNameStr
[];
113 WXDLLEXPORT_DATA(extern const wxChar
) wxScrollBarNameStr
[];
114 WXDLLEXPORT_DATA(extern const wxChar
) wxSliderNameStr
[];
115 WXDLLEXPORT_DATA(extern const wxChar
) wxStaticNameStr
[];
116 WXDLLEXPORT_DATA(extern const wxChar
) wxTextCtrlWindowNameStr
[];
117 WXDLLEXPORT_DATA(extern const wxChar
) wxTextCtrlNameStr
[];
118 WXDLLEXPORT_DATA(extern const wxChar
) wxVirtListBoxNameStr
[];
119 WXDLLEXPORT_DATA(extern const wxChar
) wxButtonBarNameStr
[];
120 WXDLLEXPORT_DATA(extern const wxChar
) wxEnhDialogNameStr
[];
121 WXDLLEXPORT_DATA(extern const wxChar
) wxToolBarNameStr
[];
122 WXDLLEXPORT_DATA(extern const wxChar
) wxStatusLineNameStr
[];
123 WXDLLEXPORT_DATA(extern const wxChar
) wxGetTextFromUserPromptStr
[];
124 WXDLLEXPORT_DATA(extern const wxChar
) wxMessageBoxCaptionStr
[];
125 WXDLLEXPORT_DATA(extern const wxChar
) wxFileSelectorPromptStr
[];
126 WXDLLEXPORT_DATA(extern const wxChar
) wxFileSelectorDefaultWildcardStr
[];
127 WXDLLEXPORT_DATA(extern const wxChar
*) wxInternalErrorStr
;
128 WXDLLEXPORT_DATA(extern const wxChar
*) wxFatalErrorStr
;
129 WXDLLEXPORT_DATA(extern const wxChar
) wxTreeCtrlNameStr
[];
130 WXDLLEXPORT_DATA(extern const wxChar
) wxDirDialogNameStr
[];
131 WXDLLEXPORT_DATA(extern const wxChar
) wxDirDialogDefaultFolderStr
[];
136 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameClassName
;
137 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameClassNameNoRedraw
;
138 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIFrameClassName
;
139 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIFrameClassNameNoRedraw
;
140 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIChildFrameClassName
;
141 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIChildFrameClassNameNoRedraw
;
142 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelClassName
;
143 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelClassNameNR
;
144 WXDLLEXPORT_DATA(extern const wxChar
*) wxCanvasClassName
;
145 WXDLLEXPORT_DATA(extern const wxChar
*) wxCanvasClassNameNR
;
147 // ---------------------------------------------------------------------------
148 // standard icons from the resources
149 // ---------------------------------------------------------------------------
153 WXDLLEXPORT_DATA(extern HICON
) wxSTD_FRAME_ICON
;
154 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDIPARENTFRAME_ICON
;
155 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDICHILDFRAME_ICON
;
156 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_FRAME_ICON
;
157 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDIPARENTFRAME_ICON
;
158 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDICHILDFRAME_ICON
;
159 WXDLLEXPORT_DATA(extern HFONT
) wxSTATUS_LINE_FONT
;
163 // ---------------------------------------------------------------------------
164 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
165 // window proc for PM.
166 // MPARAM is a void * but is really a 32-bit value
167 // ---------------------------------------------------------------------------
169 typedef MRESULT (APIENTRY
* WndProcCast
) (HWND
, ULONG
, MPARAM
, MPARAM
);
170 #define CASTWNDPROC (WndProcCast)
173 * Decide what window classes we're going to use
174 * for this combination of CTl3D/FAFA settings
177 #define STATIC_CLASS _T("STATIC")
178 #define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
179 #define CHECK_CLASS _T("BUTTON")
180 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
181 #define CHECK_IS_FAFA FALSE
182 #define RADIO_CLASS _T("BUTTON" )
183 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
184 #define RADIO_SIZE 20
185 #define RADIO_IS_FAFA FALSE
187 /* PM has no group box button style
188 #define GROUP_CLASS "BUTTON"
189 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
193 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
194 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
197 // ---------------------------------------------------------------------------
199 // ---------------------------------------------------------------------------
201 #define MEANING_CHARACTER '0'
202 #define DEFAULT_ITEM_WIDTH 200
203 #define DEFAULT_ITEM_HEIGHT 80
205 // Scale font to get edit control height
206 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
210 // Generic subclass proc, for panel item moving/sizing and intercept
211 // EDIT control VK_RETURN messages
212 extern LONG APIENTRY
wxSubclassedGenericControlProc(WXHWND hWnd
, WXDWORD message
, WXWPARAM wParam
, WXLPARAM lParam
);
216 // ---------------------------------------------------------------------------
217 // constants which might miss from some compilers' headers
218 // ---------------------------------------------------------------------------
220 #if !defined(WS_EX_CLIENTEDGE)
221 #define WS_EX_CLIENTEDGE 0x00000200L
224 #ifndef ENDSESSION_LOGOFF
225 #define ENDSESSION_LOGOFF 0x80000000
228 #ifndef PMERR_INVALID_PARM
229 #define PMERR_INVALID_PARM 0x1303
232 #ifndef PMERR_INVALID_PARAMETERS
233 #define PMERR_INVALID_PARAMETERS 0x1208
236 #ifndef BOOKERR_INVALID_PARAMETERS
237 #define BOOKERR_INVALID_PARAMETERS -1
240 #ifndef DLGC_ENTRYFIELD
241 #define DLGC_ENTRYFIELD 0x0001
245 #define DLGC_BUTTON 0x0002
249 #define DLGC_MLE 0x0400
256 // ---------------------------------------------------------------------------
257 // debug messages -- OS/2 has no native debug output system
258 // ---------------------------------------------------------------------------
260 // ---------------------------------------------------------------------------
261 // macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
262 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
263 // an argument which should be a pointer or reference to the object of the
264 // corresponding class (this depends on the macro)
265 // ---------------------------------------------------------------------------
267 #define GetHwnd() ((HWND)GetHWND())
268 #define GetHwndOf(win) ((HWND)((win)->GetHWND()))
270 #define GetWinHwnd GetHwndOf
272 #define GetHdc() ((HDC)GetHDC())
273 #define GetHdcOf(dc) ((HDC)(dc).GetHDC())
275 #define GetHbitmap() ((HBITMAP)GetHBITMAP())
276 #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
278 #define GetHicon() ((HICON)GetHICON())
279 #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
281 #define GetHaccel() ((HACCEL)GetHACCEL())
282 #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
284 #define GetHmenu() ((HMENU)GetHMenu())
285 #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
287 #define GetHcursor() ((HCURSOR)GetHCURSOR())
288 #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
290 #define GetHfont() ((HFONT)GetHFONT())
291 #define GetHfontOf(font) ((HFONT)(font).GetHFONT())
293 // OS/2 convention of the mask is opposed to the wxWidgets one, so we need
294 // to invert the mask each time we pass one/get one to/from Windows
295 extern HBITMAP
wxInvertMask(HBITMAP hbmpMask
, int w
= 0, int h
= 0);
296 extern HBITMAP
wxFlipBmp(HBITMAP hbmp
, int w
= 0, int h
= 0);
298 // ---------------------------------------------------------------------------
300 // ---------------------------------------------------------------------------
303 // The MakeProcInstance version of the function wxSubclassedGenericControlProc
304 WXDLLEXPORT_DATA(extern int) wxGenericControlSubClassProc
;
305 WXDLLEXPORT_DATA(extern wxChar
*) wxBuffer
;
306 WXDLLEXPORT_DATA(extern HINSTANCE
) wxhInstance
;
309 // ---------------------------------------------------------------------------
311 // ---------------------------------------------------------------------------
316 WXDLLEXPORT HINSTANCE
wxGetInstance();
319 WXDLLEXPORT
void wxSetInstance(HINSTANCE hInst
);
322 #include "wx/thread.h"
323 static inline MRESULT
MySendMsg(HWND hwnd
, ULONG ulMsgid
,
324 MPARAM mpParam1
, MPARAM mpParam2
)
327 vRes
= ::WinSendMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
329 if (!wxThread::IsMain())
330 ::WinPostMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
334 #define WinSendMsg MySendMsg
338 WXDLLEXPORT
void wxDrawBorder( HPS hPS
343 WXDLLEXPORT wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
345 WXDLLEXPORT
void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
);
347 WXDLLEXPORT
void wxConvertVectorFontSize( FIXED fxPointSize
350 WXDLLEXPORT
void wxFillLogFont( LOGFONT
* pLogFont
351 ,PFACENAMEDESC pFaceName
358 WXDLLEXPORT wxFontEncoding
wxGetFontEncFromCharSet(int nCharSet
);
359 WXDLLEXPORT
void wxOS2SelectMatchingFontByName( PFATTRS vFattrs
360 ,PFACENAMEDESC pFaceName
365 WXDLLEXPORT wxFont
wxCreateFontFromLogFont( LOGFONT
* pLogFont
369 WXDLLEXPORT
int wxGpiStrcmp(wxChar
* s0
, wxChar
* s1
);
371 WXDLLEXPORT
void wxSliderEvent(WXHWND control
, WXWORD wParam
, WXWORD pos
);
372 WXDLLEXPORT
void wxScrollBarEvent(WXHWND hbar
, WXWORD wParam
, WXWORD pos
);
374 // Find maximum size of window/rectangle
375 WXDLLEXPORT
extern void wxFindMaxSize(WXHWND hwnd
, RECT
*rect
);
377 WXDLLEXPORT wxWindow
* wxFindControlFromHandle(WXHWND hWnd
);
378 WXDLLEXPORT
void wxAddControlHandle(WXHWND hWnd
, wxWindow
*item
);
380 // Safely get the window text (i.e. without using fixed size buffer)
381 WXDLLEXPORT
extern wxString
wxGetWindowText(WXHWND hWnd
);
383 // get the window class name
384 WXDLLEXPORT
extern wxString
wxGetWindowClass(WXHWND hWnd
);
386 // get the window id (should be unsigned, hence this is not wxWindowID which
387 // is, for mainly historical reasons, signed)
388 WXDLLEXPORT
extern WXWORD
wxGetWindowId(WXHWND hWnd
);
390 // Convert a PM Error code to a string
391 WXDLLIMPEXP_BASE
extern wxString
wxPMErrorToStr(ERRORID vError
);
393 // Does this window style specify any border?
394 inline bool wxStyleHasBorder(long style
)
396 return (style
& (wxSIMPLE_BORDER
| wxRAISED_BORDER
|
397 wxSUNKEN_BORDER
| wxDOUBLE_BORDER
)) != 0;
400 inline RECTL
wxGetWindowRect(HWND hWnd
)
404 ::WinQueryWindowRect(hWnd
, &vRect
);
406 } // end of wxGetWindowRect
408 WXDLLEXPORT
extern void wxOS2SetFont( HWND hWnd
413 WXDLLEXPORT
extern bool wxCheckWindowWndProc( WXHWND hWnd
416 WXDLLEXPORT
extern wxBitmap
wxDisableBitmap( const wxBitmap
& rBmp
420 #include "wx/colour.h"
422 WXDLLEXPORT
extern COLORREF
wxColourToRGB(const wxColour
& rColor
);
426 #endif // _WX_OS2_PRIVATE_H_