#include </home/zeitlin/src/wx/github/interface/wx/app.h>
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).
Event macros for events emitted by this class:
wxEVT_ACTIVATE_APP
event. See wxActivateEvent. wxEVT_IDLE
event. See wxIdleEvent. 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 wxWindow * | GetTopWindow () 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. |
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.
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.
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.
bool wxApp::GetUseBestVisual | ( | ) | const |
Returns true if the application will use the best visual on systems that support different visuals, false otherwise.
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.
virtual void wxApp::MacOpenFile | ( | const wxString & | fileName | ) | [virtual] |
Called in response of an "open-document" Apple event.
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.
virtual void wxApp::MacOpenURL | ( | const wxString & | url | ) | [virtual] |
Called in response of a "get-url" Apple event.
virtual void wxApp::MacPrintFile | ( | const wxString & | fileName | ) | [virtual] |
Called in response of a "print-document" Apple event.
virtual void wxApp::MacReopenApp | ( | ) | [virtual] |
Called in response of a "reopen-application" Apple event.
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); }
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.
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.
flag | If true (the default), the application will exit when the top-level frame is deleted. If false, the application will continue to run. |
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.
theme | The 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
wxApp::SetTopWindow(NULL)
window | The new top window. |
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.
flag | If true, the app will use the best visual. |
forceTrueColour | If true then the application will try to force using a TrueColour visual and abort the app if none is found. |