#include "wx/object.h"
#include "wx/list.h"
#include "wx/filefn.h"
+#if wxUSE_GUI
+ #include "wx/gdicmn.h"
+#endif
class WXDLLIMPEXP_BASE wxArrayString;
+class WXDLLIMPEXP_BASE wxArrayInt;
// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare
// wxLongLong
class WXDLLIMPEXP_CORE wxFrame;
class WXDLLIMPEXP_CORE wxWindow;
class WXDLLIMPEXP_CORE wxWindowList;
-class WXDLLIMPEXP_CORE wxPoint;
// ----------------------------------------------------------------------------
// Macros
// Return path to wxWin data (/usr/share/wx/%{version}) (Unices)
WXDLLIMPEXP_BASE wxString wxGetDataDir();
+/*
+ * Class to make it easier to specify platform-dependent values
+ *
+ * Examples:
+ * long val = wxPlatform::If(wxMac, 1).ElseIf(wxGTK, 2).ElseIf(stPDA, 5).Else(3);
+ * wxString strVal = wxPlatform::If(wxMac, wxT("Mac")).ElseIf(wxMSW, wxT("MSW")).Else(wxT("Other"));
+ *
+ * A custom platform symbol:
+ *
+ * #define stPDA 100
+ * #ifdef __WXWINCE__
+ * wxPlatform::AddPlatform(stPDA);
+ * #endif
+ *
+ * long windowStyle = wxCAPTION | (long) wxPlatform::IfNot(stPDA, wxRESIZE_BORDER);
+ *
+ */
+
+class WXDLLIMPEXP_BASE wxPlatform
+{
+public:
+ wxPlatform() { Init(); }
+ wxPlatform(const wxPlatform& platform) { Copy(platform); }
+ void operator = (const wxPlatform& platform) { Copy(platform); }
+ void Copy(const wxPlatform& platform);
+ void Init() { m_longValue = 0; m_doubleValue = 0.0; }
+
+ // Specify an optional default value
+ wxPlatform(long defValue) { m_longValue = defValue; m_doubleValue = 0.0; }
+ wxPlatform(const wxString& defValue) { m_stringValue = defValue; m_longValue = 0; m_doubleValue = 0.0; }
+ wxPlatform(double defValue) { m_longValue = 0; m_doubleValue = defValue; }
+
+ static wxPlatform If(int platform, long value);
+ static wxPlatform IfNot(int platform, long value);
+ wxPlatform& ElseIf(int platform, long value);
+ wxPlatform& ElseIfNot(int platform, long value);
+ wxPlatform& Else(long value);
+
+ static wxPlatform If(int platform, int value);
+ static wxPlatform IfNot(int platform, int value) { return IfNot(platform, (long)value); }
+ wxPlatform& ElseIf(int platform, int value) { return ElseIf(platform, (long) value); }
+ wxPlatform& ElseIfNot(int platform, int value) { return ElseIfNot(platform, (long) value); }
+ wxPlatform& Else(int value) { return Else((long) value); }
+
+ static wxPlatform If(int platform, double value);
+ static wxPlatform IfNot(int platform, double value);
+ wxPlatform& ElseIf(int platform, double value);
+ wxPlatform& ElseIfNot(int platform, double value);
+ wxPlatform& Else(double value);
+
+ static wxPlatform If(int platform, const wxString& value);
+ static wxPlatform IfNot(int platform, const wxString& value);
+ wxPlatform& ElseIf(int platform, const wxString& value);
+ wxPlatform& ElseIfNot(int platform, const wxString& value);
+ wxPlatform& Else(const wxString& value);
+
+ long GetInteger() const { return m_longValue; }
+ const wxString& GetString() const { return m_stringValue; }
+ double GetDouble() const { return m_doubleValue; }
+
+ operator int() const { return (int) GetInteger(); }
+ operator long() const { return GetInteger(); }
+ operator double() const { return GetDouble(); }
+ operator const wxString() const { return GetString(); }
+ operator const wxChar*() const { return (const wxChar*) GetString(); }
+
+ static void AddPlatform(int platform);
+ static bool Is(int platform);
+ static void ClearPlatforms();
+
+private:
+ long m_longValue;
+ double m_doubleValue;
+ wxString m_stringValue;
+ static wxArrayInt* sm_customPlatforms;
+};
+
+/// Function for testing current platform
+inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); }
#if wxUSE_GUI
// 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
// ----------------------------------------------------------------------------
WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString);
#endif
+#if wxUSE_LONGLONG
+ typedef wxLongLong wxDiskspaceSize_t;
+#else
+ typedef long wxDiskspaceSize_t;
+#endif
+
// get number of total/free bytes on the disk where path belongs
WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path,
- wxLongLong *pTotal = NULL,
- wxLongLong *pFree = NULL);
+ wxDiskspaceSize_t *pTotal = NULL,
+ wxDiskspaceSize_t *pFree = NULL);
#if wxUSE_GUI // GUI only things from now on
// ----------------------------------------------------------------------------
// Set the cursor to the busy cursor for all windows
-class WXDLLEXPORT wxCursor;
-extern WXDLLEXPORT_DATA(wxCursor*) wxHOURGLASS_CURSOR;
-WXDLLEXPORT void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
+WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR);
// Restore cursor to normal
WXDLLEXPORT void wxEndBusyCursor();
class WXDLLEXPORT wxBusyCursor
{
public:
- wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR)
+ wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR)
{ wxBeginBusyCursor(cursor); }
~wxBusyCursor()
{ wxEndBusyCursor(); }