// Menu Bar (a la Windows)
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxMenuInfo : public wxObject
-{
-public :
- wxMenuInfo() { m_menu = NULL ; }
- virtual ~wxMenuInfo() { }
-
- void Create( wxMenu *menu , const wxString &title )
- { m_menu = menu ; m_title = title ; }
- wxMenu* GetMenu() const { return m_menu ; }
- wxString GetTitle() const { return m_title ; }
-private :
- wxMenu *m_menu ;
- wxString m_title ;
-
- DECLARE_DYNAMIC_CLASS(wxMenuInfo) ;
-} ;
-
-WX_DECLARE_EXPORTED_LIST(wxMenuInfo, wxMenuInfoList );
-
class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
{
public:
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
virtual ~wxMenuBar();
- // menubar construction
- bool Append( wxMenuInfo *info ) { return Append( info->GetMenu() , info->GetTitle() ) ; }
- const wxMenuInfoList& GetMenuInfos() const ;
-
virtual bool Append( wxMenu *menu, const wxString &title );
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
// wxMenu implementation
// ============================================================================
-IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
-
bool wxMenu::Create(const wxString& title, long style)
{
wxAutoNSAutoreleasePool pool;
// ============================================================================
// wxMenuBar implementation
// ============================================================================
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
bool wxMenuBar::Create(long style)
{
// ============================================================================
// wxMenuItemCocoa implementation
// ============================================================================
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
wxMenuItemCocoaHash wxMenuItemCocoa::sm_cocoaHash;
wxObjcAutoRefFromAlloc<struct objc_object *> wxMenuItemCocoa::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSMenuItemTarget) alloc] init];
// XTI for wxMenu(Bar)
// ----------------------------------------------------------------------------
-#if wxUSE_EXTENDED_RTTI
-
-WX_DEFINE_LIST( wxMenuInfoList )
-
wxDEFINE_FLAGS( wxMenuStyle )
wxBEGIN_FLAGS( wxMenuStyle )
wxFLAGS_MEMBER(wxMENU_TEAROFF)
wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuBar, wxWindow, "wx/menu.h", \
wxMenuBarStreamingCallback)
+#if wxUSE_EXTENDED_RTTI
+
+WX_DEFINE_LIST( wxMenuInfoList )
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenuInfo, wxObject, "wx/menu.h")
wxBEGIN_PROPERTIES_TABLE(wxMenuInfo)
wxListCollectionToAnyList<wxMenuInfoList::compatibility_iterator>( theList, value ) ;
}
-wxBEGIN_PROPERTIES_TABLE(wxMenuBar)
-wxPROPERTY_COLLECTION( MenuInfos, wxMenuInfoList, wxMenuInfo*, AppendMenuInfo, \
- GetMenuInfos, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
-wxEND_PROPERTIES_TABLE()
-
-wxEMPTY_HANDLERS_TABLE(wxMenuBar)
-
-wxCONSTRUCTOR_DUMMY( wxMenuBar )
-
const wxMenuInfoList& wxMenuBarBase::GetMenuInfos() const
{
wxMenuInfoList* list = const_cast< wxMenuInfoList* > (& m_menuInfos);
return m_menuInfos;
}
-/*
-WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenu**>)
-WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuItem**>)
-WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuBar**>)
-WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuInfo**>)
-*/
-#else
-// IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
-// IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
-// IMPLEMENT_DYNAMIC_CLASS(wxMenuInfo, wxObject)
#endif
+wxBEGIN_PROPERTIES_TABLE(wxMenuBar)
+wxPROPERTY_COLLECTION( MenuInfos, wxMenuInfoList, wxMenuInfo*, AppendMenuInfo, \
+ GetMenuInfos, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
+wxEND_PROPERTIES_TABLE()
+
+wxEMPTY_HANDLERS_TABLE(wxMenuBar)
+
+wxCONSTRUCTOR_DUMMY( wxMenuBar )
// ----------------------------------------------------------------------------
// XTI for wxMenuItem
// wxMenuBar
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
-
void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
{
#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
// wxMenuItem
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
int id,
const wxString& name,
}
}
-IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
-
void wxMenu::Init()
{
m_popupShown = false;
// wxMenuBar
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
-
void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
{
// the parent window is known after wxFrame::SetMenu()
// wxMenuItem
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
int id,
const wxString& name,
// wxMenu
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
-
void wxMenu::Init()
{
m_accel = gtk_accel_group_new();
// other standard headers
#include <string.h>
-IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
-
// ============================================================================
// implementation
// ============================================================================
// dynamic classes implementation
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
// ----------------------------------------------------------------------------
// wxMenuItem
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
- IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
- IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
-
// ============================================================================
// implementation
// ============================================================================
// dynamic classes implementation
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
// ----------------------------------------------------------------------------
// wxMenuItem
// ----------------------------------------------------------------------------
{
}
-IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
-
// the (popup) menu title has this special id
static const int idMenuTitle = -3;
{
}
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
int id,
const wxString& t,
// implementation
// ============================================================================
-#include "wx/listimpl.cpp"
-
-WX_DEFINE_LIST( wxMenuInfoList )
-
-#if wxUSE_EXTENDED_RTTI
-
-WX_DEFINE_FLAGS( wxMenuStyle )
-
-wxBEGIN_FLAGS( wxMenuStyle )
- wxFLAGS_MEMBER(wxMENU_TEAROFF)
-wxEND_FLAGS( wxMenuStyle )
-
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler,"wx/menu.h")
-
-wxCOLLECTION_TYPE_INFO( wxMenuItem * , wxMenuItemList ) ;
-
-template<> void wxCollectionToVariantArray( wxMenuItemList const &theList, wxxVariantArray &value)
-{
- wxListCollectionToVariantArray<wxMenuItemList::compatibility_iterator>( theList , value ) ;
-}
-
-wxBEGIN_PROPERTIES_TABLE(wxMenu)
- wxEVENT_PROPERTY( Select , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
- wxPROPERTY( Title, wxString , SetTitle, GetTitle, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxREADONLY_PROPERTY_FLAGS( MenuStyle , wxMenuStyle , long , GetStyle , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
- wxPROPERTY_COLLECTION( MenuItems , wxMenuItemList , wxMenuItem* , Append , GetMenuItems , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-wxEND_PROPERTIES_TABLE()
-
-wxBEGIN_HANDLERS_TABLE(wxMenu)
-wxEND_HANDLERS_TABLE()
-
-wxDIRECT_CONSTRUCTOR_2( wxMenu , wxString , Title , long , MenuStyle )
-
-WX_DEFINE_FLAGS( wxMenuBarStyle )
-
-wxBEGIN_FLAGS( wxMenuBarStyle )
- wxFLAGS_MEMBER(wxMB_DOCKABLE)
-wxEND_FLAGS( wxMenuBarStyle )
-
-// the negative id would lead the window (its superclass !) to vetoe streaming out otherwise
-bool wxMenuBarStreamingCallback( const wxObject *WXUNUSED(object), wxWriter * , wxPersister * , wxxVariantArray & )
-{
- return true ;
-}
-
-IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuBar, wxWindow ,"wx/menu.h",wxMenuBarStreamingCallback)
-
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxMenuInfo, wxObject , "wx/menu.h" )
-
-wxBEGIN_PROPERTIES_TABLE(wxMenuInfo)
- wxREADONLY_PROPERTY( Menu , wxMenu* , GetMenu , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxREADONLY_PROPERTY( Title , wxString , GetTitle , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-wxEND_PROPERTIES_TABLE()
-
-wxBEGIN_HANDLERS_TABLE(wxMenuInfo)
-wxEND_HANDLERS_TABLE()
-
-wxCONSTRUCTOR_2( wxMenuInfo , wxMenu* , Menu , wxString , Title )
-
-wxCOLLECTION_TYPE_INFO( wxMenuInfo * , wxMenuInfoList ) ;
-
-template<> void wxCollectionToVariantArray( wxMenuInfoList const &theList, wxxVariantArray &value)
-{
- wxListCollectionToVariantArray<wxMenuInfoList::compatibility_iterator>( theList , value ) ;
-}
-
-wxBEGIN_PROPERTIES_TABLE(wxMenuBar)
- wxPROPERTY_COLLECTION( MenuInfos , wxMenuInfoList , wxMenuInfo* , Append , GetMenuInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-wxEND_PROPERTIES_TABLE()
-
-wxBEGIN_HANDLERS_TABLE(wxMenuBar)
-wxEND_HANDLERS_TABLE()
-
-wxCONSTRUCTOR_DUMMY( wxMenuBar )
-
-#else
-IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuInfo, wxObject)
-#endif
-
-const wxMenuInfoList& wxMenuBar::GetMenuInfos() const
-{
- wxMenuInfoList* list = const_cast< wxMenuInfoList* >( &m_menuInfos ) ;
- WX_CLEAR_LIST( wxMenuInfoList , *list ) ;
- for( size_t i = 0 ; i < GetMenuCount() ; ++i )
- {
- wxMenuInfo* info = new wxMenuInfo() ;
- info->Create( const_cast<wxMenuBar*>(this)->GetMenu(i) , GetMenuLabel(i) ) ;
- list->Append( info ) ;
- }
- return m_menuInfos ;
-}
-
// ---------------------------------------------------------------------------
// wxMenu construction, adding and removing menu items
// ---------------------------------------------------------------------------
// implementation
// ============================================================================
-// ----------------------------------------------------------------------------
-// dynamic classes implementation
-// ----------------------------------------------------------------------------
-
-#if wxUSE_EXTENDED_RTTI
-
-bool wxMenuItemStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & )
-{
- const wxMenuItem * mitem = dynamic_cast<const wxMenuItem*>(object) ;
- if ( mitem->GetMenu() && !mitem->GetMenu()->GetTitle().empty() )
- {
- // we don't stream out the first two items for menus with a title, they will be reconstructed
- if ( mitem->GetMenu()->FindItemByPosition(0) == mitem || mitem->GetMenu()->FindItemByPosition(1) == mitem )
- return false ;
- }
- return true ;
-}
-
-wxBEGIN_ENUM( wxItemKind )
- wxENUM_MEMBER( wxITEM_SEPARATOR )
- wxENUM_MEMBER( wxITEM_NORMAL )
- wxENUM_MEMBER( wxITEM_CHECK )
- wxENUM_MEMBER( wxITEM_RADIO )
-wxEND_ENUM( wxItemKind )
-
-IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuItem, wxObject,"wx/menuitem.h",wxMenuItemStreamingCallback)
-
-wxBEGIN_PROPERTIES_TABLE(wxMenuItem)
- wxPROPERTY( Parent,wxMenu*, SetMenu, GetMenu, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxPROPERTY( Id,int, SetId, GetId, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxPROPERTY( Text, wxString , SetText, GetText, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxPROPERTY( Help, wxString , SetHelp, GetHelp, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxREADONLY_PROPERTY( Kind, wxItemKind , GetKind , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxPROPERTY( SubMenu,wxMenu*, SetSubMenu, GetSubMenu, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxPROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY( Checked , bool , Check , IsChecked , wxxVariant((bool)false) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY( Checkable , bool , SetCheckable , IsCheckable , wxxVariant((bool)false) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-wxEND_PROPERTIES_TABLE()
-
-wxBEGIN_HANDLERS_TABLE(wxMenuItem)
-wxEND_HANDLERS_TABLE()
-
-wxDIRECT_CONSTRUCTOR_6( wxMenuItem , wxMenu* , Parent , int , Id , wxString , Text , wxString , Help , wxItemKind , Kind , wxMenu* , SubMenu )
-#else
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-#endif
-
// ----------------------------------------------------------------------------
// wxMenuItem
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
BEGIN_EVENT_TABLE(wxPopupMenuWindow, wxPopupTransientWindow)
EVT_KEY_DOWN(wxPopupMenuWindow::OnKeyDown)