]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: init.h | |
3 | // Purpose: interface of global functions | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | ||
10 | /** | |
11 | @class wxInitializer | |
12 | ||
13 | Create an object of this class on the stack to initialize/cleanup the library | |
14 | automatically. | |
15 | ||
16 | @library{wxbase} | |
17 | @category{appmanagement} | |
18 | ||
19 | @see wxGLContext | |
20 | */ | |
21 | class wxInitializer | |
22 | { | |
23 | public: | |
24 | /** | |
25 | Initializes the library. | |
26 | Calls wxInitialize(). | |
27 | */ | |
28 | wxInitializer(int argc = 0, wxChar **argv = NULL); | |
29 | ||
30 | /** | |
31 | Has the initialization been successful? (explicit test) | |
32 | */ | |
33 | bool IsOk() const; | |
34 | ||
35 | /** | |
36 | This dtor only does clean up if we initialized the library properly. | |
37 | Calls wxUninitialize(). | |
38 | */ | |
39 | ~wxInitializer(); | |
40 | }; | |
41 | ||
42 | ||
43 | ||
44 | /** @addtogroup group_funcmacro_appinitterm */ | |
45 | //@{ | |
46 | ||
47 | /** | |
48 | This function can be used to perform the initialization of wxWidgets if you | |
49 | can't use the default initialization code for any reason. | |
50 | ||
51 | If the function returns true, the initialization was successful and the | |
52 | global wxApp object ::wxTheApp has been created. Moreover, wxEntryCleanup() | |
53 | must be called afterwards. If the function returns false, a catastrophic | |
54 | initialization error occured and (at least the GUI part of) the library | |
55 | can't be used at all. | |
56 | ||
57 | Notice that parameters @c argc and @c argv may be modified by this | |
58 | function. | |
59 | ||
60 | @header{wx/init.h} | |
61 | */ | |
62 | bool wxEntryStart(int& argc, wxChar** argv); | |
63 | ||
64 | /** | |
65 | See wxEntryStart(int&,wxChar**) for more info about this function. | |
66 | ||
67 | This is an additional overload of wxEntryStart() provided under MSW only. | |
68 | It is meant to be called with the parameters passed to WinMain(). | |
69 | ||
70 | @note Under Windows CE platform, and only there, the type of @a pCmdLine is | |
71 | @c wchar_t *, otherwise it is @c char *, even in Unicode build. | |
72 | ||
73 | @onlyfor{wxmsw} | |
74 | ||
75 | @header{wx/init.h} | |
76 | */ | |
77 | bool wxEntryStart(HINSTANCE hInstance, | |
78 | HINSTANCE hPrevInstance = NULL, | |
79 | char* pCmdLine = NULL, | |
80 | int nCmdShow = SW_SHOWNORMAL); | |
81 | ||
82 | /** | |
83 | Free resources allocated by a successful call to wxEntryStart(). | |
84 | ||
85 | @header{wx/init.h} | |
86 | */ | |
87 | void wxEntryCleanup(); | |
88 | ||
89 | /** | |
90 | Initialize the library (may be called as many times as needed, but each | |
91 | call to wxInitialize() must be matched by wxUninitialize()). | |
92 | ||
93 | With this function you may avoid DECLARE_APP() and IMPLEMENT_APP() macros | |
94 | and use wxInitialize() and wxUninitialize() dynamically in the | |
95 | program startup and termination. | |
96 | ||
97 | @header{wx/init.h} | |
98 | */ | |
99 | bool wxInitialize(int argc = 0, wxChar **argv = NULL); | |
100 | ||
101 | /** | |
102 | Clean up; the library can't be used any more after the last call to | |
103 | wxUninitialize(). | |
104 | ||
105 | See wxInitialize() for more info. | |
106 | ||
107 | @header{wx/init.h} | |
108 | */ | |
109 | void wxUninitialize(); | |
110 | ||
111 | //@} | |
112 |