Version: 2.9.4
Public Member Functions

#include </home/zeitlin/src/wx/github/interface/wx/app.h>

Inheritance diagram for wxApp:

Detailed Description

The wxApp class represents the application itself when wxUSE_GUI=1.

In addition to the features provided by wxAppConsole it keeps track of the top window (see SetTopWindow()) and adds support for video modes (see SetVideoMode()).

In general, application-wide settings for GUI-only apps are accessible from wxApp (or from wxSystemSettings or wxSystemOptions classes).

Events emitted by this class

Event macros for events emitted by this class:

Library:  wxBase
Category:  Application and Process Management
参照:
wxApp Overview, wxAppTraits, wxEventLoopBase, wxSystemSettings

Public Member Functions

 wxApp ()
 Constructor.
virtual ~wxApp ()
 Destructor.
virtual wxVideoMode GetDisplayMode () const
 Get display mode that is used use.
bool GetExitOnFrameDelete () const
 Returns true if the application will exit when the top-level frame is deleted.
virtual wxLayoutDirection GetLayoutDirection () const
 Return the layout direction for the current locale or wxLayout_Default if it's unknown.
bool GetUseBestVisual () const
 Returns true if the application will use the best visual on systems that support different visuals, false otherwise.
virtual wxWindowGetTopWindow () const
 Returns a pointer to the top window.
virtual bool IsActive () const
 Returns true if the application is active, i.e.
virtual bool SafeYield (wxWindow *win, bool onlyIfNeeded)
 This function is similar to wxYield(), except that it disables the user input to all program windows before calling wxAppConsole::Yield and re-enables it again afterwards.
virtual bool SafeYieldFor (wxWindow *win, long eventsToProcess)
 Works like SafeYield() with onlyIfNeeded == true except that it allows the caller to specify a mask of events to be processed.
bool ProcessMessage (WXMSG *msg)
 Windows-only function for processing a message.
virtual bool SetDisplayMode (const wxVideoMode &info)
 Set display mode to use.
void SetExitOnFrameDelete (bool flag)
 Allows the programmer to specify whether the application will exit when the top-level frame is deleted.
virtual bool SetNativeTheme (const wxString &theme)
 Allows runtime switching of the UI environment theme.
void SetTopWindow (wxWindow *window)
 Sets the 'top' window.
void SetUseBestVisual (bool flag, bool forceTrueColour=false)
 Allows the programmer to specify whether the application will use the best visual on systems that support several visual on the same display.
Mac-specific functions
virtual void MacNewFile ()
 Called in response of an "open-application" Apple event.
virtual void MacOpenFiles (const wxArrayString &fileNames)
 Called in response of an openFiles message with Cocoa, or an "open-document" Apple event with Carbon.
virtual void MacOpenFile (const wxString &fileName)
 Called in response of an "open-document" Apple event.
virtual void MacOpenURL (const wxString &url)
 Called in response of a "get-url" Apple event.
virtual void MacPrintFile (const wxString &fileName)
 Called in response of a "print-document" Apple event.
virtual void MacReopenApp ()
 Called in response of a "reopen-application" Apple event.

List of all members.


Constructor & Destructor Documentation

wxApp::wxApp ( )

Constructor.

Called implicitly with a definition of a wxApp object.

virtual wxApp::~wxApp ( ) [virtual]

Destructor.

Will be called implicitly on program exit if the wxApp object is created on the stack.


Member Function Documentation

virtual wxVideoMode wxApp::GetDisplayMode ( ) const [virtual]

Get display mode that is used use.

This is only used in framebuffer wxWidgets ports such as wxDFB.

bool wxApp::GetExitOnFrameDelete ( ) const

Returns true if the application will exit when the top-level frame is deleted.

参照:
SetExitOnFrameDelete()
virtual wxLayoutDirection wxApp::GetLayoutDirection ( ) const [virtual]

Return the layout direction for the current locale or wxLayout_Default if it's unknown.

virtual wxWindow* wxApp::GetTopWindow ( ) const [virtual]

Returns a pointer to the top window.

注意:
If the top window hasn't been set using SetTopWindow(), this function will find the first top-level window (frame or dialog or instance of wxTopLevelWindow) from the internal top level window list and return that.
参照:
SetTopWindow()
bool wxApp::GetUseBestVisual ( ) const

Returns true if the application will use the best visual on systems that support different visuals, false otherwise.

参照:
SetUseBestVisual()
virtual bool wxApp::IsActive ( ) const [virtual]

Returns true if the application is active, i.e.

if one of its windows is currently in the foreground.

If this function returns false and you need to attract users attention to the application, you may use wxTopLevelWindow::RequestUserAttention to do it.

virtual void wxApp::MacNewFile ( ) [virtual]

