X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e0977894a66f5b3227d2864becaeae86a5e93c8..aaf5f98682223a5ceb3496e7a25865ad791e8ab7:/include/wx/utils.h diff --git a/include/wx/utils.h b/include/wx/utils.h index 3463946de1..38c59e5f6a 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -32,7 +32,7 @@ class WXDLLIMPEXP_FWD_BASE wxArrayInt; // wxLongLong #include "wx/longlong.h" -// need for wxOperatingSystemId +// needed for wxOperatingSystemId, wxLinuxDistributionInfo #include "wx/platinfo.h" #ifdef __WATCOMC__ @@ -74,8 +74,17 @@ class WXDLLIMPEXP_FWD_CORE wxWindowList; // String functions (deprecated, use wxString) // ---------------------------------------------------------------------------- +#ifdef WXWIN_COMPATIBILITY_2_8 // A shorter way of using strcmp -#define wxStringEq(s1, s2) (s1 && s2 && (wxStrcmp(s1, s2) == 0)) +wxDEPRECATED_INLINE(inline bool wxStringEq(const char *s1, const char *s2), + return wxCRT_StrcmpA(s1, s2) == 0; ) + +#if wxUSE_UNICODE +wxDEPRECATED_INLINE(inline bool wxStringEq(const wchar_t *s1, const wchar_t *s2), + return wxCRT_StrcmpW(s1, s2) == 0; ) +#endif // wxUSE_UNICODE + +#endif // WXWIN_COMPATIBILITY_2_8 // ---------------------------------------------------------------------------- // Miscellaneous functions @@ -98,8 +107,8 @@ WXDLLIMPEXP_CORE void wxInfoMessageBox(wxWindow* parent); WXDLLIMPEXP_BASE wxString wxGetOsDescription(); // Get OS version -WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = (int *) NULL, - int *minorVsn = (int *) NULL); +WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = NULL, + int *minorVsn = NULL); // Get platform endianness WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); @@ -107,6 +116,11 @@ WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); // Get platform architecture WXDLLIMPEXP_BASE bool wxIsPlatform64Bit(); +#ifdef __LINUX__ +// Get linux-distro informations +WXDLLIMPEXP_BASE wxLinuxDistributionInfo wxGetLinuxDistributionInfo(); +#endif + // Return a string with the current date/time WXDLLIMPEXP_BASE wxString wxNow(); @@ -115,6 +129,27 @@ WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix(); // Return path to wxWin data (/usr/share/wx/%{version}) (Unices) WXDLLIMPEXP_BASE wxString wxGetDataDir(); +#if wxUSE_GUI + +// Get the state of a key (true if pressed, false if not) +// This is generally most useful getting the state of +// the modifier or toggle keys. +WXDLLIMPEXP_CORE bool wxGetKeyState(wxKeyCode key); + +// Don't synthesize KeyUp events holding down a key and producing +// KeyDown events with autorepeat. On by default and always on +// in wxMSW. +WXDLLIMPEXP_CORE bool wxSetDetectableAutoRepeat( bool flag ); + +// Returns the current state of the mouse position, buttons and modifers +WXDLLIMPEXP_CORE wxMouseState wxGetMouseState(); + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxPlatform +// ---------------------------------------------------------------------------- + /* * Class to make it easier to specify platform-dependent values * @@ -197,24 +232,6 @@ private: /// Function for testing current platform inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); } -#if wxUSE_GUI - -// Get the state of a key (true if pressed, false if not) -// This is generally most useful getting the state of -// the modifier or toggle keys. -WXDLLIMPEXP_CORE bool wxGetKeyState(wxKeyCode key); - - -// Don't synthesize KeyUp events holding down a key and producing -// KeyDown events with autorepeat. On by default and always on -// in wxMSW. -WXDLLIMPEXP_CORE bool wxSetDetectableAutoRepeat( bool flag ); - -// Returns the current state of the mouse position, buttons and modifers -WXDLLIMPEXP_CORE wxMouseState wxGetMouseState(); - -#endif // wxUSE_GUI - // ---------------------------------------------------------------------------- // Window ID management // ---------------------------------------------------------------------------- @@ -388,8 +405,10 @@ WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds); // Sleep for a given amount of microseconds WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds); +#if WXWIN_COMPATIBILITY_2_8 // Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) ); +#endif // Get the process id of the current process WXDLLIMPEXP_BASE unsigned long wxGetProcessId(); @@ -424,7 +443,7 @@ inline bool wxSetEnv(const wxString& var, const char *value) inline bool wxSetEnv(const wxString& var, const wchar_t *value) { return wxSetEnv(var, wxString(value)); } template -inline bool wxSetEnv(const wxString& var, const wxCharTypeBuffer& value) +inline bool wxSetEnv(const wxString& var, const wxScopedCharTypeBuffer& value) { return wxSetEnv(var, wxString(value)); } inline bool wxSetEnv(const wxString& var, const wxCStrData& value) { return wxSetEnv(var, wxString(value)); } @@ -573,12 +592,12 @@ WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt); // Find the window/widget with the given title or label. // Pass a parent to begin the search from, or NULL to look through // all windows. -WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = (wxWindow *) NULL); +WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = NULL); // NB: this function is obsolete, use wxWindow::FindWindowByName() instead // // Find window by name, and if that fails, by label. -WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = (wxWindow *) NULL); +WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = NULL); // ---------------------------------------------------------------------------- // Message/event queue helpers @@ -620,7 +639,7 @@ private: wxWindowList *m_winDisabled; bool m_disabled; - DECLARE_NO_COPY_CLASS(wxWindowDisabler) + wxDECLARE_NO_COPY_CLASS(wxWindowDisabler); }; // ---------------------------------------------------------------------------- @@ -660,7 +679,7 @@ void WXDLLIMPEXP_CORE wxGetMousePosition( int* x, int* y ); // Returns NULL or newly-allocated memory, so use delete[] to clean up. #ifdef __WXMSW__ extern WXDLLIMPEXP_CORE const wxChar* wxUserResourceStr; - WXDLLIMPEXP_CORE wxChar* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr); + WXDLLIMPEXP_CORE char* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr, int* pLen = NULL); #endif // MSW // ---------------------------------------------------------------------------- @@ -699,16 +718,12 @@ inline struct _XDisplay *wxGetX11Display() #define wx_YIELD_DECLARED // Yield to other apps/messages -WXDLLIMPEXP_BASE bool wxYield(); +WXDLLIMPEXP_CORE bool wxYield(); #endif // wx_YIELD_DECLARED // Like wxYield, but fails silently if the yield is recursive. -WXDLLIMPEXP_BASE bool wxYieldIfNeeded(); - -// ---------------------------------------------------------------------------- -// Error message functions used by wxWidgets (deprecated, use wxLog) -// ---------------------------------------------------------------------------- +WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); #endif // _WX_UTILSH__