File: apptrait.h

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (133 lines) | stat: -rw-r--r-- 5,088 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/////////////////////////////////////////////////////////////////////////////
// Name:        apptrait.h
// Purpose:     interface of wxAppTraits
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxAppTraits

    The wxAppTraits class defines various configurable aspects of a wxApp.
    You can access it using wxApp::GetTraits() function and you can create your
    own wxAppTraits overriding the wxApp::CreateTraits() function.

    Note that wxAppTraits is an abstract class since it contains many
    pure virtual functions.
    In fact, by default, wxWidgets creates a @c wxConsoleAppTraits object for
    console applications (i.e. those applications linked against wxBase library
    only - see the @ref page_libs page) and a @c wxGUIAppTraits object for GUI
    applications.
    Both these classes are derived by wxAppTraits and represent concrete
    implementation of the wxAppTraits interface.

    @library{wxbase}
    @category{cfg}

    @see @ref overview_app, wxApp
*/
class wxAppTraits
{
public:
    /**
        Called by wxWidgets to create the default configuration object for the
        application. The default version creates a registry-based wxRegConfig
        class under MSW and wxFileConfig under all other platforms.

        The wxApp::GetAppName and wxApp::GetVendorName methods are used to
        determine the registry key or file name.
    */
    virtual wxConfigBase* CreateConfig();

    /**
        Used by wxWidgets to create the main event loop used by wxApp::OnRun().

        The default implementation of this method in wxGUIAppTraits returns the
        usual platform-specific GUI event loop. The version in wxConsoleAppTraits
        returns a console-specific event loop which can be used to handle timer
        and socket events in console programs under Unix and MSW or @NULL under
        the other platforms where console event loops are not supported yet.
     */
    virtual wxEventLoopBase *CreateEventLoop() = 0;

    /**
        Creates the global font mapper object used for encodings/charset mapping.
    */
    virtual wxFontMapper* CreateFontMapper() = 0;

    /**
        Creates a wxLog class for the application to use for logging errors.
        The default implementation returns a new wxLogGui class.

        @see wxLog
    */
    virtual wxLog* CreateLogTarget() = 0;

    /**
        Creates the global object used for printing out messages.
    */
    virtual wxMessageOutput* CreateMessageOutput() = 0;

    /**
        Returns the renderer to use for drawing the generic controls (return
        value may be @NULL in which case the default renderer for the current
        platform is used); this is used in GUI mode only and always returns @NULL
        in console.

        @note the returned pointer needs to be deleted by the caller.
    */
    virtual wxRendererNative* CreateRenderer() = 0;

    /**
        This method returns the name of the desktop environment currently
        running in a Unix desktop. Currently only "KDE" or "GNOME" are
        supported and the code uses the X11 session protocol vendor name
        to figure out, which desktop environment is running. The method
        returns an empty string otherwise and on all other platforms.
    */
    virtual wxString GetDesktopEnvironment() const = 0;

    /**
        Returns the wxStandardPaths object for the application.
        It's normally the same for wxBase and wxGUI except in the case of wxMac
        and wxCocoa.

        @note
        The returned reference is to a @c wxStandardPathsBase class but you
        can consider it to be equivalent to wxStandardPaths (which is documented).
    */
    virtual wxStandardPaths& GetStandardPaths();

    /**
        Returns the wxWidgets port ID used by the running program and eventually
        fills the given pointers with the values of the major and minor digits
        of the native toolkit currently used.

        The version numbers returned are thus detected at run-time and not compile-time
        (except when this is not possible e.g. wxMotif).

        E.g. if your program is using wxGTK port this function will return wxPORT_GTK
        and put in given pointers the versions of the GTK library in use.
        See wxPlatformInfo for more details.
    */
    virtual wxPortId GetToolkitVersion(int* major = NULL, int* minor = NULL) const = 0;

    /**
        Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise.
    */
    virtual bool HasStderr() = 0;

    /**
        Returns @true if the library was built as wxUniversal.
        Always returns @false for wxBase-only apps.
    */
    virtual bool IsUsingUniversalWidgets() const = 0;

    /**
        Shows the assert dialog with the specified message in GUI mode or just prints
        the string to stderr in console mode.
        Returns @true to suppress subsequent asserts, @false to continue as before.
    */
    virtual bool ShowAssertDialog(const wxString& msg) = 0;
};