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
25 #if defined(__WATCOMC__) && defined(__WXMOTIF__)
30 // include this header from here for many of the GUI related code
33 #include <Xm/VendorSP.h>
37 // provide Unix-like pipe()
41 // Use ::DosCreatePipe or ::DosCreateNPipe under OS/2
42 // for more see http://posix2.sourceforge.net/guide.html
43 inline int pipe( int WXUNUSED(filedes
)[2] )
45 wxFAIL_MSG(wxT("Implement first"));
50 #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
52 typedef struct _SPBCDATA
{
53 ULONG cbSize
; /* Size of control block. */
54 ULONG ulTextLimit
; /* Entryfield text limit. */
55 LONG lLowerLimit
; /* Spin lower limit (numeric only). */
56 LONG lUpperLimit
; /* Spin upper limit (numeric only). */
57 ULONG idMasterSpb
; /* ID of the servant's master spinbutton. */
58 PVOID pHWXCtlData
; /* Handwriting control data structure flag. */
61 typedef SPBCDATA
*PSPBCDATA
;
65 #include "wx/dlimpexp.h"
66 #include "wx/fontenc.h"
68 class WXDLLEXPORT wxFont
;
69 class WXDLLEXPORT wxWindow
;
70 class WXDLLEXPORT wxString
;
71 class WXDLLEXPORT wxBitmap
;
73 // ---------------------------------------------------------------------------
75 // ---------------------------------------------------------------------------
78 // Constant strings for control names and classes
84 WXDLLEXPORT_DATA(extern const wxChar
*) wxButtonNameStr
;
85 WXDLLEXPORT_DATA(extern const wxChar
*) wxCanvasNameStr
;
86 WXDLLEXPORT_DATA(extern const wxChar
*) wxCheckBoxNameStr
;
87 WXDLLEXPORT_DATA(extern const wxChar
*) wxChoiceNameStr
;
88 WXDLLEXPORT_DATA(extern const wxChar
*) wxComboBoxNameStr
;
89 WXDLLEXPORT_DATA(extern const wxChar
*) wxDialogNameStr
;
90 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
91 WXDLLEXPORT_DATA(extern const wxChar
*) wxGaugeNameStr
;
92 WXDLLEXPORT_DATA(extern const wxChar
*) wxStaticBoxNameStr
;
93 WXDLLEXPORT_DATA(extern const wxChar
*) wxListBoxNameStr
;
94 WXDLLEXPORT_DATA(extern const wxChar
*) wxStaticTextNameStr
;
95 WXDLLEXPORT_DATA(extern const wxChar
*) wxStaticBitmapNameStr
;
96 WXDLLEXPORT_DATA(extern const wxChar
*) wxMultiTextNameStr
;
97 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelNameStr
;
98 WXDLLEXPORT_DATA(extern const wxChar
*) wxRadioBoxNameStr
;
99 WXDLLEXPORT_DATA(extern const wxChar
*) wxRadioButtonNameStr
;
100 WXDLLEXPORT_DATA(extern const wxChar
*) wxBitmapRadioButtonNameStr
;
101 WXDLLEXPORT_DATA(extern const wxChar
*) wxScrollBarNameStr
;
102 WXDLLEXPORT_DATA(extern const wxChar
*) wxSliderNameStr
;
103 WXDLLEXPORT_DATA(extern const wxChar
*) wxStaticNameStr
;
104 WXDLLEXPORT_DATA(extern const wxChar
*) wxTextCtrlWindowNameStr
;
105 WXDLLEXPORT_DATA(extern const wxChar
*) wxTextCtrlNameStr
;
106 WXDLLEXPORT_DATA(extern const wxChar
*) wxVirtListBoxNameStr
;
107 WXDLLEXPORT_DATA(extern const wxChar
*) wxButtonBarNameStr
;
108 WXDLLEXPORT_DATA(extern const wxChar
*) wxEnhDialogNameStr
;
109 WXDLLEXPORT_DATA(extern const wxChar
*) wxToolBarNameStr
;
110 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
111 WXDLLEXPORT_DATA(extern const wxChar
*) wxGetTextFromUserPromptStr
;
112 WXDLLEXPORT_DATA(extern const wxChar
*) wxMessageBoxCaptionStr
;
113 WXDLLEXPORT_DATA(extern const wxChar
*) wxFileSelectorPromptStr
;
114 WXDLLEXPORT_DATA(extern const wxChar
*) wxFileSelectorDefaultWildcardStr
;
115 WXDLLEXPORT_DATA(extern const wxChar
*) wxInternalErrorStr
;
116 WXDLLEXPORT_DATA(extern const wxChar
*) wxFatalErrorStr
;
117 WXDLLEXPORT_DATA(extern const wxChar
*) wxTreeCtrlNameStr
;
118 WXDLLEXPORT_DATA(extern const wxChar
*) wxDirDialogNameStr
;
119 WXDLLEXPORT_DATA(extern const wxChar
*) wxDirDialogDefaultFolderStr
;
124 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameClassName
;
125 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameClassNameNoRedraw
;
126 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIFrameClassName
;
127 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIFrameClassNameNoRedraw
;
128 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIChildFrameClassName
;
129 WXDLLEXPORT_DATA(extern const wxChar
*) wxMDIChildFrameClassNameNoRedraw
;
130 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelClassName
;
131 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelClassNameNR
;
132 WXDLLEXPORT_DATA(extern const wxChar
*) wxCanvasClassName
;
133 WXDLLEXPORT_DATA(extern const wxChar
*) wxCanvasClassNameNR
;
135 // ---------------------------------------------------------------------------
136 // standard icons from the resources
137 // ---------------------------------------------------------------------------
141 WXDLLEXPORT_DATA(extern HICON
) wxSTD_FRAME_ICON
;
142 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDIPARENTFRAME_ICON
;
143 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDICHILDFRAME_ICON
;
144 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_FRAME_ICON
;
145 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDIPARENTFRAME_ICON
;
146 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDICHILDFRAME_ICON
;
147 WXDLLEXPORT_DATA(extern HFONT
) wxSTATUS_LINE_FONT
;
151 // ---------------------------------------------------------------------------
152 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
153 // window proc for PM.
154 // MPARAM is a void * but is really a 32-bit value
155 // ---------------------------------------------------------------------------
157 typedef MRESULT (APIENTRY
* WndProcCast
) (HWND
, ULONG
, MPARAM
, MPARAM
);
158 #define CASTWNDPROC (WndProcCast)
161 * Decide what window classes we're going to use
162 * for this combination of CTl3D/FAFA settings
165 #define STATIC_CLASS _T("STATIC")
166 #define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
167 #define CHECK_CLASS _T("BUTTON")
168 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
169 #define CHECK_IS_FAFA FALSE
170 #define RADIO_CLASS _T("BUTTON" )
171 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
172 #define RADIO_SIZE 20
173 #define RADIO_IS_FAFA FALSE
175 /* PM has no group box button style
176 #define GROUP_CLASS "BUTTON"
177 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
181 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
182 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
185 // ---------------------------------------------------------------------------
187 // ---------------------------------------------------------------------------
189 #define MEANING_CHARACTER '0'
190 #define DEFAULT_ITEM_WIDTH 200
191 #define DEFAULT_ITEM_HEIGHT 80
193 // Scale font to get edit control height
194 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
198 // Generic subclass proc, for panel item moving/sizing and intercept
199 // EDIT control VK_RETURN messages
200 extern LONG APIENTRY
wxSubclassedGenericControlProc(WXHWND hWnd
, WXDWORD message
, WXWPARAM wParam
, WXLPARAM lParam
);
204 // ---------------------------------------------------------------------------
205 // constants which might miss from some compilers' headers
206 // ---------------------------------------------------------------------------
208 #if !defined(WS_EX_CLIENTEDGE)
209 #define WS_EX_CLIENTEDGE 0x00000200L
212 #ifndef ENDSESSION_LOGOFF
213 #define ENDSESSION_LOGOFF 0x80000000
216 #ifndef PMERR_INVALID_PARM
217 #define PMERR_INVALID_PARM 0x1303
220 #ifndef PMERR_INVALID_PARAMETERS
221 #define PMERR_INVALID_PARAMETERS 0x1208
224 #ifndef BOOKERR_INVALID_PARAMETERS
225 #define BOOKERR_INVALID_PARAMETERS -1
228 #ifndef DLGC_ENTRYFIELD
229 #define DLGC_ENTRYFIELD 0x0001
233 #define DLGC_BUTTON 0x0002
237 #define DLGC_MLE 0x0400
244 // ---------------------------------------------------------------------------
245 // debug messages -- OS/2 has no native debug output system
246 // ---------------------------------------------------------------------------
248 // ---------------------------------------------------------------------------
249 // macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
250 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
251 // an argument which should be a pointer or reference to the object of the
252 // corresponding class (this depends on the macro)
253 // ---------------------------------------------------------------------------
255 #define GetHwnd() ((HWND)GetHWND())
256 #define GetHwndOf(win) ((HWND)((win)->GetHWND()))
258 #define GetWinHwnd GetHwndOf
260 #define GetHdc() ((HDC)GetHDC())
261 #define GetHdcOf(dc) ((HDC)(dc).GetHDC())
263 #define GetHbitmap() ((HBITMAP)GetHBITMAP())
264 #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
266 #define GetHicon() ((HICON)GetHICON())
267 #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
269 #define GetHaccel() ((HACCEL)GetHACCEL())
270 #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
272 #define GetHmenu() ((HMENU)GetHMenu())
273 #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
275 #define GetHcursor() ((HCURSOR)GetHCURSOR())
276 #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
278 #define GetHfont() ((HFONT)GetHFONT())
279 #define GetHfontOf(font) ((HFONT)(font).GetHFONT())
281 // OS/2 convention of the mask is opposed to the wxWidgets one, so we need
282 // to invert the mask each time we pass one/get one to/from Windows
283 extern HBITMAP
wxInvertMask(HBITMAP hbmpMask
, int w
= 0, int h
= 0);
285 // ---------------------------------------------------------------------------
287 // ---------------------------------------------------------------------------
290 // The MakeProcInstance version of the function wxSubclassedGenericControlProc
291 WXDLLEXPORT_DATA(extern int) wxGenericControlSubClassProc
;
292 WXDLLEXPORT_DATA(extern wxChar
*) wxBuffer
;
293 WXDLLEXPORT_DATA(extern HINSTANCE
) wxhInstance
;
296 // ---------------------------------------------------------------------------
298 // ---------------------------------------------------------------------------
303 WXDLLEXPORT HINSTANCE
wxGetInstance();
306 WXDLLEXPORT
void wxSetInstance(HINSTANCE hInst
);
309 #include "wx/thread.h"
310 static inline MRESULT
MySendMsg(HWND hwnd
, ULONG ulMsgid
,
311 MPARAM mpParam1
, MPARAM mpParam2
)
314 vRes
= ::WinSendMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
316 if (!wxThread::IsMain())
317 ::WinPostMsg(hwnd
, ulMsgid
, mpParam1
, mpParam2
);
321 #define WinSendMsg MySendMsg
325 WXDLLEXPORT
void wxDrawBorder( HPS hPS
330 WXDLLEXPORT wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
332 WXDLLEXPORT
void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
);
334 WXDLLEXPORT
void wxConvertVectorFontSize( FIXED fxPointSize
337 WXDLLEXPORT
void wxFillLogFont( LOGFONT
* pLogFont
338 ,PFACENAMEDESC pFaceName
345 WXDLLEXPORT wxFontEncoding
wxGetFontEncFromCharSet(int nCharSet
);
346 WXDLLEXPORT
void wxOS2SelectMatchingFontByName( PFATTRS vFattrs
347 ,PFACENAMEDESC pFaceName
352 WXDLLEXPORT wxFont
wxCreateFontFromLogFont( LOGFONT
* pLogFont
356 WXDLLEXPORT
int wxGpiStrcmp(wxChar
* s0
, wxChar
* s1
);
358 WXDLLEXPORT
void wxSliderEvent(WXHWND control
, WXWORD wParam
, WXWORD pos
);
359 WXDLLEXPORT
void wxScrollBarEvent(WXHWND hbar
, WXWORD wParam
, WXWORD pos
);
361 // Find maximum size of window/rectangle
362 WXDLLEXPORT
extern void wxFindMaxSize(WXHWND hwnd
, RECT
*rect
);
364 WXDLLEXPORT wxWindow
* wxFindControlFromHandle(WXHWND hWnd
);
365 WXDLLEXPORT
void wxAddControlHandle(WXHWND hWnd
, wxWindow
*item
);
367 // Safely get the window text (i.e. without using fixed size buffer)
368 WXDLLEXPORT
extern wxString
wxGetWindowText(WXHWND hWnd
);
370 // get the window class name
371 WXDLLEXPORT
extern wxString
wxGetWindowClass(WXHWND hWnd
);
373 // get the window id (should be unsigned, hence this is not wxWindowID which
374 // is, for mainly historical reasons, signed)
375 WXDLLEXPORT
extern WXWORD
wxGetWindowId(WXHWND hWnd
);
377 // Convert a PM Error code to a string
378 WXDLLEXPORT
extern wxString
wxPMErrorToStr(ERRORID vError
);
380 // Does this window style specify any border?
381 inline bool wxStyleHasBorder(long style
)
383 return (style
& (wxSIMPLE_BORDER
| wxRAISED_BORDER
|
384 wxSUNKEN_BORDER
| wxDOUBLE_BORDER
)) != 0;
387 inline RECTL
wxGetWindowRect(HWND hWnd
)
391 ::WinQueryWindowRect(hWnd
, &vRect
);
393 } // end of wxGetWindowRect
395 WXDLLEXPORT
extern void wxOS2SetFont( HWND hWnd
400 WXDLLEXPORT
extern bool wxCheckWindowWndProc( WXHWND hWnd
403 WXDLLEXPORT
extern wxBitmap
wxDisableBitmap( const wxBitmap
& rBmp
407 #include "wx/colour.h"
409 WXDLLEXPORT
extern COLORREF
wxColourToRGB(const wxColour
& rColor
);
413 #endif // _WX_PRIVATE_H_