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
22 #define INCL_GPIERRORS
28 #if wxONLY_WATCOM_EARLIER_THAN(1,4)
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
;}
38 #if defined(__WATCOMC__) && defined(__WXMOTIF__)
43 // include this header from here for many of the GUI related code
46 #include <Xm/VendorSP.h>
50 // provide Unix-like pipe()
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] )
58 wxFAIL_MSG(wxT("Implement first"));
63 #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
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. */
74 typedef SPBCDATA
*PSPBCDATA
;
78 #include "wx/dlimpexp.h"
79 #include "wx/fontenc.h"
81 class WXDLLEXPORT wxFont
;
82 class WXDLLEXPORT wxWindow
;
83 class WXDLLIMPEXP_BASE wxString
;
84 class WXDLLEXPORT wxBitmap
;
86 // ---------------------------------------------------------------------------
88 // ---------------------------------------------------------------------------
91 // Constant strings for control names and classes
97 WXDLLEXPORT_DATA(extern const wxChar
) wxButtonNameStr
[];
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
) wxPanelNameStr
[];
109 WXDLLEXPORT_DATA(extern const wxChar
) wxRadioBoxNameStr
[];
110 WXDLLEXPORT_DATA(extern const wxChar
) wxRadioButtonNameStr
[];
111 WXDLLEXPORT_DATA(extern const wxChar
) wxBitmapRadioButtonNameStr
[];
112 WXDLLEXPORT_DATA(extern const wxChar
) wxScrollBarNameStr
[];
113 WXDLLEXPORT_DATA(extern const wxChar
) wxSliderNameStr
[];
114 WXDLLEXPORT_DATA(extern const wxChar
) wxTextCtrlNameStr
[];
115 WXDLLEXPORT_DATA(extern const wxChar
) wxToolBarNameStr
[];
116 WXDLLEXPORT_DATA(extern const wxChar
) wxStatusLineNameStr
[];
117 WXDLLEXPORT_DATA(extern const wxChar
) wxGetTextFromUserPromptStr
[];
118 WXDLLEXPORT_DATA(extern const wxChar
) wxMessageBoxCaptionStr
[];
119 WXDLLEXPORT_DATA(extern const wxChar
) wxFileSelectorPromptStr
[];
120 WXDLLEXPORT_DATA(extern const wxChar
) wxFileSelectorDefaultWildcardStr
[];
121 WXDLLEXPORT_DATA(extern const wxChar
*) wxInternalErrorStr
;
122 WXDLLEXPORT_DATA(extern const wxChar
*) wxFatalErrorStr
;
123 WXDLLEXPORT_DATA(extern const wxChar
) wxTreeCtrlNameStr
[];
124 WXDLLEXPORT_DATA(extern const wxChar
) wxDirDialogNameStr
[];
125 WXDLLEXPORT_DATA(extern const wxChar
) wxDirDialogDefaultFolderStr
[];
130 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameClassName
;
131 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameClassNameNoRedraw
;
132 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIFrameClassName
;
133 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIFrameClassNameNoRedraw
;
134 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIChildFrameClassName
;
135 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIChildFrameClassNameNoRedraw
;
136 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelClassName
;
137 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelClassNameNR
;
138 WXDLLEXPORT_DATA(extern const wxChar
*) wxCanvasClassName
;
139 WXDLLEXPORT_DATA(extern const wxChar
*) wxCanvasClassNameNR
;
141 // ---------------------------------------------------------------------------
142 // standard icons from the resources
143 // ---------------------------------------------------------------------------
147 WXDLLEXPORT_DATA(extern HICON
) wxSTD_FRAME_ICON
;
148 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDIPARENTFRAME_ICON
;
149 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDICHILDFRAME_ICON
;
150 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_FRAME_ICON
;
151 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDIPARENTFRAME_ICON
;
152 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDICHILDFRAME_ICON
;
153 WXDLLEXPORT_DATA(extern HFONT
) wxSTATUS_LINE_FONT
;
157 // ---------------------------------------------------------------------------
158 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
159 // window proc for PM.
160 // MPARAM is a void * but is really a 32-bit value
161 // ---------------------------------------------------------------------------
163 typedef MRESULT (APIENTRY
* WndProcCast
) (HWND
, ULONG
, MPARAM
, MPARAM
);
164 #define CASTWNDPROC (WndProcCast)
167 * Decide what window classes we're going to use
168 * for this combination of CTl3D/FAFA settings
171 #define STATIC_CLASS _T("STATIC")
172 #define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
173 #define CHECK_CLASS _T("BUTTON")
174 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
175 #define CHECK_IS_FAFA FALSE
176 #define RADIO_CLASS _T("BUTTON" )
177 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
178 #define RADIO_SIZE 20
179 #define RADIO_IS_FAFA FALSE
181 /* PM has no group box button style
182 #define GROUP_CLASS "BUTTON"
183 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
187 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
188 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
191 // ---------------------------------------------------------------------------
193 // ---------------------------------------------------------------------------
195 #define MEANING_CHARACTER '0'
196 #define DEFAULT_ITEM_WIDTH 200
197 #define DEFAULT_ITEM_HEIGHT 80
199 // Scale font to get edit control height
200 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
204 // Generic subclass proc, for panel item moving/sizing and intercept
205 // EDIT control VK_RETURN messages
206 extern LONG APIENTRY
wxSubclassedGenericControlProc(WXHWND hWnd
, WXDWORD message
, WXWPARAM wParam
, WXLPARAM lParam
);
210 // ---------------------------------------------------------------------------
211 // constants which might miss from some compilers' headers
212 // ---------------------------------------------------------------------------
214 #if !defined(WS_EX_CLIENTEDGE)
215 #define WS_EX_CLIENTEDGE 0x00000200L
218 #ifndef ENDSESSION_LOGOFF
219 #define ENDSESSION_LOGOFF 0x80000000
222 #ifndef PMERR_INVALID_PARM
223 #define PMERR_INVALID_PARM 0x1303
226 #ifndef PMERR_INVALID_PARAMETERS
227 #define PMERR_INVALID_PARAMETERS 0x1208
230 #ifndef BOOKERR_INVALID_PARAMETERS
231 #define BOOKERR_INVALID_PARAMETERS -1
234 #ifndef DLGC_ENTRYFIELD
235 #define DLGC_ENTRYFIELD 0x0001
239 #define DLGC_BUTTON 0x0002
243 #define DLGC_MLE 0x0400
250 // ---------------------------------------------------------------------------
251 // debug messages -- OS/2 has no native debug output system
252 // ---------------------------------------------------------------------------
254 // ---------------------------------------------------------------------------
255 // macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
256 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
257 // an argument which should be a pointer or reference to the object of the
258 // corresponding class (this depends on the macro)
259 // ---------------------------------------------------------------------------
261 #define GetHwnd() ((HWND)GetHWND())
262 #define GetHwndOf(win) ((HWND)((win)->GetHWND()))
264 #define GetWinHwnd GetHwndOf
266 #define GetHdc() ((HDC)GetHDC())
267 #define GetHdcOf(dc) ((HDC)(dc).GetHDC())
269 #define GetHbitmap() ((HBITMAP)GetHBITMAP())
270 #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
272 #define GetHicon() ((HICON)GetHICON())
273 #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
275 #define GetHaccel() ((HACCEL)GetHACCEL())
276 #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
278 #define GetHmenu() ((HMENU)GetHMenu())
279 #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
281 #define GetHcursor() ((HCURSOR)GetHCURSOR())
282 #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
284 #define GetHfont() ((HFONT)GetHFONT())
285 #define GetHfontOf(font) ((HFONT)(font).GetHFONT())
287 // OS/2 convention of the mask is opposed to the wxWidgets one, so we need
288 // to invert the mask each time we pass one/get one to/from Windows
289 extern HBITMAP
wxInvertMask(HBITMAP hbmpMask
, int w
= 0, int h
= 0);
290 extern HBITMAP
wxCopyBmp(HBITMAP hbmp
, bool flip
=false, int w
=0, int h
=0);
292 // ---------------------------------------------------------------------------
294 // ---------------------------------------------------------------------------
297 // The MakeProcInstance version of the function wxSubclassedGenericControlProc
298 WXDLLEXPORT_DATA(extern int) wxGenericControlSubClassProc
;
299 WXDLLEXPORT_DATA(extern wxChar
*) wxBuffer
;
300 WXDLLEXPORT_DATA(extern HINSTANCE
) wxhInstance
;
303 // ---------------------------------------------------------------------------
305 // ---------------------------------------------------------------------------
310 WXDLLEXPORT HINSTANCE
wxGetInstance();
313 WXDLLEXPORT
void wxSetInstance(HINSTANCE hInst
);
316 #include "wx/thread.h"
317 static inline MRESULT
MySendMsg(HWND hwnd
, ULONG ulMsgid
,
318 MPARAM mpParam1
, MPARAM mpParam2
)
321 vRes
= ::WinSendMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
323 if (!wxThread::IsMain())
324 ::WinPostMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
328 #define WinSendMsg MySendMsg
332 WXDLLEXPORT
void wxDrawBorder( HPS hPS
337 WXDLLEXPORT wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
339 WXDLLEXPORT
void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
);
341 WXDLLEXPORT
void wxConvertVectorFontSize( FIXED fxPointSize
344 WXDLLEXPORT
void wxFillLogFont( LOGFONT
* pLogFont
345 ,PFACENAMEDESC pFaceName
352 WXDLLEXPORT wxFontEncoding
wxGetFontEncFromCharSet(int nCharSet
);
353 WXDLLEXPORT
void wxOS2SelectMatchingFontByName( PFATTRS vFattrs
354 ,PFACENAMEDESC pFaceName
359 WXDLLEXPORT wxFont
wxCreateFontFromLogFont( LOGFONT
* pLogFont
363 WXDLLEXPORT
int wxGpiStrcmp(wxChar
* s0
, wxChar
* s1
);
365 WXDLLEXPORT
void wxSliderEvent(WXHWND control
, WXWORD wParam
, WXWORD pos
);
366 WXDLLEXPORT
void wxScrollBarEvent(WXHWND hbar
, WXWORD wParam
, WXWORD pos
);
368 // Find maximum size of window/rectangle
369 WXDLLEXPORT
extern void wxFindMaxSize(WXHWND hwnd
, RECT
*rect
);
371 WXDLLEXPORT wxWindow
* wxFindControlFromHandle(WXHWND hWnd
);
372 WXDLLEXPORT
void wxAddControlHandle(WXHWND hWnd
, wxWindow
*item
);
374 // Safely get the window text (i.e. without using fixed size buffer)
375 WXDLLEXPORT
extern wxString
wxGetWindowText(WXHWND hWnd
);
377 // get the window class name
378 WXDLLEXPORT
extern wxString
wxGetWindowClass(WXHWND hWnd
);
380 // get the window id (should be unsigned, hence this is not wxWindowID which
381 // is, for mainly historical reasons, signed)
382 WXDLLEXPORT
extern WXWORD
wxGetWindowId(WXHWND hWnd
);
384 // Convert a PM Error code to a string
385 WXDLLIMPEXP_BASE
extern wxString
wxPMErrorToStr(ERRORID vError
);
387 // Does this window style specify any border?
388 inline bool wxStyleHasBorder(long style
)
390 return (style
& (wxSIMPLE_BORDER
| wxRAISED_BORDER
|
391 wxSUNKEN_BORDER
| wxDOUBLE_BORDER
)) != 0;
394 inline RECTL
wxGetWindowRect(HWND hWnd
)
398 ::WinQueryWindowRect(hWnd
, &vRect
);
400 } // end of wxGetWindowRect
402 WXDLLEXPORT
extern void wxOS2SetFont( HWND hWnd
407 WXDLLEXPORT
extern bool wxCheckWindowWndProc( WXHWND hWnd
410 WXDLLEXPORT
extern wxBitmap
wxDisableBitmap( const wxBitmap
& rBmp
414 #include "wx/colour.h"
416 WXDLLEXPORT
extern COLORREF
wxColourToRGB(const wxColour
& rColor
);
420 #endif // _WX_OS2_PRIVATE_H_