/////////////////////////////////////////////////////////////////////////////
-// Name: utils.h
+// Name: wx/utils.h
// Purpose: Miscellaneous utilities
// Author: Julian Smart
// Modified by:
// wxLongLong
#include "wx/longlong.h"
-#ifdef __X__
+#ifdef __WATCOMC__
+ #include <direct.h>
+#elif defined(__X__)
#include <dirent.h>
#include <unistd.h>
#endif
#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
-// wxGetFreeMemory can return huge amount of memory on 64-bit platforms
-// define wxMemorySize according to the type which best fits your platform
-#if wxUSE_LONGLONG && defined(__WIN64__)
- // 64 bit Windowses have sizeof(long) only 32 bit long
- // we need to use wxLongLong to express memory sizes
- #define wxMemorySize wxLongLong
+// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well
+// so to always use long long for its result type on all platforms which
+// support it
+#if wxUSE_LONGLONG
+ typedef wxLongLong wxMemorySize;
#else
- // 64 bit UNIX has sizeof(long) = 64
- // assume 32 bit platforms cannnot return more than 32bits of
- #define wxMemorySize long
+ typedef long wxMemorySize;
#endif
// ----------------------------------------------------------------------------
// in wxMSW.
WXDLLEXPORT bool wxSetDetectableAutoRepeat( bool flag );
+
+// wxMouseState is used to hold information about button and modifier state
+// and is what is returned from wxGetMouseState.
+class WXDLLEXPORT wxMouseState
+{
+public:
+ wxMouseState()
+ : m_x(0), m_y(0),
+ m_leftDown(false), m_middleDown(false), m_rightDown(false),
+ m_controlDown(false), m_shiftDown(false), m_altDown(false),
+ m_metaDown(false)
+ {}
+
+ wxCoord GetX() { return m_x; }
+ wxCoord GetY() { return m_y; }
+
+ bool LeftDown() { return m_leftDown; }
+ bool MiddleDown() { return m_middleDown; }
+ bool RightDown() { return m_rightDown; }
+
+ bool ControlDown() { return m_controlDown; }
+ bool ShiftDown() { return m_shiftDown; }
+ bool AltDown() { return m_altDown; }
+ bool MetaDown() { return m_metaDown; }
+ bool CmdDown()
+ {
+#if defined(__WXMAC__) || defined(__WXCOCOA__)
+ return MetaDown();
+#else
+ return ControlDown();
+#endif
+ }
+
+ void SetX(wxCoord x) { m_x = x; }
+ void SetY(wxCoord y) { m_y = y; }
+
+ void SetLeftDown(bool down) { m_leftDown = down; }
+ void SetMiddleDown(bool down) { m_middleDown = down; }
+ void SetRightDown(bool down) { m_rightDown = down; }
+
+ void SetControlDown(bool down) { m_controlDown = down; }
+ void SetShiftDown(bool down) { m_shiftDown = down; }
+ void SetAltDown(bool down) { m_altDown = down; }
+ void SetMetaDown(bool down) { m_metaDown = down; }
+
+private:
+ wxCoord m_x;
+ wxCoord m_y;
+
+ bool m_leftDown;
+ bool m_middleDown;
+ bool m_rightDown;
+
+ bool m_controlDown;
+ bool m_shiftDown;
+ bool m_altDown;
+ bool m_metaDown;
+};
+
+
+// Returns the current state of the mouse position, buttons and modifers
+WXDLLEXPORT wxMouseState wxGetMouseState();
+
+
// ----------------------------------------------------------------------------
// Window ID management
// ----------------------------------------------------------------------------
wxArrayString& error,
int flags = 0);
-#ifdef __WXMSW__
+#if defined(__WXMSW__) && wxUSE_IPC
// ask a DDE server to execute the DDE request with given parameters
WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer,
const wxString& ddeTopic,
const wxString& ddeCommand);
-#endif // __WXMSW__
+#endif // __WXMSW__ && wxUSE_IPC
enum wxSignal
{
#endif // wxUSE_ON_FATAL_EXCEPTION
-#if wxABI_VERSION >= 20601
-
// flags for wxLaunchDefaultBrowser
enum
{
// Launch url in the user's default internet browser
WXDLLIMPEXP_BASE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0);
-#endif
// ----------------------------------------------------------------------------
// Environment variables
// Error message functions used by wxWidgets (deprecated, use wxLog)
// ----------------------------------------------------------------------------
-#if WXWIN_COMPATIBILITY_2_2
-
-// Format a message on the standard error (UNIX) or the debugging
-// stream (Windows)
-wxDEPRECATED( WXDLLIMPEXP_BASE void wxDebugMsg(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1 );
-
-// Non-fatal error (continues)
-extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxInternalErrorStr;
-wxDEPRECATED( WXDLLIMPEXP_BASE void wxError(const wxString& msg, const wxString& title = wxInternalErrorStr) );
-
-// Fatal error (exits)
-extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFatalErrorStr;
-wxDEPRECATED( WXDLLIMPEXP_BASE void wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr) );
-
-#endif // WXWIN_COMPATIBILITY_2_2
-
#endif
// _WX_UTILSH__