]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/defs.h
even more interface fixes
[wxWidgets.git] / interface / wx / defs.h
CommitLineData
23324ae1 1/////////////////////////////////////////////////////////////////////////////
706068e4 2// Name: wx/defs.h
e54c96f1 3// Purpose: interface of global functions
7c913512
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
f992f2ae
BP
9/**
10 Item kinds for use with wxMenu, wxMenuItem, and wxToolBar.
706068e4 11
f992f2ae
BP
12 @see wxMenu::Append(), wxMenuItem::wxMenuItem(), wxToolBar::AddTool()
13*/
14enum wxItemKind
15{
16 wxITEM_SEPARATOR = -1,
17
18 /**
19 Normal tool button / menu item.
20
21 @see wxToolBar::AddTool(), wxMenu::AppendItem().
22 */
23 wxITEM_NORMAL,
24
25 /**
26 Check (or toggle) tool button / menu item.
27
28 @see wxToolBar::AddCheckTool(), wxMenu::AppendCheckItem().
29 */
30 wxITEM_CHECK,
31
32 /**
33 Radio tool button / menu item.
34
35 @see wxToolBar::AddRadioTool(), wxMenu::AppendRadioItem().
36 */
37 wxITEM_RADIO,
38
39 /**
40 Normal tool button with a dropdown arrow next to it. Clicking the
41 dropdown arrow sends a @c wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED event and may
42 also display the menu previously associated with the item with
43 wxToolBar::SetDropdownMenu(). Currently this type of tools is supported
44 under MSW and GTK.
45 */
46 wxITEM_DROPDOWN,
47
48 wxITEM_MAX
49};
50
51
d18d9f60
BP
52/**
53 Paper size types for use with the printing framework.
54
55 @see overview_printing, wxPrintData::SetPaperId()
56*/
57enum wxPaperSize
58{
59 wxPAPER_NONE, ///< Use specific dimensions
60 wxPAPER_LETTER, ///< Letter, 8 1/2 by 11 inches
61 wxPAPER_LEGAL, ///< Legal, 8 1/2 by 14 inches
62 wxPAPER_A4, ///< A4 Sheet, 210 by 297 millimeters
63 wxPAPER_CSHEET, ///< C Sheet, 17 by 22 inches
64 wxPAPER_DSHEET, ///< D Sheet, 22 by 34 inches
65 wxPAPER_ESHEET, ///< E Sheet, 34 by 44 inches
66 wxPAPER_LETTERSMALL, ///< Letter Small, 8 1/2 by 11 inches
67 wxPAPER_TABLOID, ///< Tabloid, 11 by 17 inches
68 wxPAPER_LEDGER, ///< Ledger, 17 by 11 inches
69 wxPAPER_STATEMENT, ///< Statement, 5 1/2 by 8 1/2 inches
70 wxPAPER_EXECUTIVE, ///< Executive, 7 1/4 by 10 1/2 inches
71 wxPAPER_A3, ///< A3 sheet, 297 by 420 millimeters
72 wxPAPER_A4SMALL, ///< A4 small sheet, 210 by 297 millimeters
73 wxPAPER_A5, ///< A5 sheet, 148 by 210 millimeters
74 wxPAPER_B4, ///< B4 sheet, 250 by 354 millimeters
75 wxPAPER_B5, ///< B5 sheet, 182-by-257-millimeter paper
76 wxPAPER_FOLIO, ///< Folio, 8-1/2-by-13-inch paper
77 wxPAPER_QUARTO, ///< Quarto, 215-by-275-millimeter paper
78 wxPAPER_10X14, ///< 10-by-14-inch sheet
79 wxPAPER_11X17, ///< 11-by-17-inch sheet
80 wxPAPER_NOTE, ///< Note, 8 1/2 by 11 inches
81 wxPAPER_ENV_9, ///< #9 Envelope, 3 7/8 by 8 7/8 inches
82 wxPAPER_ENV_10, ///< #10 Envelope, 4 1/8 by 9 1/2 inches
83 wxPAPER_ENV_11, ///< #11 Envelope, 4 1/2 by 10 3/8 inches
84 wxPAPER_ENV_12, ///< #12 Envelope, 4 3/4 by 11 inches
85 wxPAPER_ENV_14, ///< #14 Envelope, 5 by 11 1/2 inches
86 wxPAPER_ENV_DL, ///< DL Envelope, 110 by 220 millimeters
87 wxPAPER_ENV_C5, ///< C5 Envelope, 162 by 229 millimeters
88 wxPAPER_ENV_C3, ///< C3 Envelope, 324 by 458 millimeters
89 wxPAPER_ENV_C4, ///< C4 Envelope, 229 by 324 millimeters
90 wxPAPER_ENV_C6, ///< C6 Envelope, 114 by 162 millimeters
91 wxPAPER_ENV_C65, ///< C65 Envelope, 114 by 229 millimeters
92 wxPAPER_ENV_B4, ///< B4 Envelope, 250 by 353 millimeters
93 wxPAPER_ENV_B5, ///< B5 Envelope, 176 by 250 millimeters
94 wxPAPER_ENV_B6, ///< B6 Envelope, 176 by 125 millimeters
95 wxPAPER_ENV_ITALY, ///< Italy Envelope, 110 by 230 millimeters
96 wxPAPER_ENV_MONARCH, ///< Monarch Envelope, 3 7/8 by 7 1/2 inches
97 wxPAPER_ENV_PERSONAL, ///< 6 3/4 Envelope, 3 5/8 by 6 1/2 inches
98 wxPAPER_FANFOLD_US, ///< US Std Fanfold, 14 7/8 by 11 inches
99 wxPAPER_FANFOLD_STD_GERMAN, ///< German Std Fanfold, 8 1/2 by 12 inches
100 wxPAPER_FANFOLD_LGL_GERMAN, ///< German Legal Fanfold, 8 1/2 by 13 inches
101
102 // Windows 95 Only
103
104 wxPAPER_ISO_B4, ///< B4 (ISO) 250 x 353 mm
105 wxPAPER_JAPANESE_POSTCARD, ///< Japanese Postcard 100 x 148 mm
106 wxPAPER_9X11, ///< 9 x 11 in
107 wxPAPER_10X11, ///< 10 x 11 in
108 wxPAPER_15X11, ///< 15 x 11 in
109 wxPAPER_ENV_INVITE, ///< Envelope Invite 220 x 220 mm
4050e98d
BP
110 wxPAPER_LETTER_EXTRA, ///< Letter Extra 9.5 x 12 in
111 wxPAPER_LEGAL_EXTRA, ///< Legal Extra 9.5 x 15 in
d18d9f60
BP
112 wxPAPER_TABLOID_EXTRA, ///< Tabloid Extra 11.69 x 18 in
113 wxPAPER_A4_EXTRA, ///< A4 Extra 9.27 x 12.69 in
4050e98d 114 wxPAPER_LETTER_TRANSVERSE, ///< Letter Transverse 8.5 x 11 in
d18d9f60 115 wxPAPER_A4_TRANSVERSE, ///< A4 Transverse 210 x 297 mm
4050e98d 116 wxPAPER_LETTER_EXTRA_TRANSVERSE, ///< Letter Extra Transverse 9.5 x 12 in
d18d9f60
BP
117 wxPAPER_A_PLUS, ///< SuperA/SuperA/A4 227 x 356 mm
118 wxPAPER_B_PLUS, ///< SuperB/SuperB/A3 305 x 487 mm
119 wxPAPER_LETTER_PLUS, ///< Letter Plus 8.5 x 12.69 in
120 wxPAPER_A4_PLUS, ///< A4 Plus 210 x 330 mm
121 wxPAPER_A5_TRANSVERSE, ///< A5 Transverse 148 x 210 mm
122 wxPAPER_B5_TRANSVERSE, ///< B5 (JIS) Transverse 182 x 257 mm
123 wxPAPER_A3_EXTRA, ///< A3 Extra 322 x 445 mm
124 wxPAPER_A5_EXTRA, ///< A5 Extra 174 x 235 mm
125 wxPAPER_B5_EXTRA, ///< B5 (ISO) Extra 201 x 276 mm
126 wxPAPER_A2, ///< A2 420 x 594 mm
127 wxPAPER_A3_TRANSVERSE, ///< A3 Transverse 297 x 420 mm
128 wxPAPER_A3_EXTRA_TRANSVERSE, ///< A3 Extra Transverse 322 x 445 mm
129
130 wxPAPER_DBL_JAPANESE_POSTCARD, ///< Japanese Double Postcard 200 x 148 mm
131 wxPAPER_A6, ///< A6 105 x 148 mm
132 wxPAPER_JENV_KAKU2, ///< Japanese Envelope Kaku #2
133 wxPAPER_JENV_KAKU3, ///< Japanese Envelope Kaku #3
134 wxPAPER_JENV_CHOU3, ///< Japanese Envelope Chou #3
135 wxPAPER_JENV_CHOU4, ///< Japanese Envelope Chou #4
136 wxPAPER_LETTER_ROTATED, ///< Letter Rotated 11 x 8 1/2 in
137 wxPAPER_A3_ROTATED, ///< A3 Rotated 420 x 297 mm
138 wxPAPER_A4_ROTATED, ///< A4 Rotated 297 x 210 mm
139 wxPAPER_A5_ROTATED, ///< A5 Rotated 210 x 148 mm
140 wxPAPER_B4_JIS_ROTATED, ///< B4 (JIS) Rotated 364 x 257 mm
141 wxPAPER_B5_JIS_ROTATED, ///< B5 (JIS) Rotated 257 x 182 mm
142 wxPAPER_JAPANESE_POSTCARD_ROTATED, ///< Japanese Postcard Rotated 148 x 100 mm
143 wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED, ///< Double Japanese Postcard Rotated 148 x 200 mm
144 wxPAPER_A6_ROTATED, ///< A6 Rotated 148 x 105 mm
145 wxPAPER_JENV_KAKU2_ROTATED, ///< Japanese Envelope Kaku #2 Rotated
146 wxPAPER_JENV_KAKU3_ROTATED, ///< Japanese Envelope Kaku #3 Rotated
147 wxPAPER_JENV_CHOU3_ROTATED, ///< Japanese Envelope Chou #3 Rotated
148 wxPAPER_JENV_CHOU4_ROTATED, ///< Japanese Envelope Chou #4 Rotated
149 wxPAPER_B6_JIS, ///< B6 (JIS) 128 x 182 mm
150 wxPAPER_B6_JIS_ROTATED, ///< B6 (JIS) Rotated 182 x 128 mm
151 wxPAPER_12X11, ///< 12 x 11 in
152 wxPAPER_JENV_YOU4, ///< Japanese Envelope You #4
153 wxPAPER_JENV_YOU4_ROTATED, ///< Japanese Envelope You #4 Rotated
154 wxPAPER_P16K, ///< PRC 16K 146 x 215 mm
155 wxPAPER_P32K, ///< PRC 32K 97 x 151 mm
156 wxPAPER_P32KBIG, ///< PRC 32K(Big) 97 x 151 mm
157 wxPAPER_PENV_1, ///< PRC Envelope #1 102 x 165 mm
158 wxPAPER_PENV_2, ///< PRC Envelope #2 102 x 176 mm
159 wxPAPER_PENV_3, ///< PRC Envelope #3 125 x 176 mm
160 wxPAPER_PENV_4, ///< PRC Envelope #4 110 x 208 mm
161 wxPAPER_PENV_5, ///< PRC Envelope #5 110 x 220 mm
162 wxPAPER_PENV_6, ///< PRC Envelope #6 120 x 230 mm
163 wxPAPER_PENV_7, ///< PRC Envelope #7 160 x 230 mm
164 wxPAPER_PENV_8, ///< PRC Envelope #8 120 x 309 mm
165 wxPAPER_PENV_9, ///< PRC Envelope #9 229 x 324 mm
166 wxPAPER_PENV_10, ///< PRC Envelope #10 324 x 458 mm
167 wxPAPER_P16K_ROTATED, ///< PRC 16K Rotated
168 wxPAPER_P32K_ROTATED, ///< PRC 32K Rotated
169 wxPAPER_P32KBIG_ROTATED, ///< PRC 32K(Big) Rotated
170 wxPAPER_PENV_1_ROTATED, ///< PRC Envelope #1 Rotated 165 x 102 mm
171 wxPAPER_PENV_2_ROTATED, ///< PRC Envelope #2 Rotated 176 x 102 mm
172 wxPAPER_PENV_3_ROTATED, ///< PRC Envelope #3 Rotated 176 x 125 mm
173 wxPAPER_PENV_4_ROTATED, ///< PRC Envelope #4 Rotated 208 x 110 mm
174 wxPAPER_PENV_5_ROTATED, ///< PRC Envelope #5 Rotated 220 x 110 mm
175 wxPAPER_PENV_6_ROTATED, ///< PRC Envelope #6 Rotated 230 x 120 mm
176 wxPAPER_PENV_7_ROTATED, ///< PRC Envelope #7 Rotated 230 x 160 mm
177 wxPAPER_PENV_8_ROTATED, ///< PRC Envelope #8 Rotated 309 x 120 mm
178 wxPAPER_PENV_9_ROTATED, ///< PRC Envelope #9 Rotated 324 x 229 mm
179 wxPAPER_PENV_10_ROTATED ///< PRC Envelope #10 Rotated 458 x 324 m
180};
181
182
9579c1d7 183/** @ingroup group_funcmacro_byteorder */
7c913512 184//@{
9579c1d7 185
23324ae1 186/**
9579c1d7
BP
187 This macro will swap the bytes of the @a value variable from little endian
188 to big endian or vice versa unconditionally, i.e. independently of the
23324ae1 189 current platform.
9579c1d7
BP
190
191 @header{wx/defs.h}
23324ae1 192*/
9579c1d7
BP
193#define wxINT32_SWAP_ALWAYS( wxInt32 value )
194#define wxUINT32_SWAP_ALWAYS( wxUint32 value )
195#define wxINT16_SWAP_ALWAYS( wxInt16 value )
196#define wxUINT16_SWAP_ALWAYS( wxUint16 value )
197
23324ae1
FM
198//@}
199
9579c1d7
BP
200/** @ingroup group_funcmacro_byteorder */
201//@{
202
203/**
204 This macro will swap the bytes of the @a value variable from little endian
205 to big endian or vice versa if the program is compiled on a big-endian
206 architecture (such as Sun work stations). If the program has been compiled
207 on a little-endian architecture, the value will be unchanged.
208
209 Use these macros to read data from and write data to a file that stores
210 data in little-endian (for example Intel i386) format.
211
212 @header{wx/defs.h}
213*/
214#define wxINT32_SWAP_ON_BE( wxInt32 value )
215#define wxUINT32_SWAP_ON_BE( wxUint32 value )
216#define wxINT16_SWAP_ON_BE( wxInt16 value )
217#define wxUINT16_SWAP_ON_BE( wxUint16 value )
23324ae1 218
9579c1d7
BP
219//@}
220
221/** @ingroup group_funcmacro_byteorder */
7c913512 222//@{
9579c1d7 223
23324ae1 224/**
9579c1d7
BP
225 This macro will swap the bytes of the @a value variable from little endian
226 to big endian or vice versa if the program is compiled on a little-endian
227 architecture (such as Intel PCs). If the program has been compiled on a
228 big-endian architecture, the value will be unchanged.
229
23324ae1
FM
230 Use these macros to read data from and write data to a file that stores
231 data in big-endian format.
9579c1d7
BP
232
233 @header{wx/defs.h}
23324ae1 234*/
9579c1d7
BP
235#define wxINT32_SWAP_ON_LE( wxInt32 value )
236#define wxUINT32_SWAP_ON_LE( wxUint32 value )
237#define wxINT16_SWAP_ON_LE( wxInt16 value )
238#define wxUINT16_SWAP_ON_LE( wxUint16 value )
239
23324ae1
FM
240//@}
241
9579c1d7
BP
242
243
7fa7088e
BP
244/** @ingroup group_funcmacro_misc */
245//@{
9579c1d7 246
706068e4
VZ
247/**
248 This macro can be used in a class declaration to disable the generation of
249 default assignment operator.
250
251 Some classes have a well-defined copy constructor but cannot have an
252 assignment operator, typically because they can't be modified once created.
253 In such case, this macro can be used to disable the automatic assignment
254 operator generation.
255
256 @see DECLARE_NO_COPY_CLASS()
257 */
258#define DECLARE_NO_ASSIGN_CLASS(classname)
259
260/**
261 This macro can be used in a class declaration to disable the generation of
262 default copy ctor and assignment operator.
263
264 Some classes don't have a well-defined copying semantics. In this case the
265 standard C++ convention is to not allow copying them. One way of achieving
266 it is to use this macro which simply defines a private copy constructor and
267 assignment operator.
268
269 Beware that simply not defining copy constructor and assignment operator is
270 @em not enough as the compiler would provide its own automatically-generated
271 versions of them -- hence the usefulness of this macro.
272
273 Example of use:
274 @code
275 class FooWidget
276 {
277 public:
278 FooWidget();
279 ...
280
281 private:
282 // widgets can't be copied
283 DECLARE_NO_COPY_CLASS(FooWidget)
284 };
285 @endcode
286
287 Notice that a semicolon should not be used after this macro and that it
288 changes the access specifier to private internally so it is better to use
289 it at the end of the class declaration.
290 */
291#define DECLARE_NO_COPY_CLASS(classname)
292
375a5d3a
VZ
293/**
294 Equivalent of DECLARE_NO_COPY_CLASS() for template classes.
295
296 This macro can be used for template classes (with a single template
297 parameter) for the same purpose as DECLARE_NO_COPY_CLASS() is used with the
298 non-template classes.
299
300 @param classname The name of the template class.
301 @param arg The name of the template parameter.
302 */
303#define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg)
304
dac8712f
VZ
305/**
306 A function which deletes and nulls the pointer.
307
308 This function uses operator delete to free the pointer and also sets it to
309 @NULL. Notice that this does @em not work for arrays, use wxDELETEA() for
310 them.
311
312 @code
313 MyClass *ptr = new MyClass;
314 ...
315 wxDELETE(ptr);
316 wxASSERT(!ptr);
317 @endcode
318
319 @header{wx/defs.h}
320*/
321template <typename T> wxDELETE(T*& ptr);
322
323/**
324 A function which deletes and nulls the pointer.
325
326 This function uses vector operator delete (@c delete[]) to free the array
327 pointer and also sets it to @NULL. Notice that this does @em not work for
328 non-array pointers, use wxDELETE() for them.
329
330 @code
331 MyClass *array = new MyClass[17];
332 ...
333 wxDELETEA(array);
334 wxASSERT(!array);
335 @endcode
336
337 @see wxDELETE()
338
339 @header{wx/defs.h}
340*/
341template <typename T> wxDELETEA(T*& array);
342
23324ae1 343/**
7fa7088e
BP
344 This macro can be used around a function declaration to generate warnings
345 indicating that this function is deprecated (i.e. obsolete and planned to
346 be removed in the future) when it is used. Only Visual C++ 7 and higher and
347 g++ compilers currently support this functionality.
348
349 Example of use:
350
351 @code
352 // old function, use wxString version instead
353 wxDEPRECATED( void wxGetSomething(char *buf, size_t len) );
354
355 // ...
356 wxString wxGetSomething();
357 @endcode
358
359 @header{wx/defs.h}
360*/
361#define wxDEPRECATED(function)
362
363/**
364 This is a special version of wxDEPRECATED() macro which only does something
365 when the deprecated function is used from the code outside wxWidgets itself
366 but doesn't generate warnings when it is used from wxWidgets.
367
368 It is used with the virtual functions which are called by the library
369 itself -- even if such function is deprecated the library still has to call
370 it to ensure that the existing code overriding it continues to work, but
371 the use of this macro ensures that a deprecation warning will be generated
372 if this function is used from the user code or, in case of Visual C++, even
373 when it is simply overridden.
374
375 @header{wx/defs.h}
376*/
377#define wxDEPRECATED_BUT_USED_INTERNALLY(function)
378
379/**
380 This macro is similar to wxDEPRECATED() but can be used to not only declare
381 the function @a function as deprecated but to also provide its (inline)
382 implementation @a body.
383
23324ae1 384 It can be used as following:
7c913512 385
23324ae1
FM
386 @code
387 class wxFoo
7fa7088e
BP
388 {
389 public:
390 // OldMethod() is deprecated, use NewMethod() instead
391 void NewMethod();
392 wxDEPRECATED_INLINE( void OldMethod(), NewMethod() );
393 };
23324ae1 394 @endcode
7fa7088e
BP
395
396 @header{wx/defs.h}
23324ae1 397*/
7fa7088e 398#define wxDEPRECATED_INLINE(func, body)
23324ae1
FM
399
400/**
401 @c wxEXPLICIT is a macro which expands to the C++ @c explicit keyword if
7fa7088e
BP
402 the compiler supports it or nothing otherwise. Thus, it can be used even in
403 the code which might have to be compiled with an old compiler without
404 support for this language feature but still take advantage of it when it is
405 available.
23324ae1 406
7fa7088e
BP
407 @header{wx/defs.h}
408*/
409#define wxEXPLICIT
23324ae1
FM
410
411/**
412 GNU C++ compiler gives a warning for any class whose destructor is private
413 unless it has a friend. This warning may sometimes be useful but it doesn't
7fa7088e
BP
414 make sense for reference counted class which always delete themselves
415 (hence destructor should be private) but don't necessarily have any
416 friends, so this macro is provided to disable the warning in such case. The
417 @a name parameter should be the name of the class but is only used to
418 construct a unique friend class name internally.
419
420 Example of using the macro:
4cc4bfaf 421
23324ae1
FM
422 @code
423 class RefCounted
7fa7088e
BP
424 {
425 public:
426 RefCounted() { m_nRef = 1; }
427 void IncRef() { m_nRef++ ; }
428 void DecRef() { if ( !--m_nRef ) delete this; }
7c913512 429
7fa7088e
BP
430 private:
431 ~RefCounted() { }
7c913512 432
7fa7088e
BP
433 wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted)
434 };
23324ae1 435 @endcode
7c913512 436
23324ae1 437 Notice that there should be no semicolon after this macro.
7c913512 438
7fa7088e 439 @header{wx/defs.h}
23324ae1 440*/
7fa7088e 441#define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
23324ae1 442
dac8712f
VZ
443/**
444 Swaps the contents of two variables.
445
446 This is similar to std::swap() but can be used even on the platforms where
447 the standard C++ library is not available (if you don't target such
448 platforms, please use std::swap() instead).
449
450 The function relies on type T being copy constructible and assignable.
451
452 Example of use:
453 @code
454 int x = 3,
455 y = 4;
456 wxSwap(x, y);
457 wxASSERT( x == 4 && y == 3 );
458 @endcode
459 */
460template <typename T> wxSwap(T& first, T& second);
461
23324ae1
FM
462/**
463 This macro is the same as the standard C99 @c va_copy for the compilers
7fa7088e
BP
464 which support it or its replacement for those that don't. It must be used
465 to preserve the value of a @c va_list object if you need to use it after
23324ae1 466 passing it to another function because it can be modified by the latter.
7fa7088e 467
23324ae1
FM
468 As with @c va_start, each call to @c wxVaCopy must have a matching
469 @c va_end.
23324ae1 470
7fa7088e 471 @header{wx/defs.h}
23324ae1 472*/
7fa7088e 473void wxVaCopy(va_list argptrDst, va_list argptrSrc);
23324ae1 474
7fa7088e 475//@}
23324ae1 476
f992f2ae 477