wxPlatformInfo (patch 1532064)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-08-13 21:00:32 +00:00
parent 10d878a9ea
commit 8bb6b2c057
38 changed files with 1378 additions and 567 deletions

View File

@@ -13,6 +13,7 @@
#define _WX_APPTRAIT_H_
#include "wx/string.h"
#include "wx/platinfo.h"
class WXDLLIMPEXP_BASE wxObject;
class WXDLLEXPORT wxAppTraits;
@@ -26,24 +27,6 @@ class WXDLLIMPEXP_BASE wxString;
class GSocketGUIFunctionsTable;
// ----------------------------------------------------------------------------
// toolkit information
// ----------------------------------------------------------------------------
// Information about the toolkit that the app is running under (e.g. wxMSW):
struct WXDLLIMPEXP_BASE wxToolkitInfo
{
// Short name of the toolkit (e.g. "msw" or "mswuniv"); empty for console:
wxString shortName;
// Descriptive name of the toolkit, human readable (e.g. "wxMSW" or
// "wxMSW/Universal"); "wxBase" for console apps:
wxString name;
// Version of the underlying toolkit or of the OS for console apps:
int versionMajor, versionMinor;
// OS mnenomics, e.g. wxGTK or wxMSW:
int os;
};
// ----------------------------------------------------------------------------
// wxAppTraits: this class defines various configurable aspects of wxApp
@@ -127,15 +110,10 @@ public:
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0;
#endif
// return information about what toolkit is running; we need for two things
// that are both contained in wxBase:
// - wxGetOsVersion() behaves differently in GUI and non-GUI builds under
// Unix: in the former case it returns the information about the toolkit
// and in the latter -- about the OS, so we need to virtualize it
// - wxDynamicLibrary::CanonicalizePluginName() must embed toolkit
// signature in DLL name
virtual wxToolkitInfo& GetToolkitInfo() = 0;
// return information about the (native) toolkit currently used;
// returns wxPORT_BASE for console applications and one of the remaining
// wxPORT_* values for GUI applications.
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const = 0;
};
// ----------------------------------------------------------------------------
@@ -192,6 +170,17 @@ public:
virtual void ScheduleForDestroy(wxObject *object);
virtual void RemoveFromPendingDelete(wxObject *object);
// the GetToolkitVersion for console application is always the same
wxPortId GetToolkitVersion(int *verMaj, int *verMin) const
{
// no toolkits (wxBase is for console applications without GUI support)
// NB: zero means "no toolkit", -1 means "not initialized yet"
// so we must use zero here!
if (verMaj) *verMaj = 0;
if (verMin) *verMin = 0;
return wxPORT_BASE;
}
};
// ----------------------------------------------------------------------------
@@ -242,16 +231,13 @@ public:
#elif defined(__WXPM__)
#include "wx/os2/apptrait.h"
#else
// at least, we need an implementation of GetToolkitInfo !
#if wxUSE_GUI
class wxGUIAppTraits : public wxGUIAppTraitsBase
{
virtual wxToolkitInfo& GetToolkitInfo();
};
#endif // wxUSE_GUI
class wxConsoleAppTraits: public wxConsoleAppTraitsBase
{
virtual wxToolkitInfo& GetToolkitInfo();
};
#endif // platform