]>
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$ | |
6 | // Licence: wxWindows license | |
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} |
96d7cc9b | 26 | @category{appmanagement} |
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 | /** | |
44 | Creates the global font mapper object used for encodings/charset mapping. | |
45 | */ | |
d2aa927a | 46 | virtual wxFontMapper* CreateFontMapper() = 0; |
23324ae1 FM |
47 | |
48 | /** | |
8064223b FM |
49 | Creates a wxLog class for the application to use for logging errors. |
50 | The default implementation returns a new wxLogGui class. | |
51 | ||
52 | @see wxLog | |
23324ae1 | 53 | */ |
d2aa927a | 54 | virtual wxLog* CreateLogTarget() = 0; |
23324ae1 FM |
55 | |
56 | /** | |
57 | Creates the global object used for printing out messages. | |
58 | */ | |
d2aa927a | 59 | virtual wxMessageOutput* CreateMessageOutput() = 0; |
23324ae1 FM |
60 | |
61 | /** | |
96d7cc9b FM |
62 | Returns the renderer to use for drawing the generic controls (return |
63 | value may be @NULL in which case the default renderer for the current | |
64 | platform is used); this is used in GUI mode only and always returns @NULL | |
65 | in console. | |
66 | ||
67 | @note the returned pointer needs to be deleted by the caller. | |
23324ae1 | 68 | */ |
d2aa927a | 69 | virtual wxRendererNative* CreateRenderer() = 0; |
23324ae1 FM |
70 | |
71 | /** | |
72 | This method returns the name of the desktop environment currently | |
73 | running in a Unix desktop. Currently only "KDE" or "GNOME" are | |
74 | supported and the code uses the X11 session protocol vendor name | |
75 | to figure out, which desktop environment is running. The method | |
76 | returns an empty string otherwise and on all other platforms. | |
77 | */ | |
d2aa927a | 78 | virtual wxString GetDesktopEnvironment() const = 0; |
23324ae1 FM |
79 | |
80 | /** | |
81 | Returns the wxStandardPaths object for the application. | |
96d7cc9b FM |
82 | It's normally the same for wxBase and wxGUI except in the case of wxMac |
83 | and wxCocoa. | |
8d483c9b FM |
84 | |
85 | @todo the real function returns a reference to wxStandardPathsBase; | |
86 | user looking at these docs will write code: | |
87 | wxStandardPaths &ref = ...->GetStandardPaths(); | |
88 | which won't compile... | |
23324ae1 | 89 | */ |
cc6e1a74 | 90 | virtual wxStandardPaths& GetStandardPaths(); |
23324ae1 FM |
91 | |
92 | /** | |
93 | Returns the wxWidgets port ID used by the running program and eventually | |
94 | fills the given pointers with the values of the major and minor digits | |
95 | of the native toolkit currently used. | |
96d7cc9b | 96 | |
23324ae1 FM |
97 | The version numbers returned are thus detected at run-time and not compile-time |
98 | (except when this is not possible e.g. wxMotif). | |
96d7cc9b | 99 | |
23324ae1 | 100 | E.g. if your program is using wxGTK port this function will return wxPORT_GTK |
96d7cc9b | 101 | and put in given pointers the versions of the GTK library in use. |
23324ae1 FM |
102 | See wxPlatformInfo for more details. |
103 | */ | |
d2aa927a | 104 | virtual wxPortId GetToolkitVersion(int* major = NULL, int* minor = NULL) const = 0; |
23324ae1 FM |
105 | |
106 | /** | |
107 | Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise. | |
108 | */ | |
d2aa927a | 109 | virtual bool HasStderr() = 0; |
23324ae1 FM |
110 | |
111 | /** | |
96d7cc9b FM |
112 | Returns @true if the library was built as wxUniversal. |
113 | Always returns @false for wxBase-only apps. | |
23324ae1 | 114 | */ |
d2aa927a | 115 | virtual bool IsUsingUniversalWidgets() const = 0; |
23324ae1 FM |
116 | |
117 | /** | |
118 | Shows the assert dialog with the specified message in GUI mode or just prints | |
119 | the string to stderr in console mode. | |
23324ae1 FM |
120 | Returns @true to suppress subsequent asserts, @false to continue as before. |
121 | */ | |
d2aa927a | 122 | virtual bool ShowAssertDialog(const wxString& msg) = 0; |
23324ae1 | 123 | }; |
e54c96f1 | 124 |