wxDOS /* wxBase under MS-DOS */
};
+/* Friendlier platform names */
+enum
+{
+ wxMotif = wxMOTIF_X,
+ wxMac = wxMAC,
+ wxMSW = wxWINDOWS,
+ wxWinCE = wxWINDOWS_CE,
+ wxWinPocketPC = wxWINDOWS_POCKETPC,
+ wxWinSmartPhone = wxWINDOWS_SMARTPHONE,
+ wxWin95= wxWIN95,
+ wxUnix = wxUNIX, /* wxBase under Unix */
+ wxPalmOS = wxPALMOS, /* PalmOS */
+ wxOS2 = wxOS2_PM,
+
+ wxMGL = 100,
+ wxCocoa
+};
+
/* ---------------------------------------------------------------------------- */
/* standard wxWidgets types */
/* ---------------------------------------------------------------------------- */
#include "wx/filefn.h"
class WXDLLIMPEXP_BASE wxArrayString;
+class WXDLLIMPEXP_BASE wxArrayInt;
// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare
// wxLongLong
// 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(3).Is(wxMac, 1).Is(wxGTK, 2).Is(stPDA, 5);
+ * wxString strVal = wxPlatform(wxT("Hello")).Is(wxMac, wxT("Mac")).Is(wxMSW, wxT("MSW"));
+ *
+ * A custom platform symbol:
+ *
+ * #define stPDA 100
+ * #ifdef __WXWINCE__
+ * wxPlatform::AddPlatform(stPDA);
+ * #endif
+ *
+ * long windowStyle = wxCAPTION | (long) wxPlatform().IsNot(stPDA, wxRESIZE_BORDER);
+ *
+ */
+
+class WXDLLIMPEXP_BASE wxPlatform
+{
+public:
+ wxPlatform() { 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; }
+
+ wxPlatform& Is(int platform, long value);
+ wxPlatform& IsNot(int platform, long value);
+
+ wxPlatform& Is(int platform, int value) { return Is(platform, (long) value); }
+ wxPlatform& IsNot(int platform, int value) { return IsNot(platform, (long) value); }
+
+ wxPlatform& Is(int platform, const wxString& value);
+ wxPlatform& IsNot(int platform, const wxString& value);
+
+ wxPlatform& Is(int platform, double value);
+ wxPlatform& IsNot(int platform, double value);
+
+ // This should be specified first to set the default value, or simply
+ // pass the value to the constructor
+ wxPlatform& Default(long value);
+ wxPlatform& Default(const wxString& value);
+ wxPlatform& Default(double 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 PlatformIs(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::PlatformIs(platform); }
#if wxUSE_GUI
wxMenu *sheet_menu = new wxMenu;
sheet_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Standard property sheet\tShift-Ctrl-P"));
sheet_menu->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK, _T("&Toolbook sheet\tShift-Ctrl-T"));
+
+ if (wxPlatformIs(wxMac))
+ sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, _T("Button &Toolbook sheet\tShift-Ctrl-U"));
+/*
#ifdef __WXMAC__
sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, _T("Button &Toolbook sheet\tShift-Ctrl-U"));
#endif
+*/
file_menu->Append(wxID_ANY, _T("&Property sheets"), sheet_menu);
#endif // USE_SETTINGS_DIALOG
m_imageList = NULL;
Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE
+ wxDEFAULT_DIALOG_STYLE| (int)wxPlatform().IsNot(wxWinCE, resizeBorder)
+/*
#ifndef __WXWINCE__
|resizeBorder
#endif
+*/
);
// If using a toolbook, also follow Mac style and don't create buttons
if (!useToolBook)
- CreateButtons(wxOK|wxCANCEL
+ CreateButtons(wxOK|wxCANCEL| (int)wxPlatform().IsNot(wxWinPocketPC, wxHELP)
+/*
#ifndef __POCKETPC__
|wxHELP
#endif
+*/
);
wxBookCtrlBase* notebook = GetBookCtrl();
return info.os;
}
+/*
+ * Class to make it easier to specify platform-dependent values
+ */
+
+wxArrayInt* wxPlatform::sm_customPlatforms = NULL;
+
+wxPlatform& wxPlatform::Is(int platform, long value)
+{
+ if (wxPlatformIs(platform))
+ m_longValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::IsNot(int platform, long value)
+{
+ if (!wxPlatformIs(platform))
+ m_longValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::Is(int platform, double value)
+{
+ if (wxPlatformIs(platform))
+ m_doubleValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::IsNot(int platform, double value)
+{
+ if (!wxPlatformIs(platform))
+ m_doubleValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::Is(int platform, const wxString& value)
+{
+ if (wxPlatformIs(platform))
+ m_stringValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::IsNot(int platform, const wxString& value)
+{
+ if (!wxPlatformIs(platform))
+ m_stringValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::Default(long value)
+{
+ m_longValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::Default(double value)
+{
+ m_doubleValue = value;
+ return *this;
+}
+
+wxPlatform& wxPlatform::Default(const wxString& value)
+{
+ m_stringValue = value;
+ return *this;
+}
+
+void wxPlatform::AddPlatform(int platform)
+{
+ if (!sm_customPlatforms)
+ sm_customPlatforms = new wxArrayInt;
+ sm_customPlatforms->Add(platform);
+}
+
+void wxPlatform::ClearPlatforms()
+{
+ delete sm_customPlatforms;
+ sm_customPlatforms = NULL;
+}
+
+/// Function for testing current platform
+
+bool wxPlatform::PlatformIs(int platform)
+{
+#ifdef __WXMSW__
+ if (platform == wxMSW)
+ return true;
+#endif
+#ifdef __WXWINCE__
+ if (platform == wxWinCE)
+ return true;
+#endif
+#if defined(__WXWINCE__) && defined(__POCKETPC__)
+ if (platform == wxWinPocketPC)
+ return true;
+#endif
+#if defined(__WXWINCE__) && defined(__SMARTPHONE__)
+ if (platform == wxWinSmartphone)
+ return true;
+#endif
+#ifdef __WXGTK__
+ if (platform == wxGTK)
+ return true;
+#endif
+#ifdef __WXMAC__
+ if (platform == wxMac)
+ return true;
+#endif
+#ifdef __WXX11__
+ if (platform == wxX11)
+ return true;
+#endif
+#ifdef __UNIX__
+ if (platform == wxUnix)
+ return true;
+#endif
+#ifdef __WXMGL__
+ if (platform == wxMGL)
+ return true;
+#endif
+#ifdef __WXOS2__
+ if (platform == wxOS2)
+ return true;
+#endif
+#ifdef __WXCOCA__
+ if (platform == wxCocoa)
+ return true;
+#endif
+
+ if (sm_customPlatforms && sm_customPlatforms->Index(platform) != wxNOT_FOUND)
+ return true;
+
+ return false;
+}
+
// ----------------------------------------------------------------------------
// network and user id functions
// ----------------------------------------------------------------------------