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