Called in response of an "open-application" Apple event.

Override this to create a new document in your app.

Availability:  only available for the wxOSX port.
virtual void wxApp::MacOpenFile ( const wxString fileName) [virtual]

Called in response of an "open-document" Apple event.

Deprecated:
This function is kept mostly for backwards compatibility. Please override wxApp::MacOpenFiles method instead in any new code.
Availability:  only available for the wxOSX port.
virtual void wxApp::MacOpenFiles ( const wxArrayString fileNames) [virtual]

Called in response of an openFiles message with Cocoa, or an "open-document" Apple event with Carbon.

You need to override this method in order to open one or more document files after the user double clicked on it or if the files and/or folders were dropped on either the application in the dock or the application icon in Finder.

By default this method calls MacOpenFile for each file/folder.

Availability:  only available for the wxOSX port.
Since:
2.9.3
virtual void wxApp::MacOpenURL ( const wxString url) [virtual]

Called in response of a "get-url" Apple event.

Availability:  only available for the wxOSX port.
virtual void wxApp::MacPrintFile ( const wxString fileName) [virtual]

Called in response of a "print-document" Apple event.

Availability:  only available for the wxOSX port.
virtual void wxApp::MacReopenApp ( ) [virtual]

Called in response of a "reopen-application" Apple event.

Availability:  only available for the wxOSX port.
bool wxApp::ProcessMessage ( WXMSG *  msg)

Windows-only function for processing a message.

This function is called from the main message loop, checking for windows that may wish to process it.

The function returns true if the message was processed, false otherwise. If you use wxWidgets with another class library with its own message loop, you should make sure that this function is called to allow wxWidgets to receive messages. For example, to allow co-existence with the Microsoft Foundation Classes, override the PreTranslateMessage function:

        // Provide wxWidgets message loop compatibility
        BOOL CTheApp::PreTranslateMessage(MSG *msg)
        {
            if (wxTheApp && wxTheApp->ProcessMessage((WXMSW *)msg))
                return true;
            else
                return CWinApp::PreTranslateMessage(msg);
        }
Availability:  only available for the wxMSW port.
virtual bool wxApp::SafeYield ( wxWindow win,
bool  onlyIfNeeded 
) [virtual]

This function is similar to wxYield(), except that it disables the user input to all program windows before calling wxAppConsole::Yield and re-enables it again afterwards.

If win is not NULL, this window will remain enabled, allowing the implementation of some limited user interaction. Returns the result of the call to wxAppConsole::Yield.

参照:
wxSafeYield
virtual bool wxApp::SafeYieldFor ( wxWindow win,
long  eventsToProcess 
) [virtual]

Works like SafeYield() with onlyIfNeeded == true except that it allows the caller to specify a mask of events to be processed.

See wxAppConsole::YieldFor for more info.

virtual bool wxApp::SetDisplayMode ( const wxVideoMode info) [virtual]

Set display mode to use.

This is only used in framebuffer wxWidgets ports such as wxDFB.

void wxApp::SetExitOnFrameDelete ( bool  flag)

Allows the programmer to specify whether the application will exit when the top-level frame is deleted.

Parameters:
flagIf true (the default), the application will exit when the top-level frame is deleted. If false, the application will continue to run.
参照:
GetExitOnFrameDelete(), Application Shutdown
virtual bool wxApp::SetNativeTheme ( const wxString theme) [virtual]

Allows runtime switching of the UI environment theme.

Currently implemented for wxGTK2-only. Return true if theme was successfully changed.

Parameters:
themeThe name of the new theme or an absolute path to a gtkrc-theme-file
void wxApp::SetTopWindow ( wxWindow window)

Sets the 'top' window.

You can call this from within OnInit() to let wxWidgets know which is the main window. You don't have to set the top window; it is only a convenience so that (for example) certain dialogs without parents can use a specific window as the top window.

If no top window is specified by the application, wxWidgets just uses the first frame or dialog (or better, any wxTopLevelWindow) in its top-level window list, when it needs to use the top window. If you previously called SetTopWindow() and now you need to restore this automatic behaviour you can call

Parameters:
windowThe new top window.
参照:
GetTopWindow(), OnInit()
void wxApp::SetUseBestVisual ( bool  flag,
bool  forceTrueColour = false 
)

Allows the programmer to specify whether the application will use the best visual on systems that support several visual on the same display.

This is typically the case under Solaris and IRIX, where the default visual is only 8-bit whereas certain applications are supposed to run in TrueColour mode.

Note that this function has to be called in the constructor of the wxApp instance and won't have any effect when called later on. This function currently only has effect under GTK.

Parameters:
flagIf true, the app will use the best visual.
forceTrueColourIf true then the application will try to force using a TrueColour visual and abort the app if none is found.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines