1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private declarations: as this header is only included by
4 // wxWindows 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_PRIVATE_H_
15 #define _WX_PRIVATE_H_
19 // undefine conflicting symbols which were defined in windows.h
20 #include "wx/msw/winundef.h"
22 class WXDLLEXPORT wxFont
;
23 class WXDLLEXPORT wxWindow
;
25 // ---------------------------------------------------------------------------
27 // ---------------------------------------------------------------------------
30 static const double METRIC_CONVERSION_CONSTANT
= 0.0393700787;
32 // Scaling factors for various unit conversions
33 static const double mm2inches
= (METRIC_CONVERSION_CONSTANT
);
34 static const double inches2mm
= (1/METRIC_CONVERSION_CONSTANT
);
36 static const double mm2twips
= (METRIC_CONVERSION_CONSTANT
*1440);
37 static const double twips2mm
= (1/(METRIC_CONVERSION_CONSTANT
*1440));
39 static const double mm2pt
= (METRIC_CONVERSION_CONSTANT
*72);
40 static const double pt2mm
= (1/(METRIC_CONVERSION_CONSTANT
*72));
42 // ---------------------------------------------------------------------------
43 // standard icons from the resources
44 // ---------------------------------------------------------------------------
46 WXDLLEXPORT_DATA(extern HICON
) wxSTD_FRAME_ICON
;
47 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDIPARENTFRAME_ICON
;
48 WXDLLEXPORT_DATA(extern HICON
) wxSTD_MDICHILDFRAME_ICON
;
49 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_FRAME_ICON
;
50 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDIPARENTFRAME_ICON
;
51 WXDLLEXPORT_DATA(extern HICON
) wxDEFAULT_MDICHILDFRAME_ICON
;
52 WXDLLEXPORT_DATA(extern HFONT
) wxSTATUS_LINE_FONT
;
54 // ---------------------------------------------------------------------------
55 // define things missing from some compilers' headers
56 // ---------------------------------------------------------------------------
58 #if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS)
59 inline void ZeroMemory(void *buf
, size_t len
) { memset(buf
, 0, len
); }
62 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
64 #if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS)
65 # define CASTWNDPROC (long unsigned)
72 typedef int (pascal * WndProcCast
) ();
73 # define CASTWNDPROC (WndProcCast)
77 # if defined (__WIN32__) && defined(STRICT)
78 typedef long (_stdcall
* WndProcCast
) (HWND
, unsigned int, unsigned int, long);
79 # define CASTWNDPROC (WndProcCast)
80 # elif defined(__WIN16__)
82 typedef int (pascal * WndProcCast
) ();
83 # define CASTWNDPROC (WndProcCast)
85 # if defined(__VISUALC__) && defined(STRICT)
86 # define CASTWNDPROC (WNDPROC)
88 typedef int (PASCAL
* WndProcCast
) ();
89 # define CASTWNDPROC (WndProcCast)
98 // ---------------------------------------------------------------------------
99 // some stuff for old Windows versions (FIXME: what does it do here??)
100 // ---------------------------------------------------------------------------
102 #if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
103 #define APIENTRY FAR PASCAL
109 #define _EXPORT _export
113 typedef signed short int SHORT
;
116 #if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
118 #define DLGPROC FARPROC
123 WXDLLEXPORT
void wxRegisterPenWin();
124 WXDLLEXPORT
void wxCleanUpPenWin();
125 WXDLLEXPORT
void wxEnablePenAppHooks (bool hook
);
126 #endif // wxUSE_PENWIN
129 #define IBS_HORZCAPTION 0x4000L
130 #define IBS_VERTCAPTION 0x8000L
132 UINT WINAPI
ibGetCaptionSize( HWND hWnd
) ;
133 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
) ;
134 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
) ;
135 VOID WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
) ;
136 #endif // wxUSE_ITSY_BITSY
139 #include "wx/msw/ctl3d/ctl3d.h"
140 #endif // wxUSE_CTL3D
143 * Decide what window classes we're going to use
144 * for this combination of CTl3D/FAFA settings
147 #define STATIC_CLASS wxT("STATIC")
148 #define STATIC_FLAGS (SS_LEFT|WS_CHILD|WS_VISIBLE)
149 #define CHECK_CLASS wxT("BUTTON")
150 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP|WS_CHILD)
151 #define CHECK_IS_FAFA FALSE
152 #define RADIO_CLASS wxT("BUTTON")
153 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_CHILD|WS_VISIBLE)
154 #define RADIO_SIZE 20
155 #define RADIO_IS_FAFA FALSE
157 #define GROUP_CLASS wxT("BUTTON")
158 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
161 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
162 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
165 // ---------------------------------------------------------------------------
167 // ---------------------------------------------------------------------------
169 #define MEANING_CHARACTER '0'
170 #define DEFAULT_ITEM_WIDTH 200
171 #define DEFAULT_ITEM_HEIGHT 80
173 // Scale font to get edit control height
174 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
176 // Generic subclass proc, for panel item moving/sizing and intercept
177 // EDIT control VK_RETURN messages
178 extern LONG APIENTRY _EXPORT
179 wxSubclassedGenericControlProc(WXHWND hWnd
, WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
181 // ---------------------------------------------------------------------------
182 // constants which might miss from some compilers' headers
183 // ---------------------------------------------------------------------------
185 #if !defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
186 #define WS_EX_CLIENTEDGE 0
189 #if defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
190 #define WS_EX_CLIENTEDGE 0x00000200L
193 #ifndef ENDSESSION_LOGOFF
194 #define ENDSESSION_LOGOFF 0x80000000
197 // ---------------------------------------------------------------------------
199 // ---------------------------------------------------------------------------
200 #if defined(__WIN95__) && defined(__WXDEBUG__) && wxUSE_DBWIN32
203 #ifdef OutputDebugString
204 #undef OutputDebugString
207 #define OutputDebugString OutputDebugStringW95
210 extern void OutputDebugStringW95(const wxChar
*, ...);
211 #endif // USE_DBWIN32
213 // ---------------------------------------------------------------------------
214 // useful macros and functions
215 // ---------------------------------------------------------------------------
217 // a wrapper macro for ZeroMemory()
218 #define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj))
220 // make conversion from wxColour and COLORREF a bit less painful
221 inline COLORREF
wxColourToRGB(const wxColour
& c
)
223 return RGB(c
.Red(), c
.Green(), c
.Blue());
226 inline void wxRGBToColour(wxColour
& c
, COLORREF rgb
)
228 c
.Set(GetRValue(rgb
), GetGValue(rgb
), GetBValue(rgb
));
231 // ---------------------------------------------------------------------------
232 // macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
233 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
234 // an argument which should be a pointer or reference to the object of the
235 // corresponding class (this depends on the macro)
236 // ---------------------------------------------------------------------------
238 #define GetHwnd() ((HWND)GetHWND())
239 #define GetHwndOf(win) ((HWND)((win)->GetHWND()))
241 #define GetWinHwnd GetHwndOf
243 #define GetHdc() ((HDC)GetHDC())
244 #define GetHdcOf(dc) ((HDC)(dc).GetHDC())
246 #define GetHbitmap() ((HBITMAP)GetHBITMAP())
247 #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
249 #define GetHicon() ((HICON)GetHICON())
250 #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
252 #define GetHaccel() ((HACCEL)GetHACCEL())
253 #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
255 #define GetHmenu() ((HMENU)GetHMenu())
256 #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
258 // ---------------------------------------------------------------------------
260 // ---------------------------------------------------------------------------
262 // The MakeProcInstance version of the function wxSubclassedGenericControlProc
263 WXDLLEXPORT_DATA(extern FARPROC
) wxGenericControlSubClassProc
;
264 WXDLLEXPORT_DATA(extern wxChar
*) wxBuffer
;
265 WXDLLEXPORT_DATA(extern HINSTANCE
) wxhInstance
;
267 // ---------------------------------------------------------------------------
269 // ---------------------------------------------------------------------------
273 WXDLLEXPORT HINSTANCE
wxGetInstance();
276 WXDLLEXPORT
void wxSetInstance(HINSTANCE hInst
);
278 WXDLLEXPORT wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
280 WXDLLEXPORT
void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
);
281 WXDLLEXPORT
void wxFillLogFont(LOGFONT
*logFont
, const wxFont
*font
);
282 WXDLLEXPORT wxFont
wxCreateFontFromLogFont(const LOGFONT
*logFont
);
284 WXDLLEXPORT
void wxSliderEvent(WXHWND control
, WXWORD wParam
, WXWORD pos
);
285 WXDLLEXPORT
void wxScrollBarEvent(WXHWND hbar
, WXWORD wParam
, WXWORD pos
);
287 // Find maximum size of window/rectangle
288 WXDLLEXPORT
extern void wxFindMaxSize(WXHWND hwnd
, RECT
*rect
);
290 WXDLLEXPORT wxWindow
* wxFindControlFromHandle(WXHWND hWnd
);
291 WXDLLEXPORT
void wxAddControlHandle(WXHWND hWnd
, wxWindow
*item
);
293 // Safely get the window text (i.e. without using fixed size buffer)
294 WXDLLEXPORT
extern wxString
wxGetWindowText(WXHWND hWnd
);
296 // get the window class name
297 WXDLLEXPORT
extern wxString
wxGetWindowClass(WXHWND hWnd
);
299 // get the window id (should be unsigned, hence this is not wxWindowID which
300 // is, for mainly historical reasons, signed)
301 WXDLLEXPORT
extern WXWORD
wxGetWindowId(WXHWND hWnd
);
303 // Does this window style specify any border?
304 inline bool wxStyleHasBorder(long style
)
306 return (style
& (wxSIMPLE_BORDER
| wxRAISED_BORDER
|
307 wxSUNKEN_BORDER
| wxDOUBLE_BORDER
)) != 0;