]> git.saurik.com Git - wxWidgets.git/blob - interface/apptrait.h
Commented out appearance sections in docs temporarily until screenshots are added.
[wxWidgets.git] / interface / apptrait.h
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 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
22 applications.
23 Both these classes are derived by wxAppTraits and represent concrete
24 implementation of the wxAppTraits interface.
25
26 @library{wxbase}
27 @category{appmanagement}
28
29 @see @ref overview_app, wxApp
30 */
31 class wxAppTraits
32 {
33 public:
34 /**
35 Called by wxWidgets to create the default configuration object for the
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.
41 */
42 virtual wxConfigBase* CreateConfig();
43
44 /**
45 Creates the global font mapper object used for encodings/charset mapping.
46 */
47 virtual wxFontMapper* CreateFontMapper() = 0;
48
49 /**
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
54 */
55 virtual wxLog* CreateLogTarget() = 0;
56
57 /**
58 Creates the global object used for printing out messages.
59 */
60 virtual wxMessageOutput* CreateMessageOutput() = 0;
61
62 /**
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.
69 */
70 virtual wxRendererNative* CreateRenderer() = 0;
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 */
79 virtual wxString GetDesktopEnvironment() const = 0;
80
81 /**
82 Returns the wxStandardPaths object for the application.
83 It's normally the same for wxBase and wxGUI except in the case of wxMac
84 and wxCocoa.
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...
90 */
91 virtual wxStandardPaths& GetStandardPaths();
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.
97
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).
100
101 E.g. if your program is using wxGTK port this function will return wxPORT_GTK
102 and put in given pointers the versions of the GTK library in use.
103 See wxPlatformInfo for more details.
104 */
105 virtual wxPortId GetToolkitVersion(int* major = NULL, int* minor = NULL) const = 0;
106
107 /**
108 Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise.
109 */
110 virtual bool HasStderr() = 0;
111
112 /**
113 Returns @true if the library was built as wxUniversal.
114 Always returns @false for wxBase-only apps.
115 */
116 virtual bool IsUsingUniversalWidgets() const = 0;
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.
121 Returns @true to suppress subsequent asserts, @false to continue as before.
122 */
123 virtual bool ShowAssertDialog(const wxString& msg) = 0;
124 };
125