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_GPIERRORS
23 #define INCL_DOSPROCESS
24 #define INCL_DOSERRORS
27 #define INCL_SHLERRORS
31 #if wxONLY_WATCOM_EARLIER_THAN(1,4)
32 inline HATOMTBL APIENTRY
WinQuerySystemAtomTable(VOID
){return NULL
;}
33 inline ULONG APIENTRY
WinQueryAtomName(HATOMTBL
,ATOM
,PCSZ
,ULONG
){return 0;}
34 inline LONG APIENTRY
GpiPointArc(HPS
,PPOINTL
){return GPI_ERROR
;}
35 inline BOOL APIENTRY
WinDrawPointer(HPS
,LONG
,LONG
,HPOINTER
,ULONG
){return FALSE
;}
36 inline HPOINTER APIENTRY
WinCreatePointerIndirect(HWND
,PPOINTERINFO
){return NULLHANDLE
;}
37 inline BOOL APIENTRY
WinGetMaxPosition(HWND
,PSWP
){return FALSE
;}
38 inline BOOL APIENTRY
WinGetMinPosition(HWND
,PSWP
,PPOINTL
){return FALSE
;}
41 #if defined(__WATCOMC__) && defined(__WXMOTIF__)
46 // include this header from here for many of the GUI related code
49 #include <Xm/VendorSP.h>
53 // provide Unix-like pipe()
57 // Use ::DosCreatePipe or ::DosCreateNPipe under OS/2
58 // for more see http://posix2.sourceforge.net/guide.html
59 inline int pipe( int WXUNUSED(filedes
)[2] )
61 wxFAIL_MSG(wxT("Implement first"));
66 #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
68 typedef struct _SPBCDATA
{
69 ULONG cbSize
; /* Size of control block. */
70 ULONG ulTextLimit
; /* Entryfield text limit. */
71 LONG lLowerLimit
; /* Spin lower limit (numeric only). */
72 LONG lUpperLimit
; /* Spin upper limit (numeric only). */
73 ULONG idMasterSpb
; /* ID of the servant's master spinbutton. */
74 PVOID pHWXCtlData
; /* Handwriting control data structure flag. */
77 typedef SPBCDATA
*PSPBCDATA
;
81 #include "wx/dlimpexp.h"
82 #include "wx/fontenc.h"
84 class WXDLLIMPEXP_FWD_CORE wxFont
;
85 class WXDLLIMPEXP_FWD_CORE wxWindow
;
86 class WXDLLIMPEXP_FWD_BASE wxString
;
87 class WXDLLIMPEXP_FWD_CORE wxBitmap
;
89 // ---------------------------------------------------------------------------
91 // ---------------------------------------------------------------------------
94 // Constant strings for control names and classes
100 WXDLLIMPEXP_DATA_CORE(extern const char) wxButtonNameStr
[];
101 WXDLLIMPEXP_DATA_CORE(extern const char) wxCheckBoxNameStr
[];
102 WXDLLIMPEXP_DATA_CORE(extern const char) wxChoiceNameStr
[];
103 WXDLLIMPEXP_DATA_CORE(extern const char) wxComboBoxNameStr
[];
104 WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr
[];
105 WXDLLIMPEXP_DATA_CORE(extern const char) wxFrameNameStr
[];
106 WXDLLIMPEXP_DATA_CORE(extern const char) wxGaugeNameStr
[];
107 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBoxNameStr
[];
108 WXDLLIMPEXP_DATA_CORE(extern const char) wxListBoxNameStr
[];
109 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticLineNameStr
[];
110 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticTextNameStr
[];
111 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBitmapNameStr
[];
112 WXDLLIMPEXP_DATA_CORE(extern const char) wxPanelNameStr
[];
113 WXDLLIMPEXP_DATA_CORE(extern const char) wxRadioBoxNameStr
[];
114 WXDLLIMPEXP_DATA_CORE(extern const char) wxRadioButtonNameStr
[];
115 WXDLLIMPEXP_DATA_CORE(extern const char) wxBitmapRadioButtonNameStr
[];
116 WXDLLIMPEXP_DATA_CORE(extern const char) wxScrollBarNameStr
[];
117 WXDLLIMPEXP_DATA_CORE(extern const char) wxSliderNameStr
[];
118 WXDLLIMPEXP_DATA_CORE(extern const char) wxTextCtrlNameStr
[];
119 WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr
[];
120 WXDLLIMPEXP_DATA_CORE(extern const char) wxStatusLineNameStr
[];
121 WXDLLIMPEXP_DATA_CORE(extern const char) wxGetTextFromUserPromptStr
[];
122 WXDLLIMPEXP_DATA_CORE(extern const char) wxMessageBoxCaptionStr
[];
123 WXDLLIMPEXP_DATA_CORE(extern const char) wxFileSelectorPromptStr
[];
124 WXDLLIMPEXP_DATA_CORE(extern const char) wxFileSelectorDefaultWildcardStr
[];
125 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxInternalErrorStr
;
126 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxFatalErrorStr
;
127 WXDLLIMPEXP_DATA_CORE(extern const char) wxTreeCtrlNameStr
[];
128 WXDLLIMPEXP_DATA_CORE(extern const char) wxDirDialogNameStr
[];
129 WXDLLIMPEXP_DATA_CORE(extern const char) wxDirDialogDefaultFolderStr
[];
134 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxFrameClassName
;
135 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxFrameClassNameNoRedraw
;
136 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIFrameClassName
;
137 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIFrameClassNameNoRedraw
;
138 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIChildFrameClassName
;
139 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIChildFrameClassNameNoRedraw
;
140 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxPanelClassName
;
141 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxPanelClassNameNR
;
142 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxCanvasClassName
;
143 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxCanvasClassNameNR
;
145 // ---------------------------------------------------------------------------
146 // standard icons from the resources
147 // ---------------------------------------------------------------------------
151 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxSTD_FRAME_ICON
;
152 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxSTD_MDIPARENTFRAME_ICON
;
153 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxSTD_MDICHILDFRAME_ICON
;
154 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxDEFAULT_FRAME_ICON
;
155 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxDEFAULT_MDIPARENTFRAME_ICON
;
156 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxDEFAULT_MDICHILDFRAME_ICON
;
157 WXDLLIMPEXP_DATA_CORE(extern HFONT
) wxSTATUS_LINE_FONT
;
161 // ---------------------------------------------------------------------------
162 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
163 // window proc for PM.
164 // MPARAM is a void * but is really a 32-bit value
165 // ---------------------------------------------------------------------------
167 typedef MRESULT (APIENTRY
* WndProcCast
) (HWND
, ULONG
, MPARAM
, MPARAM
);
168 #define CASTWNDPROC (WndProcCast)
171 * Decide what window classes we're going to use
172 * for this combination of CTl3D/FAFA settings
175 #define STATIC_CLASS wxT("STATIC")
176 #define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
177 #define CHECK_CLASS wxT("BUTTON")
178 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
179 #define CHECK_IS_FAFA FALSE
180 #define RADIO_CLASS wxT("BUTTON" )
181 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
182 #define RADIO_SIZE 20
183 #define RADIO_IS_FAFA FALSE
185 /* PM has no group box button style
186 #define GROUP_CLASS "BUTTON"
187 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
191 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
192 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
195 // ---------------------------------------------------------------------------
197 // ---------------------------------------------------------------------------
199 #define MEANING_CHARACTER '0'
200 #define DEFAULT_ITEM_WIDTH 200
201 #define DEFAULT_ITEM_HEIGHT 80
203 // Scale font to get edit control height
204 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
208 // Generic subclass proc, for panel item moving/sizing and intercept
209 // EDIT control VK_RETURN messages
210 extern LONG APIENTRY
wxSubclassedGenericControlProc(WXHWND hWnd
, WXDWORD message
, WXWPARAM wParam
, WXLPARAM lParam
);
214 // ---------------------------------------------------------------------------
215 // constants which might miss from some compilers' headers
216 // ---------------------------------------------------------------------------
218 #if !defined(WS_EX_CLIENTEDGE)
219 #define WS_EX_CLIENTEDGE 0x00000200L
222 #ifndef ENDSESSION_LOGOFF
223 #define ENDSESSION_LOGOFF 0x80000000
226 #ifndef PMERR_INVALID_PARM
227 #define PMERR_INVALID_PARM 0x1303
230 #ifndef PMERR_INVALID_PARAMETERS
231 #define PMERR_INVALID_PARAMETERS 0x1208
234 #ifndef BOOKERR_INVALID_PARAMETERS
235 #define BOOKERR_INVALID_PARAMETERS -1
238 #ifndef DLGC_ENTRYFIELD
239 #define DLGC_ENTRYFIELD 0x0001
243 #define DLGC_BUTTON 0x0002
247 #define DLGC_MLE 0x0400
254 // ---------------------------------------------------------------------------
255 // debug messages -- OS/2 has no native debug output system
256 // ---------------------------------------------------------------------------
258 // ---------------------------------------------------------------------------
259 // macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
260 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
261 // an argument which should be a pointer or reference to the object of the
262 // corresponding class (this depends on the macro)
263 // ---------------------------------------------------------------------------
265 #define GetHwnd() ((HWND)GetHWND())
266 #define GetHwndOf(win) ((HWND)((win)->GetHWND()))
268 #define GetWinHwnd GetHwndOf
270 #define GetHdc() ((HDC)GetHDC())
271 #define GetHdcOf(dc) ((HDC)(dc).GetHDC())
273 #define GetHbitmap() ((HBITMAP)GetHBITMAP())
274 #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
276 #define GetHicon() ((HICON)GetHICON())
277 #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
279 #define GetHaccel() ((HACCEL)GetHACCEL())
280 #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
282 #define GetHmenu() ((HMENU)GetHMenu())
283 #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
285 #define GetHcursor() ((HCURSOR)GetHCURSOR())
286 #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
288 #define GetHfont() ((HFONT)GetHFONT())
289 #define GetHfontOf(font) ((HFONT)(font).GetHFONT())
291 // OS/2 convention of the mask is opposed to the wxWidgets one, so we need
292 // to invert the mask each time we pass one/get one to/from Windows
293 extern HBITMAP
wxInvertMask(HBITMAP hbmpMask
, int w
= 0, int h
= 0);
294 extern HBITMAP
wxCopyBmp(HBITMAP hbmp
, bool flip
=false, int w
=0, int h
=0);
296 // ---------------------------------------------------------------------------
298 // ---------------------------------------------------------------------------
301 // The MakeProcInstance version of the function wxSubclassedGenericControlProc
302 WXDLLIMPEXP_DATA_CORE(extern int) wxGenericControlSubClassProc
;
303 WXDLLIMPEXP_DATA_CORE(extern wxChar
*) wxBuffer
;
304 WXDLLIMPEXP_DATA_CORE(extern HINSTANCE
) wxhInstance
;
307 // ---------------------------------------------------------------------------
309 // ---------------------------------------------------------------------------
314 WXDLLIMPEXP_CORE HINSTANCE
wxGetInstance();
317 WXDLLIMPEXP_CORE
void wxSetInstance(HINSTANCE hInst
);
320 #include "wx/thread.h"
321 static inline MRESULT
MySendMsg(HWND hwnd
, ULONG ulMsgid
,
322 MPARAM mpParam1
, MPARAM mpParam2
)
325 vRes
= ::WinSendMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
327 if (!wxThread::IsMain())
328 ::WinPostMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
332 #define WinSendMsg MySendMsg
336 WXDLLIMPEXP_CORE
void wxDrawBorder( HPS hPS
341 WXDLLIMPEXP_CORE wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
343 WXDLLIMPEXP_CORE
void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
);
345 WXDLLIMPEXP_CORE
void wxConvertVectorFontSize( FIXED fxPointSize
348 WXDLLIMPEXP_CORE
void wxFillLogFont( LOGFONT
* pLogFont
349 ,PFACENAMEDESC pFaceName
356 WXDLLIMPEXP_CORE wxFontEncoding
wxGetFontEncFromCharSet(int nCharSet
);
357 WXDLLIMPEXP_CORE
void wxOS2SelectMatchingFontByName( PFATTRS vFattrs
358 ,PFACENAMEDESC pFaceName
363 WXDLLIMPEXP_CORE wxFont
wxCreateFontFromLogFont( LOGFONT
* pLogFont
367 WXDLLIMPEXP_CORE
int wxGpiStrcmp(wxChar
* s0
, wxChar
* s1
);
369 WXDLLIMPEXP_CORE
void wxSliderEvent(WXHWND control
, WXWORD wParam
, WXWORD pos
);
370 WXDLLIMPEXP_CORE
void wxScrollBarEvent(WXHWND hbar
, WXWORD wParam
, WXWORD pos
);
372 // Find maximum size of window/rectangle
373 WXDLLIMPEXP_CORE
extern void wxFindMaxSize(WXHWND hwnd
, RECT
*rect
);
375 WXDLLIMPEXP_CORE wxWindow
* wxFindControlFromHandle(WXHWND hWnd
);
376 WXDLLIMPEXP_CORE
void wxAddControlHandle(WXHWND hWnd
, wxWindow
*item
);
378 // Safely get the window text (i.e. without using fixed size buffer)
379 WXDLLIMPEXP_CORE
extern wxString
wxGetWindowText(WXHWND hWnd
);
381 // get the window class name
382 WXDLLIMPEXP_CORE
extern wxString
wxGetWindowClass(WXHWND hWnd
);
384 // get the window id (should be unsigned, hence this is not wxWindowID which
385 // is, for mainly historical reasons, signed)
386 WXDLLIMPEXP_CORE
extern WXWORD
wxGetWindowId(WXHWND hWnd
);
388 // Convert a PM Error code to a string
389 WXDLLIMPEXP_BASE
extern wxString
wxPMErrorToStr(ERRORID vError
);
391 // Does this window style specify any border?
392 inline bool wxStyleHasBorder(long style
)
394 return (style
& (wxSIMPLE_BORDER
| wxRAISED_BORDER
|
395 wxSUNKEN_BORDER
| wxDOUBLE_BORDER
)) != 0;
398 inline RECTL
wxGetWindowRect(HWND hWnd
)
402 ::WinQueryWindowRect(hWnd
, &vRect
);
404 } // end of wxGetWindowRect
406 WXDLLIMPEXP_CORE
extern void wxOS2SetFont( HWND hWnd
411 WXDLLIMPEXP_CORE
extern bool wxCheckWindowWndProc( WXHWND hWnd
414 WXDLLIMPEXP_CORE
extern wxBitmap
wxDisableBitmap( const wxBitmap
& rBmp
419 WXDLLIMPEXP_CORE
extern COLORREF
wxColourToRGB(const wxColour
& rColor
);
424 #endif // _WX_OS2_PRIVATE_H_