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