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
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_OS2_PRIVATE_H_
14 #define _WX_OS2_PRIVATE_H_
20 #define INCL_GPIERRORS
22 #define INCL_DOSPROCESS
23 #define INCL_DOSERRORS
26 #define INCL_SHLERRORS
30 #if wxONLY_WATCOM_EARLIER_THAN(1,4)
31 inline HATOMTBL APIENTRY
WinQuerySystemAtomTable(VOID
){return NULL
;}
32 inline ULONG APIENTRY
WinQueryAtomName(HATOMTBL
,ATOM
,PCSZ
,ULONG
){return 0;}
33 inline LONG APIENTRY
GpiPointArc(HPS
,PPOINTL
){return GPI_ERROR
;}
34 inline BOOL APIENTRY
WinDrawPointer(HPS
,LONG
,LONG
,HPOINTER
,ULONG
){return FALSE
;}
35 inline HPOINTER APIENTRY
WinCreatePointerIndirect(HWND
,PPOINTERINFO
){return NULLHANDLE
;}
36 inline BOOL APIENTRY
WinGetMaxPosition(HWND
,PSWP
){return FALSE
;}
37 inline BOOL APIENTRY
WinGetMinPosition(HWND
,PSWP
,PPOINTL
){return FALSE
;}
40 #if defined(__WATCOMC__) && defined(__WXMOTIF__)
45 // include this header from here for many of the GUI related code
48 #include <Xm/VendorSP.h>
52 // provide Unix-like pipe()
56 // Use ::DosCreatePipe or ::DosCreateNPipe under OS/2
57 // for more see http://posix2.sourceforge.net/guide.html
58 inline int pipe( int WXUNUSED(filedes
)[2] )
60 wxFAIL_MSG(wxT("Implement first"));
65 #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
67 typedef struct _SPBCDATA
{
68 ULONG cbSize
; /* Size of control block. */
69 ULONG ulTextLimit
; /* Entryfield text limit. */
70 LONG lLowerLimit
; /* Spin lower limit (numeric only). */
71 LONG lUpperLimit
; /* Spin upper limit (numeric only). */
72 ULONG idMasterSpb
; /* ID of the servant's master spinbutton. */
73 PVOID pHWXCtlData
; /* Handwriting control data structure flag. */
76 typedef SPBCDATA
*PSPBCDATA
;
80 #include "wx/dlimpexp.h"
81 #include "wx/fontenc.h"
83 class WXDLLIMPEXP_FWD_CORE wxFont
;
84 class WXDLLIMPEXP_FWD_CORE wxWindow
;
85 class WXDLLIMPEXP_FWD_BASE wxString
;
86 class WXDLLIMPEXP_FWD_CORE wxBitmap
;
88 // ---------------------------------------------------------------------------
90 // ---------------------------------------------------------------------------
93 // Constant strings for control names and classes
99 WXDLLIMPEXP_DATA_CORE(extern const char) wxButtonNameStr
[];
100 WXDLLIMPEXP_DATA_CORE(extern const char) wxCheckBoxNameStr
[];
101 WXDLLIMPEXP_DATA_CORE(extern const char) wxChoiceNameStr
[];
102 WXDLLIMPEXP_DATA_CORE(extern const char) wxComboBoxNameStr
[];
103 WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr
[];
104 WXDLLIMPEXP_DATA_CORE(extern const char) wxFrameNameStr
[];
105 WXDLLIMPEXP_DATA_CORE(extern const char) wxGaugeNameStr
[];
106 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBoxNameStr
[];
107 WXDLLIMPEXP_DATA_CORE(extern const char) wxListBoxNameStr
[];
108 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticLineNameStr
[];
109 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticTextNameStr
[];
110 WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBitmapNameStr
[];
111 WXDLLIMPEXP_DATA_CORE(extern const char) wxPanelNameStr
[];
112 WXDLLIMPEXP_DATA_CORE(extern const char) wxRadioBoxNameStr
[];
113 WXDLLIMPEXP_DATA_CORE(extern const char) wxRadioButtonNameStr
[];
114 WXDLLIMPEXP_DATA_CORE(extern const char) wxBitmapRadioButtonNameStr
[];
115 WXDLLIMPEXP_DATA_CORE(extern const char) wxScrollBarNameStr
[];
116 WXDLLIMPEXP_DATA_CORE(extern const char) wxSliderNameStr
[];
117 WXDLLIMPEXP_DATA_CORE(extern const char) wxTextCtrlNameStr
[];
118 WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr
[];
119 WXDLLIMPEXP_DATA_CORE(extern const char) wxStatusLineNameStr
[];
120 WXDLLIMPEXP_DATA_CORE(extern const char) wxGetTextFromUserPromptStr
[];
121 WXDLLIMPEXP_DATA_CORE(extern const char) wxMessageBoxCaptionStr
[];
122 WXDLLIMPEXP_DATA_CORE(extern const char) wxFileSelectorPromptStr
[];
123 WXDLLIMPEXP_DATA_CORE(extern const char) wxFileSelectorDefaultWildcardStr
[];
124 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxInternalErrorStr
;
125 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxFatalErrorStr
;
126 WXDLLIMPEXP_DATA_CORE(extern const char) wxTreeCtrlNameStr
[];
127 WXDLLIMPEXP_DATA_CORE(extern const char) wxDirDialogNameStr
[];
128 WXDLLIMPEXP_DATA_CORE(extern const char) wxDirDialogDefaultFolderStr
[];
133 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxFrameClassName
;
134 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxFrameClassNameNoRedraw
;
135 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIFrameClassName
;
136 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIFrameClassNameNoRedraw
;
137 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIChildFrameClassName
;
138 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxMDIChildFrameClassNameNoRedraw
;
139 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxPanelClassName
;
140 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxPanelClassNameNR
;
141 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxCanvasClassName
;
142 WXDLLIMPEXP_DATA_CORE(extern const wxChar
*) wxCanvasClassNameNR
;
144 // ---------------------------------------------------------------------------
145 // standard icons from the resources
146 // ---------------------------------------------------------------------------
150 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxSTD_FRAME_ICON
;
151 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxSTD_MDIPARENTFRAME_ICON
;
152 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxSTD_MDICHILDFRAME_ICON
;
153 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxDEFAULT_FRAME_ICON
;
154 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxDEFAULT_MDIPARENTFRAME_ICON
;
155 WXDLLIMPEXP_DATA_CORE(extern HICON
) wxDEFAULT_MDICHILDFRAME_ICON
;
156 WXDLLIMPEXP_DATA_CORE(extern HFONT
) wxSTATUS_LINE_FONT
;
160 // ---------------------------------------------------------------------------
161 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
162 // window proc for PM.
163 // MPARAM is a void * but is really a 32-bit value
164 // ---------------------------------------------------------------------------
166 typedef MRESULT (APIENTRY
* WndProcCast
) (HWND
, ULONG
, MPARAM
, MPARAM
);
167 #define CASTWNDPROC (WndProcCast)
170 * Decide what window classes we're going to use
171 * for this combination of CTl3D/FAFA settings
174 #define STATIC_CLASS wxT("STATIC")
175 #define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
176 #define CHECK_CLASS wxT("BUTTON")
177 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
178 #define CHECK_IS_FAFA FALSE
179 #define RADIO_CLASS wxT("BUTTON" )
180 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
181 #define RADIO_SIZE 20
182 #define RADIO_IS_FAFA FALSE
184 /* PM has no group box button style
185 #define GROUP_CLASS "BUTTON"
186 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
190 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
191 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
194 // ---------------------------------------------------------------------------
196 // ---------------------------------------------------------------------------
198 #define MEANING_CHARACTER '0'
199 #define DEFAULT_ITEM_WIDTH 200
200 #define DEFAULT_ITEM_HEIGHT 80
202 // Scale font to get edit control height
203 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
207 // Generic subclass proc, for panel item moving/sizing and intercept
208 // EDIT control VK_RETURN messages
209 extern LONG APIENTRY
wxSubclassedGenericControlProc(WXHWND hWnd
, WXDWORD message
, WXWPARAM wParam
, WXLPARAM lParam
);
213 // ---------------------------------------------------------------------------
214 // constants which might miss from some compilers' headers
215 // ---------------------------------------------------------------------------
217 #if !defined(WS_EX_CLIENTEDGE)
218 #define WS_EX_CLIENTEDGE 0x00000200L
221 #ifndef ENDSESSION_LOGOFF
222 #define ENDSESSION_LOGOFF 0x80000000
225 #ifndef PMERR_INVALID_PARM
226 #define PMERR_INVALID_PARM 0x1303
229 #ifndef PMERR_INVALID_PARAMETERS
230 #define PMERR_INVALID_PARAMETERS 0x1208
233 #ifndef BOOKERR_INVALID_PARAMETERS
234 #define BOOKERR_INVALID_PARAMETERS -1
237 #ifndef DLGC_ENTRYFIELD
238 #define DLGC_ENTRYFIELD 0x0001
242 #define DLGC_BUTTON 0x0002
246 #define DLGC_MLE 0x0400
253 // ---------------------------------------------------------------------------
254 // debug messages -- OS/2 has no native debug output system
255 // ---------------------------------------------------------------------------
257 // ---------------------------------------------------------------------------
258 // macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
259 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
260 // an argument which should be a pointer or reference to the object of the
261 // corresponding class (this depends on the macro)
262 // ---------------------------------------------------------------------------
264 #define GetHwnd() ((HWND)GetHWND())
265 #define GetHwndOf(win) ((HWND)((win)->GetHWND()))
267 #define GetWinHwnd GetHwndOf
269 #define GetHdc() ((HDC)GetHDC())
270 #define GetHdcOf(dc) ((HDC)(dc).GetHDC())
272 #define GetHbitmap() ((HBITMAP)GetHBITMAP())
273 #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
275 #define GetHicon() ((HICON)GetHICON())
276 #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
278 #define GetHaccel() ((HACCEL)GetHACCEL())
279 #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
281 #define GetHmenu() ((HMENU)GetHMenu())
282 #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
284 #define GetHcursor() ((HCURSOR)GetHCURSOR())
285 #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
287 #define GetHfont() ((HFONT)GetHFONT())
288 #define GetHfontOf(font) ((HFONT)(font).GetHFONT())
290 // OS/2 convention of the mask is opposed to the wxWidgets one, so we need
291 // to invert the mask each time we pass one/get one to/from Windows
292 extern HBITMAP
wxInvertMask(HBITMAP hbmpMask
, int w
= 0, int h
= 0);
293 extern HBITMAP
wxCopyBmp(HBITMAP hbmp
, bool flip
=false, int w
=0, int h
=0);
295 // ---------------------------------------------------------------------------
297 // ---------------------------------------------------------------------------
300 // The MakeProcInstance version of the function wxSubclassedGenericControlProc
301 WXDLLIMPEXP_DATA_CORE(extern int) wxGenericControlSubClassProc
;
302 WXDLLIMPEXP_DATA_CORE(extern wxChar
*) wxBuffer
;
303 WXDLLIMPEXP_DATA_CORE(extern HINSTANCE
) wxhInstance
;
306 // ---------------------------------------------------------------------------
308 // ---------------------------------------------------------------------------
313 WXDLLIMPEXP_CORE HINSTANCE
wxGetInstance();
316 WXDLLIMPEXP_CORE
void wxSetInstance(HINSTANCE hInst
);
319 #include "wx/thread.h"
320 static inline MRESULT
MySendMsg(HWND hwnd
, ULONG ulMsgid
,
321 MPARAM mpParam1
, MPARAM mpParam2
)
324 vRes
= ::WinSendMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
326 if (!wxThread::IsMain())
327 ::WinPostMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
331 #define WinSendMsg MySendMsg
335 WXDLLIMPEXP_CORE
void wxDrawBorder( HPS hPS
340 WXDLLIMPEXP_CORE wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
342 WXDLLIMPEXP_CORE
void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
);
344 WXDLLIMPEXP_CORE
void wxConvertVectorFontSize( FIXED fxPointSize
347 WXDLLIMPEXP_CORE
void wxFillLogFont( LOGFONT
* pLogFont
348 ,PFACENAMEDESC pFaceName
355 WXDLLIMPEXP_CORE wxFontEncoding
wxGetFontEncFromCharSet(int nCharSet
);
356 WXDLLIMPEXP_CORE
void wxOS2SelectMatchingFontByName( PFATTRS vFattrs
357 ,PFACENAMEDESC pFaceName
362 WXDLLIMPEXP_CORE wxFont
wxCreateFontFromLogFont( LOGFONT
* pLogFont
366 WXDLLIMPEXP_CORE
int wxGpiStrcmp(wxChar
* s0
, wxChar
* s1
);
368 WXDLLIMPEXP_CORE
void wxSliderEvent(WXHWND control
, WXWORD wParam
, WXWORD pos
);
369 WXDLLIMPEXP_CORE
void wxScrollBarEvent(WXHWND hbar
, WXWORD wParam
, WXWORD pos
);
371 // Find maximum size of window/rectangle
372 WXDLLIMPEXP_CORE
extern void wxFindMaxSize(WXHWND hwnd
, RECT
*rect
);
374 WXDLLIMPEXP_CORE wxWindow
* wxFindControlFromHandle(WXHWND hWnd
);
375 WXDLLIMPEXP_CORE
void wxAddControlHandle(WXHWND hWnd
, wxWindow
*item
);
377 // Safely get the window text (i.e. without using fixed size buffer)
378 WXDLLIMPEXP_CORE
extern wxString
wxGetWindowText(WXHWND hWnd
);
380 // get the window class name
381 WXDLLIMPEXP_CORE
extern wxString
wxGetWindowClass(WXHWND hWnd
);
383 // get the window id (should be unsigned, hence this is not wxWindowID which
384 // is, for mainly historical reasons, signed)
385 WXDLLIMPEXP_CORE
extern WXWORD
wxGetWindowId(WXHWND hWnd
);
387 // Convert a PM Error code to a string
388 WXDLLIMPEXP_BASE
extern wxString
wxPMErrorToStr(ERRORID vError
);
390 // Does this window style specify any border?
391 inline bool wxStyleHasBorder(long style
)
393 return (style
& (wxSIMPLE_BORDER
| wxRAISED_BORDER
|
394 wxSUNKEN_BORDER
| wxDOUBLE_BORDER
)) != 0;
397 inline RECTL
wxGetWindowRect(HWND hWnd
)
401 ::WinQueryWindowRect(hWnd
, &vRect
);
403 } // end of wxGetWindowRect
405 WXDLLIMPEXP_CORE
extern void wxOS2SetFont( HWND hWnd
410 WXDLLIMPEXP_CORE
extern bool wxCheckWindowWndProc( WXHWND hWnd
413 WXDLLIMPEXP_CORE
extern wxBitmap
wxDisableBitmap( const wxBitmap
& rBmp
418 WXDLLIMPEXP_CORE
extern COLORREF
wxColourToRGB(const wxColour
& rColor
);
423 #endif // _WX_OS2_PRIVATE_H_