File: apptrait.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (170 lines) | stat: -rw-r--r-- 6,447 bytes parent folder | download | duplicates (2)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/////////////////////////////////////////////////////////////////////////////
// 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;

    /**
        Returns the name of the desktop environment currently running on a Unix
        desktop. It returns an empty string for platforms other than wxGTK, or
        if the desktop environment could not be determined.
    */
    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, minor, and micro
        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.

        If a micro version is not available it will have a value of 0.
    */
    virtual wxPortId GetToolkitVersion(int* major = NULL,
                                       int* minor = NULL,
                                       int* micro = 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;

    /**
        Shows a message box with the given text and title if possible.

        In some ports, e.g. wxMSW, a message box will always be shown, while in
        the other ones it will be only done if the GUI is available (e.g. X11
        display was successfully opened for X11-based ports) and the function
        simply returns @false without doing anything otherwise.

        This function is safe in the sense that it can always be called, even
        before creating wxApp, similarly to wxSafeShowMessage() which is
        implemented by calling this function and then logging the message to
        standard error stream if it returned @false.

        @since 3.1.5

        @param text
            The text to show to the user.
        @param title
            The title of the message box shown to the user.
        @return @true if the message box was shown or @false otherwise.
     */
    virtual bool SafeMessageBox(const wxString& text, const wxString& title) = 0;

    /**
        Helper function mostly useful for derived classes ShowAssertDialog()
        implementation.

        Returns the stack frame as a plain (and possibly empty) wxString.

        This function is only available when @c wxUSE_STACKWALKER is 1.

        @since 3.1.5
     */
    virtual wxString GetAssertStackTrace();
};