]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private.h
39292f3c980a3aacc77e2e009ea36496b7bf1d4d
[wxWidgets.git] / include / wx / msw / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: private.h
3 // Purpose: Private declarations: as this header is only included by
4 // wxWindows itself, it may contain identifiers which don't start
5 // with "wx".
6 // Author: Julian Smart
7 // Modified by:
8 // Created: 01/02/97
9 // RCS-ID: $Id$
10 // Copyright: (c) Julian Smart
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_PRIVATE_H_
15 #define _WX_PRIVATE_H_
16
17 #include <windows.h>
18
19 class WXDLLEXPORT wxFont;
20
21 // ---------------------------------------------------------------------------
22 // standard icons from the resources
23 // ---------------------------------------------------------------------------
24
25 WXDLLEXPORT_DATA(extern HICON) wxSTD_FRAME_ICON;
26 WXDLLEXPORT_DATA(extern HICON) wxSTD_MDIPARENTFRAME_ICON;
27 WXDLLEXPORT_DATA(extern HICON) wxSTD_MDICHILDFRAME_ICON;
28 WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_FRAME_ICON;
29 WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDIPARENTFRAME_ICON;
30 WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDICHILDFRAME_ICON;
31 WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT;
32
33 // ---------------------------------------------------------------------------
34 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
35 // window proc
36 // ---------------------------------------------------------------------------
37 #ifdef __GNUWIN32__
38 # define CASTWNDPROC (long unsigned)
39 #else
40 # ifdef __BORLANDC__
41
42 # ifdef __WIN32__
43 # define CASTWNDPROC
44 # else
45 typedef int (pascal * WndProcCast) ();
46 # define CASTWNDPROC (WndProcCast)
47 # endif
48
49 # else
50 # if defined (__WIN32__) && defined(STRICT)
51 typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long);
52 # define CASTWNDPROC (WndProcCast)
53 # elif defined(__WIN16__)
54 # ifdef __BORLANDC__
55 typedef int (pascal * WndProcCast) ();
56 # define CASTWNDPROC (WndProcCast)
57 # else
58 typedef int (PASCAL * WndProcCast) ();
59 # define CASTWNDPROC (WndProcCast)
60 # endif
61 # else
62 # define CASTWNDPROC
63 # endif
64 # endif
65 #endif
66
67 // ---------------------------------------------------------------------------
68 // some stuff for old Windows versions (FIXME: what does it do here??)
69 // ---------------------------------------------------------------------------
70
71 #if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
72 #define APIENTRY FAR PASCAL
73 #endif
74
75 #ifdef __WIN32__
76 #define _EXPORT
77 #else
78 #define _EXPORT _export
79 #endif
80
81 #ifndef __WIN32__
82 typedef signed short int SHORT;
83 #endif
84
85 #if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
86 #define DLGPROC FARPROC
87 #endif
88
89 #if wxUSE_PENWIN
90 WXDLLEXPORT void wxRegisterPenWin();
91 WXDLLEXPORT void wxCleanUpPenWin();
92 WXDLLEXPORT void wxEnablePenAppHooks (bool hook);
93 #endif // wxUSE_PENWIN
94
95 #if wxUSE_ITSY_BITSY
96 #define IBS_HORZCAPTION 0x4000L
97 #define IBS_VERTCAPTION 0x8000L
98
99 UINT WINAPI ibGetCaptionSize( HWND hWnd ) ;
100 UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
101 LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam ) ;
102 VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
103 #endif // wxUSE_ITSY_BITSY
104
105 #if wxUSE_CTL3D
106 #include "wx/msw/ctl3d/ctl3d.h"
107 #endif // wxUSE_CTL3D
108
109 /*
110 * Decide what window classes we're going to use
111 * for this combination of CTl3D/FAFA settings
112 */
113
114 #define STATIC_CLASS "STATIC"
115 #define STATIC_FLAGS (SS_LEFT|WS_CHILD|WS_VISIBLE)
116 #define CHECK_CLASS "BUTTON"
117 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP|WS_CHILD)
118 #define CHECK_IS_FAFA FALSE
119 #define RADIO_CLASS "BUTTON"
120 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_CHILD|WS_VISIBLE)
121 #define RADIO_SIZE 20
122 #define RADIO_IS_FAFA FALSE
123 #define PURE_WINDOWS
124 #define GROUP_CLASS "BUTTON"
125 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
126
127 /*
128 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
129 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
130 */
131
132 // ---------------------------------------------------------------------------
133 // misc macros
134 // ---------------------------------------------------------------------------
135
136 #define MEANING_CHARACTER '0'
137 #define DEFAULT_ITEM_WIDTH 200
138 #define DEFAULT_ITEM_HEIGHT 80
139
140 // Scale font to get edit control height
141 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
142
143 // Generic subclass proc, for panel item moving/sizing and intercept
144 // EDIT control VK_RETURN messages
145 extern LONG APIENTRY _EXPORT
146 wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
147
148 // ---------------------------------------------------------------------------
149 // constants which might miss from some compilers' headers
150 // ---------------------------------------------------------------------------
151
152 #if !defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
153 #define WS_EX_CLIENTEDGE 0
154 #endif
155
156 #if defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
157 #define WS_EX_CLIENTEDGE 0x00000200L
158 #endif
159
160 #ifndef ENDSESSION_LOGOFF
161 #define ENDSESSION_LOGOFF 0x80000000
162 #endif
163
164 // ---------------------------------------------------------------------------
165 // debug messages
166 // ---------------------------------------------------------------------------
167 #if defined(__WIN95__) && defined(__WXDEBUG__) && wxUSE_DBWIN32
168
169 #ifndef __TWIN32__
170 #ifdef OutputDebugString
171 #undef OutputDebugString
172 #endif
173
174 #define OutputDebugString OutputDebugStringW95
175 #endif // __TWIN32__
176
177 extern void OutputDebugStringW95(const wxChar*, ...);
178 #endif // USE_DBWIN32
179
180 // ---------------------------------------------------------------------------
181 // macros to make casting between WXFOO and FOO a bit easier
182 // ---------------------------------------------------------------------------
183
184 #define GetHwnd() ((HWND)GetHWND())
185 #define GetWinHwnd(win) ((HWND)((win)->GetHWND()))
186
187 #define GetHdc() ((HDC)GetHDC())
188
189 #define GetHaccel() ((HACCEL)GetHACCEL())
190 #define GetTableHaccel(table) ((HACCEL)((table)->GetHACCEL()))
191
192 // ---------------------------------------------------------------------------
193 // global data
194 // ---------------------------------------------------------------------------
195
196 // The MakeProcInstance version of the function wxSubclassedGenericControlProc
197 WXDLLEXPORT_DATA(extern FARPROC) wxGenericControlSubClassProc;
198 WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
199 WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance;
200
201 // ---------------------------------------------------------------------------
202 // global functions
203 // ---------------------------------------------------------------------------
204
205 WXDLLEXPORT HINSTANCE wxGetInstance();
206 WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
207
208 WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd);
209
210 WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font);
211 WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, wxFont *font);
212 WXDLLEXPORT wxFont wxCreateFontFromLogFont(LOGFONT *logFont);
213
214 WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos);
215 WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos);
216
217 // Find maximum size of window/rectangle
218 WXDLLEXPORT extern void wxFindMaxSize(WXHWND hwnd, RECT *rect);
219
220 WXDLLEXPORT wxWindow* wxFindControlFromHandle(WXHWND hWnd);
221 WXDLLEXPORT void wxAddControlHandle(WXHWND hWnd, wxWindow *item);
222
223 // Safely get the window text (i.e. without using fixed size buffer)
224 WXDLLEXPORT extern wxString wxGetWindowText(WXHWND hWnd);
225
226 // get the window class name
227 WXDLLEXPORT extern wxString wxGetWindowClass(WXHWND hWnd);
228
229 // get the window id
230 WXDLLEXPORT extern wxWindowID wxGetWindowId(WXHWND hWnd);
231
232 // Does this window style specify any border?
233 inline bool wxStyleHasBorder(long style)
234 {
235 return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER |
236 wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
237 }
238
239 #endif
240 // _WX_PRIVATE_H_