// ----------------------------------------------------------------------------
#include "wx/event.h" // for the base class
-
-#if wxUSE_GUI
- #include "wx/window.h" // for wxTopLevelWindows
-
- #include "wx/vidmode.h"
-#endif // wxUSE_GUI
-
#include "wx/build.h"
#include "wx/init.h" // we must declare wxEntry()
+#include "wx/intl.h" // for wxLayoutDirection
class WXDLLIMPEXP_BASE wxAppConsole;
class WXDLLIMPEXP_BASE wxAppTraits;
#if wxUSE_GUI
class WXDLLEXPORT wxEventLoop;
+ struct WXDLLIMPEXP_CORE wxVideoMode;
#endif
// ----------------------------------------------------------------------------
// allows us to abstract the differences behind the common façade
wxAppTraits *GetTraits();
- // the functions below shouldn't be used now that we have wxAppTraits
-#if WXWIN_COMPATIBILITY_2_4
-
-#if wxUSE_LOG
- // override this function to create default log target of arbitrary
- // user-defined class (default implementation creates a wxLogGui
- // object) -- this log object is used by default by all wxLogXXX()
- // functions.
- wxDEPRECATED( virtual wxLog *CreateLogTarget() );
-#endif // wxUSE_LOG
-
- // similar to CreateLogTarget() but for the global wxMessageOutput
- // object
- wxDEPRECATED( virtual wxMessageOutput *CreateMessageOutput() );
-
-#endif // WXWIN_COMPATIBILITY_2_4
-
// event processing functions
// --------------------------
// debugging support
// -----------------
+#ifdef __WXDEBUG__
// this function is called when an assert failure occurs, the base class
// version does the normal processing (i.e. shows the usual assert failure
// dialog box)
//
- // the arguments are the place where the assert occurred, the text of the
+ // the arguments are the location of the failed assert (func may be empty
+ // if the compiler doesn't support C99 __FUNCTION__), the text of the
// assert itself and the user-specified message
-#ifdef __WXDEBUG__
+ virtual void OnAssertFailure(const wxChar *file,
+ int line,
+ const wxChar *func,
+ const wxChar *cond,
+ const wxChar *msg);
+
+ // old version of the function without func parameter, for compatibility
+ // only, override OnAssertFailure() in the new code
virtual void OnAssert(const wxChar *file,
int line,
const wxChar *cond,
// options of the library and abort if it doesn't
static bool CheckBuildOptions(const char *optionsSignature,
const char *componentName);
-#if WXWIN_COMPATIBILITY_2_4
- wxDEPRECATED( static bool CheckBuildOptions(const wxBuildOptions& buildOptions) );
-#endif
// implementation only from now on
// -------------------------------
// return the "main" top level window (if it hadn't been set previously
// with SetTopWindow(), will return just some top level window and, if
// there are none, will return NULL)
- virtual wxWindow *GetTopWindow() const
- {
- if (m_topWindow)
- return m_topWindow;
- else if (wxTopLevelWindows.GetCount() > 0)
- return wxTopLevelWindows.GetFirst()->GetData();
- else
- return (wxWindow *)NULL;
- }
+ virtual wxWindow *GetTopWindow() const;
// control the exit behaviour: by default, the program will exit the
// main loop (and so, usually, terminate) when the last top-level
// ------------------------------------------------------------------------
// Get display mode that is used use. This is only used in framebuffer
- // wxWin ports (such as wxMGL).
- virtual wxVideoMode GetDisplayMode() const { return wxVideoMode(); }
+ // wxWin ports (such as wxMGL or wxDFB).
+ virtual wxVideoMode GetDisplayMode() const;
// Set display mode to use. This is only used in framebuffer wxWin
- // ports (such as wxMGL). This method should be called from
+ // ports (such as wxMGL or wxDFB). This method should be called from
// wxApp::OnInitGui
virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; }
// set use of best visual flag (see below)
- void SetUseBestVisual( bool flag ) { m_useBestVisual = flag; }
+ void SetUseBestVisual( bool flag, bool forceTrueColour = false )
+ { m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; }
bool GetUseBestVisual() const { return m_useBestVisual; }
// set/get printing mode: see wxPRINT_XXX constants.
virtual void SetPrintMode(int WXUNUSED(mode)) { }
int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
+ // Return the layout direction for the current locale or wxLayout_Default
+ // if it's unknown
+ virtual wxLayoutDirection GetLayoutDirection() const;
+
// command line parsing (GUI-specific)
// ------------------------------------------------------------------------
// deactivated
virtual void SetActive(bool isActive, wxWindow *lastFocus);
+#if WXWIN_COMPATIBILITY_2_6
// OBSOLETE: don't use, always returns true
//
// returns true if the program is successfully initialized
- bool Initialized() { return true; }
+ wxDEPRECATED( bool Initialized() );
+#endif // WXWIN_COMPATIBILITY_2_6
// perform standard OnIdle behaviour, ensure that this is always called
void OnIdle(wxIdleEvent& event);
// true if the app wants to use the best visual on systems where
// more than one are available (Sun, SGI, XFree86 4.0 ?)
bool m_useBestVisual;
+ // force TrueColour just in case "best" isn't TrueColour
+ bool m_forceTrueColour;
// does any of our windows have focus?
bool m_isActive;
DECLARE_NO_COPY_CLASS(wxAppBase)
};
+#if WXWIN_COMPATIBILITY_2_6
+ inline bool wxAppBase::Initialized() { return true; }
+#endif // WXWIN_COMPATIBILITY_2_6
+
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
#include "wx/motif/app.h"
#elif defined(__WXMGL__)
#include "wx/mgl/app.h"
- #elif defined(__WXGTK__)
+ #elif defined(__WXDFB__)
+ #include "wx/dfb/app.h"
+ #elif defined(__WXGTK20__)
#include "wx/gtk/app.h"
+ #elif defined(__WXGTK__)
+ #include "wx/gtk1/app.h"
#elif defined(__WXX11__)
#include "wx/x11/app.h"
#elif defined(__WXMAC__)
//
// the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in
// console mode it does nothing at all
-#define wxTheApp ((wxApp *)wxApp::GetInstance())
+#define wxTheApp wx_static_cast(wxApp*, wxApp::GetInstance())
// ----------------------------------------------------------------------------
// global functions
#ifdef __WXUNIVERSAL__
#include "wx/univ/theme.h"
- #define IMPLEMENT_WX_THEME_SUPPORT \
- WX_USE_THEME(win32); \
- WX_USE_THEME(gtk);
+ #ifdef wxUNIV_DEFAULT_THEME
+ #define IMPLEMENT_WX_THEME_SUPPORT \
+ WX_USE_THEME(wxUNIV_DEFAULT_THEME);
+ #else
+ #define IMPLEMENT_WX_THEME_SUPPORT
+ #endif
#else
#define IMPLEMENT_WX_THEME_SUPPORT
#endif
wxAppInitializer \
wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
DECLARE_APP(appname) \
- appname& wxGetApp() { return *(appname *)wxTheApp; }
+ appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); }
// Same as IMPLEMENT_APP() normally but doesn't include themes support in
// wxUniversal builds
extern wxAppInitializer wxTheAppInitializer;
#endif // _WX_APP_H_BASE_
-