X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/808260ec3235941ec45f50baca8dbf3655498f24..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/menuitem.h diff --git a/include/wx/menuitem.h b/include/wx/menuitem.h index 55a6a3172f..4eb80b7b5b 100644 --- a/include/wx/menuitem.h +++ b/include/wx/menuitem.h @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 25.10.99 -// RCS-ID: $Id$ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -35,16 +34,16 @@ class WXDLLIMPEXP_FWD_CORE wxMenu; // menu or a separator // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxMenuItemBase : public wxObject +class WXDLLIMPEXP_CORE wxMenuItemBase : public wxObject { public: // creation - static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL, + static wxMenuItem *New(wxMenu *parentMenu = NULL, int itemid = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); + wxMenu *subMenu = NULL); // destruction: wxMenuItem will delete its submenu virtual ~wxMenuItemBase(); @@ -56,7 +55,6 @@ public: // get/set id void SetId(int itemid) { m_id = itemid; } int GetId() const { return m_id; } - bool IsSeparator() const { return m_id == wxID_SEPARATOR; } // the item's text (or name) // @@ -81,8 +79,15 @@ public: // what kind of menu item we are wxItemKind GetKind() const { return m_kind; } void SetKind(wxItemKind kind) { m_kind = kind; } + bool IsSeparator() const { return m_kind == wxITEM_SEPARATOR; } - virtual void SetCheckable(bool checkable) { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; } + bool IsCheck() const { return m_kind == wxITEM_CHECK; } + bool IsRadio() const { return m_kind == wxITEM_RADIO; } + + virtual void SetCheckable(bool checkable) + { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; } + + // Notice that this doesn't quite match SetCheckable(). bool IsCheckable() const { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } @@ -127,7 +132,7 @@ public: wxDEPRECATED( const wxString& GetText() const ); // Now use GetLabelText to strip the accelerators - wxDEPRECATED( static wxString GetLabelFromText(const wxString& text) ); + static wxDEPRECATED( wxString GetLabelFromText(const wxString& text) ); // Now use SetItemLabel wxDEPRECATED( virtual void SetText(const wxString& str) ); @@ -138,14 +143,14 @@ public: const wxString& text, const wxString& help, bool isCheckable, - wxMenu *subMenu = (wxMenu *)NULL) + wxMenu *subMenu = NULL) { return New(parentMenu, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu); } protected: - int m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR + wxWindowIDRef m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR wxMenu *m_parentMenu, // the menu we belong to *m_subMenu; // our sub menu or NULL wxString m_text, // label of the item @@ -155,12 +160,12 @@ protected: bool m_isEnabled; // is enabled? // this ctor is for the derived classes only, we're never created directly - wxMenuItemBase(wxMenu *parentMenu = (wxMenu *)NULL, + wxMenuItemBase(wxMenu *parentMenu = NULL, int itemid = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); + wxMenu *subMenu = NULL); private: // and, if we have one ctor, compiler won't generate a default copy one, so @@ -189,8 +194,6 @@ inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); #else // !wxUSE_BASE_CLASSES_ONLY #if defined(__WXUNIVERSAL__) #include "wx/univ/menuitem.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/menuitem.h" #elif defined(__WXMSW__) #include "wx/msw/menuitem.h" #elif defined(__WXMOTIF__) @@ -200,7 +203,7 @@ inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); #elif defined(__WXGTK__) #include "wx/gtk1/menuitem.h" #elif defined(__WXMAC__) - #include "wx/mac/menuitem.h" + #include "wx/osx/menuitem.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/menuitem.h" #elif defined(__WXPM__)