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