]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/apptrait.h
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     interface of wxAppTraits 
   4 // Author:      wxWidgets team 
   6 // Licence:     wxWindows license 
   7 ///////////////////////////////////////////////////////////////////////////// 
  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. 
  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 
  22     Both these classes are derived by wxAppTraits and represent concrete 
  23     implementation of the wxAppTraits interface. 
  26     @category{appmanagement} 
  28     @see @ref overview_app, wxApp 
  34         Called by wxWidgets to create the default configuration object for the 
  35         application. The default version creates a registry-based wxRegConfig 
  36         class under MSW and wxFileConfig under all other platforms. 
  38         The wxApp::GetAppName and wxApp::GetVendorName methods are used to 
  39         determine the registry key or file name. 
  41     virtual wxConfigBase
* CreateConfig(); 
  44         Used by wxWidgets to create the main event loop used by wxApp::OnRun(). 
  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. 
  52     virtual wxEventLoopBase 
*CreateEventLoop() = 0; 
  55         Creates the global font mapper object used for encodings/charset mapping. 
  57     virtual wxFontMapper
* CreateFontMapper() = 0; 
  60         Creates a wxLog class for the application to use for logging errors. 
  61         The default implementation returns a new wxLogGui class. 
  65     virtual wxLog
* CreateLogTarget() = 0; 
  68         Creates the global object used for printing out messages. 
  70     virtual wxMessageOutput
* CreateMessageOutput() = 0; 
  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 
  78         @note the returned pointer needs to be deleted by the caller. 
  80     virtual wxRendererNative
* CreateRenderer() = 0; 
  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. 
  89     virtual wxString 
GetDesktopEnvironment() const = 0; 
  92         Returns the wxStandardPaths object for the application. 
  93         It's normally the same for wxBase and wxGUI except in the case of wxMac 
  96         @todo the real function returns a reference to wxStandardPathsBase; 
  97               user looking at these docs will write code: 
  98                     wxStandardPaths &ref = ...->GetStandardPaths(); 
  99               which won't compile... 
 101     virtual wxStandardPaths
& GetStandardPaths(); 
 104         Returns the wxWidgets port ID used by the running program and eventually 
 105         fills the given pointers with the values of the major and minor digits 
 106         of the native toolkit currently used. 
 108         The version numbers returned are thus detected at run-time and not compile-time 
 109         (except when this is not possible e.g. wxMotif). 
 111         E.g. if your program is using wxGTK port this function will return wxPORT_GTK 
 112         and put in given pointers the versions of the GTK library in use. 
 113         See wxPlatformInfo for more details. 
 115     virtual wxPortId 
GetToolkitVersion(int* major 
= NULL
, int* minor 
= NULL
) const = 0; 
 118         Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise. 
 120     virtual bool HasStderr() = 0; 
 123         Returns @true if the library was built as wxUniversal. 
 124         Always returns @false for wxBase-only apps. 
 126     virtual bool IsUsingUniversalWidgets() const = 0; 
 129         Shows the assert dialog with the specified message in GUI mode or just prints 
 130         the string to stderr in console mode. 
 131         Returns @true to suppress subsequent asserts, @false to continue as before. 
 133     virtual bool ShowAssertDialog(const wxString
& msg
) = 0;