X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/25a9f2912d37473bdddfd8bc07618c8530440363..f2a1b1bd23ef03bcfb17c7d2894f4982d8553709:/include/wx/utils.h diff --git a/include/wx/utils.h b/include/wx/utils.h index 40305e4044..ac8d98e01d 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -30,6 +30,9 @@ class WXDLLIMPEXP_BASE wxArrayInt; // wxLongLong #include "wx/longlong.h" +// need for wxOperatingSystemId +#include "wx/platinfo.h" + #ifdef __WATCOMC__ #include #elif defined(__X__) @@ -69,11 +72,6 @@ class WXDLLIMPEXP_CORE wxWindowList; // String functions (deprecated, use wxString) // ---------------------------------------------------------------------------- -// Make a copy of this string using 'new' -#if WXWIN_COMPATIBILITY_2_4 -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s) ); -#endif - // A shorter way of using strcmp #define wxStringEq(s1, s2) (s1 && s2 && (wxStrcmp(s1, s2) == 0)) @@ -93,8 +91,14 @@ WXDLLIMPEXP_BASE void wxBell(); WXDLLIMPEXP_BASE wxString wxGetOsDescription(); // Get OS version -WXDLLIMPEXP_BASE int wxGetOsVersion(int *majorVsn = (int *) NULL, - int *minorVsn = (int *) NULL); +WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = (int *) NULL, + int *minorVsn = (int *) NULL); + +// Get platform endianness +WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); + +// Get platform architecture +WXDLLIMPEXP_BASE bool wxIsPlatform64Bit(); // Return a string with the current date/time WXDLLIMPEXP_BASE wxString wxNow(); @@ -167,7 +171,7 @@ public: operator int() const { return (int) GetInteger(); } operator long() const { return GetInteger(); } operator double() const { return GetDouble(); } - operator const wxString() const { return GetString(); } + operator const wxString&() const { return GetString(); } operator const wxChar*() const { return (const wxChar*) GetString(); } static void AddPlatform(int platform); @@ -249,14 +253,14 @@ private: wxCoord m_x; wxCoord m_y; - bool m_leftDown; - bool m_middleDown; - bool m_rightDown; + bool m_leftDown : 1; + bool m_middleDown : 1; + bool m_rightDown : 1; - bool m_controlDown; - bool m_shiftDown; - bool m_altDown; - bool m_metaDown; + bool m_controlDown : 1; + bool m_shiftDown : 1; + bool m_altDown : 1; + bool m_metaDown : 1; }; @@ -283,23 +287,6 @@ WXDLLEXPORT long wxGetCurrentId(); // Various conversions // ---------------------------------------------------------------------------- -// these functions are deprecated, use wxString methods instead! -#if WXWIN_COMPATIBILITY_2_4 - -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFloatToStringStr; -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDoubleToStringStr; - -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToFloat(const wxChar *s, float *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* FloatToString(float number, const wxChar *fmt = wxFloatToStringStr) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToDouble(const wxChar *s, double *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* DoubleToString(double number, const wxChar *fmt = wxDoubleToStringStr) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToInt(const wxChar *s, int *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToLong(const wxChar *s, long *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* IntToString(int number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* LongToString(long number) ); - -#endif // WXWIN_COMPATIBILITY_2_4 - // Convert 2-digit hex number to decimal WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf); @@ -412,26 +399,6 @@ enum wxShutdownFlags // Shutdown or reboot the PC WXDLLIMPEXP_BASE bool wxShutdown(wxShutdownFlags wFlags); -enum wxPowerType -{ - wxPOWER_SOCKET, - wxPOWER_BATTERY, - wxPOWER_UNKNOWN -}; - -WXDLLIMPEXP_BASE wxPowerType wxGetPowerType(); - -enum wxBatteryState -{ - wxBATTERY_NORMAL_STATE, // system is fully usable - wxBATTERY_LOW_STATE, // start to worry - wxBATTERY_CRITICAL_STATE, // save quickly - wxBATTERY_SHUTDOWN_STATE, // too late - wxBATTERY_UNKNOWN_STATE -}; - -WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState(); - // send the given signal to the process (only NONE and KILL are supported under // Windows, all others mean TERM), return 0 if ok and -1 on error // @@ -529,7 +496,7 @@ WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr); // Get the user's home dir (caller must copy --- volatile) // returns NULL is no HOME dir is known -#if defined(__UNIX__) && wxUSE_UNICODE +#if defined(__UNIX__) && wxUSE_UNICODE && !defined(__WINE__) WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptyString); #else WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString); @@ -552,14 +519,40 @@ WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, // Menu accelerators related things // ---------------------------------------------------------------------------- -WXDLLEXPORT wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = (wxChar *) NULL); -WXDLLEXPORT wxString wxStripMenuCodes(const wxString& str); +// flags for wxStripMenuCodes +enum +{ + // strip '&' characters + wxStrip_Mnemonics = 1, + + // strip everything after '\t' + wxStrip_Accel = 2, + + // strip everything (this is the default) + wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel +}; + +// strip mnemonics and/or accelerators from the label +WXDLLEXPORT wxString +wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); + +#if WXWIN_COMPATIBILITY_2_6 +// obsolete and deprecated version, do not use, use the above overload instead +wxDEPRECATED( + WXDLLEXPORT wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL) +); #if wxUSE_ACCEL class WXDLLEXPORT wxAcceleratorEntry; -WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label); + +// use wxAcceleratorEntry::Create() or FromString() methods instead +wxDEPRECATED( + WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) +); #endif // wxUSE_ACCEL +#endif // WXWIN_COMPATIBILITY_2_6 + // ---------------------------------------------------------------------------- // Window search // ----------------------------------------------------------------------------