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