]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: apptrait.h | |
e54c96f1 | 3 | // Purpose: interface of wxAppTraits |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxAppTraits | |
7c913512 | 10 | |
d2aa927a FM |
11 | The wxAppTraits class defines various configurable aspects of a wxApp. |
12 | You can access it using wxApp::GetTraits() function and you can create your | |
13 | own wxAppTraits overriding the wxApp::CreateTraits() function. | |
14 | ||
15 | Note that wxAppTraits is an abstract class since it contains many | |
16 | pure virtual functions. | |
17 | In fact, by default, wxWidgets creates a @c wxConsoleAppTraits object for | |
18 | console applications (i.e. those applications linked against wxBase library | |
19 | only - see the @ref page_libs page) and a @c wxGUIAppTraits object for GUI | |
23324ae1 | 20 | applications. |
d2aa927a FM |
21 | Both these classes are derived by wxAppTraits and represent concrete |
22 | implementation of the wxAppTraits interface. | |
7c913512 | 23 | |
23324ae1 | 24 | @library{wxbase} |
3c99e2fd | 25 | @category{cfg} |
7c913512 | 26 | |
96d7cc9b | 27 | @see @ref overview_app, wxApp |
23324ae1 | 28 | */ |
7c913512 | 29 | class wxAppTraits |
23324ae1 FM |
30 | { |
31 | public: | |
32 | /** | |
33 | Called by wxWidgets to create the default configuration object for the | |
96d7cc9b FM |
34 | application. The default version creates a registry-based wxRegConfig |
35 | class under MSW and wxFileConfig under all other platforms. | |
36 | ||
37 | The wxApp::GetAppName and wxApp::GetVendorName methods are used to | |
38 | determine the registry key or file name. | |
23324ae1 | 39 | */ |
4cc4bfaf | 40 | virtual wxConfigBase* CreateConfig(); |
23324ae1 FM |
41 | |
42 | /** | |
48c90c6e VZ |
43 | Used by wxWidgets to create the main event loop used by wxApp::OnRun(). |
44 | ||
45 | The default implementation of this method in wxGUIAppTraits returns the | |
46 | usual platform-specific GUI event loop. The version in wxConsoleAppTraits | |
47 | returns a console-specific event loop which can be used to handle timer | |
48 | and socket events in console programs under Unix and MSW or @NULL under | |
49 | the other platforms where console event loops are not supported yet. | |
50 | */ | |
51 | virtual wxEventLoopBase *CreateEventLoop() = 0; | |
52 | ||
53 | /** | |
23324ae1 FM |
54 | Creates the global font mapper object used for encodings/charset mapping. |
55 | */ | |
d2aa927a | 56 | virtual wxFontMapper* CreateFontMapper() = 0; |
23324ae1 FM |
57 | |
58 | /** | |
8064223b FM |
59 | Creates a wxLog class for the application to use for logging errors. |
60 | The default implementation returns a new wxLogGui class. | |
61 | ||
62 | @see wxLog | |
23324ae1 | 63 | */ |
d2aa927a | 64 | virtual wxLog* CreateLogTarget() = 0; |
23324ae1 FM |
65 | |
66 | /** | |
67 | Creates the global object used for printing out messages. | |
68 | */ | |
d2aa927a | 69 | virtual wxMessageOutput* CreateMessageOutput() = 0; |
23324ae1 FM |
70 | |
71 | /** | |
96d7cc9b FM |
72 | Returns the renderer to use for drawing the generic controls (return |
73 | value may be @NULL in which case the default renderer for the current | |
74 | platform is used); this is used in GUI mode only and always returns @NULL | |
75 | in console. | |
76 | ||
77 | @note the returned pointer needs to be deleted by the caller. | |
23324ae1 | 78 | */ |
d2aa927a | 79 | virtual wxRendererNative* CreateRenderer() = 0; |
23324ae1 FM |
80 | |
81 | /** | |
82 | This method returns the name of the desktop environment currently | |
83 | running in a Unix desktop. Currently only "KDE" or "GNOME" are | |
84 | supported and the code uses the X11 session protocol vendor name | |
85 | to figure out, which desktop environment is running. The method | |
86 | returns an empty string otherwise and on all other platforms. | |
87 | */ | |
d2aa927a | 88 | virtual wxString GetDesktopEnvironment() const = 0; |
23324ae1 FM |
89 | |
90 | /** | |
91 | Returns the wxStandardPaths object for the application. | |
96d7cc9b FM |
92 | It's normally the same for wxBase and wxGUI except in the case of wxMac |
93 | and wxCocoa. | |
8d483c9b | 94 | |
f045c7f5 FM |
95 | @note |
96 | The returned reference is to a @c wxStandardPathsBase class but you | |
97 | can consider it to be equivalent to wxStandardPaths (which is documented). | |
23324ae1 | 98 | */ |
9a077460 | 99 | virtual wxStandardPaths& GetStandardPaths(); |
23324ae1 FM |
100 | |
101 | /** | |
102 | Returns the wxWidgets port ID used by the running program and eventually | |
103 | fills the given pointers with the values of the major and minor digits | |
104 | of the native toolkit currently used. | |
96d7cc9b | 105 | |
23324ae1 FM |
106 | The version numbers returned are thus detected at run-time and not compile-time |
107 | (except when this is not possible e.g. wxMotif). | |
96d7cc9b | 108 | |
23324ae1 | 109 | E.g. if your program is using wxGTK port this function will return wxPORT_GTK |
96d7cc9b | 110 | and put in given pointers the versions of the GTK library in use. |
23324ae1 FM |
111 | See wxPlatformInfo for more details. |
112 | */ | |
d2aa927a | 113 | virtual wxPortId GetToolkitVersion(int* major = NULL, int* minor = NULL) const = 0; |
23324ae1 FM |
114 | |
115 | /** | |
116 | Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise. | |
117 | */ | |
d2aa927a | 118 | virtual bool HasStderr() = 0; |
23324ae1 FM |
119 | |
120 | /** | |
96d7cc9b FM |
121 | Returns @true if the library was built as wxUniversal. |
122 | Always returns @false for wxBase-only apps. | |
23324ae1 | 123 | */ |
d2aa927a | 124 | virtual bool IsUsingUniversalWidgets() const = 0; |
23324ae1 FM |
125 | |
126 | /** | |
127 | Shows the assert dialog with the specified message in GUI mode or just prints | |
128 | the string to stderr in console mode. | |
23324ae1 FM |
129 | Returns @true to suppress subsequent asserts, @false to continue as before. |
130 | */ | |
d2aa927a | 131 | virtual bool ShowAssertDialog(const wxString& msg) = 0; |
23324ae1 | 132 | }; |
e54c96f1 | 133 |