WX_DELEGATE( OnClick , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent)
WX_PROPERTY( Font , wxFont , SetFont , GetFont , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- WX_PROPERTY( Label, wxString , SetLabel, GetLabel, wxEmptyString, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_PROPERTY( Label, wxString , SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
WX_PROPERTY_FLAGS( WindowStyle , wxButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
WX_DELEGATE( OnClick , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent )
WX_PROPERTY( Font , wxFont , SetFont , GetFont , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxEmptyString , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY( Value ,bool, SetValue, GetValue, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY_FLAGS( WindowStyle , wxCheckBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
WX_END_PROPERTIES_TABLE()
#if wxUSE_EXTENDED_RTTI
-/*
-
template<> void wxStringReadValue(const wxString &s , wxColour &data )
{
// copied from VS xrc
template<> void wxStringWriteValue(wxString &s , const wxColour &data )
{
- s = wxString::Format("#%2X%2X%2X", data.Red() , data.Green() , data.Blue() ) ;
+ s = wxString::Format("#%02X%02X%02X", data.Red() , data.Green() , data.Blue() ) ;
}
-WX_CUSTOM_TYPE_INFO(wxColour)
-
-*/
-
-IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( wxColour , wxObject , "wx/colour.h" )
+IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxToStringConverter<wxColour> , &wxFromStringConverter<wxColour>)
WX_BEGIN_PROPERTIES_TABLE(wxColour)
- WX_READONLY_PROPERTY( Red, unsigned char , Red , 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- WX_READONLY_PROPERTY( Green, unsigned char , Green , 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- WX_READONLY_PROPERTY( Blue, unsigned char , Blue , 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_READONLY_PROPERTY( Red, unsigned char , Red , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_READONLY_PROPERTY( Green, unsigned char , Green , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_READONLY_PROPERTY( Blue, unsigned char , Blue , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_END_PROPERTIES_TABLE()
WX_CONSTRUCTOR_3( wxColour , unsigned char , Red , unsigned char , Green , unsigned char , Blue )
IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h")
WX_BEGIN_PROPERTIES_TABLE(wxFrame)
- WX_PROPERTY( Title,wxString, SetTitle, GetTitle, wxEmptyString , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_PROPERTY( Title,wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY_FLAGS( WindowStyle , wxFrameStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
-/*
+ WX_PROPERTY( MenuBar , wxMenuBar * , SetMenuBar , GetMenuBar , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ /*
TODO PROPERTIES
style (wxDEFAULT_FRAME_STYLE)
// implementation
// ============================================================================
+#include <wx/listimpl.cpp>
+
+WX_DEFINE_LIST( wxMenuInfoList ) ;
+
+#if wxUSE_EXTENDED_RTTI
+
+WX_DEFINE_FLAGS( wxMenuStyle )
+
+WX_BEGIN_FLAGS( wxMenuStyle )
+ WX_FLAGS_MEMBER(wxMENU_TEAROFF)
+WX_END_FLAGS( wxMenuStyle )
+
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler,"wx/menu.h")
+
+WX_COLLECTION_TYPE_INFO( wxMenuItem * , wxMenuItemList ) ;
+
+template<> void wxCollectionToVariantArray( wxMenuItemList const &theList, wxxVariantArray &value)
+{
+ wxListCollectionToVariantArray<wxMenuItemList::compatibility_iterator>( theList , value ) ;
+}
+
+WX_BEGIN_PROPERTIES_TABLE(wxMenu)
+ WX_DELEGATE( OnSelect , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
+ WX_PROPERTY( Title, wxString , SetTitle, GetTitle, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_READONLY_PROPERTY_FLAGS( MenuStyle , wxMenuStyle , long , GetStyle , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
+ WX_PROPERTY_COLLECTION( MenuItems , wxMenuItemList , wxMenuItem* , Append , GetMenuItems , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+WX_END_PROPERTIES_TABLE()
+
+WX_BEGIN_HANDLERS_TABLE(wxMenu)
+WX_END_HANDLERS_TABLE()
+
+WX_DIRECT_CONSTRUCTOR_2( wxMenu , wxString , Title , long , MenuStyle )
+
+WX_DEFINE_FLAGS( wxMenuBarStyle )
+
+WX_BEGIN_FLAGS( wxMenuBarStyle )
+ WX_FLAGS_MEMBER(wxMB_DOCKABLE)
+WX_END_FLAGS( wxMenuBarStyle )
+
+// the negative id would lead the window (its superclass !) to vetoe streaming out otherwise
+bool wxMenuBarStreamingCallback( const wxObject *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" )
+
+WX_BEGIN_PROPERTIES_TABLE(wxMenuInfo)
+ WX_READONLY_PROPERTY( Menu , wxMenu* , GetMenu , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_READONLY_PROPERTY( Title , wxString , GetTitle , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+WX_END_PROPERTIES_TABLE()
+
+WX_BEGIN_HANDLERS_TABLE(wxMenuInfo)
+WX_END_HANDLERS_TABLE()
+
+WX_CONSTRUCTOR_2( wxMenuInfo , wxMenu* , Menu , wxString , Title )
+
+WX_COLLECTION_TYPE_INFO( wxMenuInfo * , wxMenuInfoList ) ;
+
+template<> void wxCollectionToVariantArray( wxMenuInfoList const &theList, wxxVariantArray &value)
+{
+ wxListCollectionToVariantArray<wxMenuInfoList::compatibility_iterator>( theList , value ) ;
+}
+
+WX_BEGIN_PROPERTIES_TABLE(wxMenuBar)
+ WX_PROPERTY_COLLECTION( MenuInfos , wxMenuInfoList , wxMenuInfo* , Append , GetMenuInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+WX_END_PROPERTIES_TABLE()
+
+WX_BEGIN_HANDLERS_TABLE(wxMenuBar)
+WX_END_HANDLERS_TABLE()
+
+WX_CONSTRUCTOR_DUMMY( wxMenuBar )
+
+#else
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
+IMPLEMENT_DYNAMIC_CLASS(wxMenuInfo, wxObject)
+#endif
-/*
- TODO PROPERTIES
- wxMenu
- label
- help
-
- separator
- break
- label
- accel
- radio
- checkable
- help
- bitmap
- wxMenuItem
-*/
+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) , GetLabelTop(i) ) ;
+ list->Append( info ) ;
+ }
+ return m_menuInfos ;
+}
// ---------------------------------------------------------------------------
// wxMenu construction, adding and removing menu items
// 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().IsEmpty() )
+ {
+ // 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 ;
+}
+
+WX_BEGIN_ENUM( wxItemKind )
+ WX_ENUM_MEMBER( wxITEM_SEPARATOR )
+ WX_ENUM_MEMBER( wxITEM_NORMAL )
+ WX_ENUM_MEMBER( wxITEM_CHECK )
+ WX_ENUM_MEMBER( wxITEM_RADIO )
+WX_END_ENUM( wxItemKind )
+
+IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuItem, wxObject,"wx/menuitem.h",wxMenuItemStreamingCallback)
+
+WX_BEGIN_PROPERTIES_TABLE(wxMenuItem)
+ WX_PROPERTY( Parent,wxMenu*, SetMenu, GetMenu, , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_PROPERTY( Id,int, SetId, GetId, , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_PROPERTY( Text, wxString , SetText, GetText, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_PROPERTY( Help, wxString , SetHelp, GetHelp, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_READONLY_PROPERTY( Kind, wxItemKind , GetKind , , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_PROPERTY( SubMenu,wxMenu*, SetSubMenu, GetSubMenu, , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_PROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_PROPERTY( Checked , bool , Check , IsChecked , wxxVariant((bool)false) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_PROPERTY( Checkable , bool , SetCheckable , IsCheckable , wxxVariant((bool)false) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+WX_END_PROPERTIES_TABLE()
+
+WX_BEGIN_HANDLERS_TABLE(wxMenuItem)
+WX_END_HANDLERS_TABLE()
+
+WX_DIRECT_CONSTRUCTOR_6( wxMenuItem , wxMenu* , Parent , int , Id , wxString , Text , wxString , Help , wxItemKind , Kind , wxMenu* , SubMenu )
+#else
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
+#endif
// ----------------------------------------------------------------------------
// wxMenuItem
bool wxMenuItem::IsChecked() const
{
+ // fix that RTTI is always getting the correct state (separators cannot be checked, but the call below
+ // returns true
+ if ( GetId() == wxID_SEPARATOR )
+ return false ;
+
int flag = ::GetMenuState(GetHMenuOf(m_parentMenu), GetId(), MF_BYCOMMAND);
return (flag & MF_CHECKED) != 0;
WX_BEGIN_PROPERTIES_TABLE(wxNotebookPageInfo)
WX_READONLY_PROPERTY( Page , wxNotebookPage* , GetPage , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- WX_READONLY_PROPERTY( Text , wxString , GetText , wxEmptyString , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_READONLY_PROPERTY( Text , wxString , GetText , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_READONLY_PROPERTY( Selected , bool , GetSelected , false, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
WX_READONLY_PROPERTY( ImageId , int , GetImageId , -1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_END_PROPERTIES_TABLE()
WX_BEGIN_PROPERTIES_TABLE(wxRadioButton)
WX_DELEGATE( OnClick , wxEVT_COMMAND_RADIOBUTTON_SELECTED , wxCommandEvent )
WX_PROPERTY( Font , wxFont , SetFont , GetFont , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxEmptyString, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
WX_PROPERTY( Value ,bool, SetValue, GetValue,, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
WX_PROPERTY_FLAGS( WindowStyle , wxRadioButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
WX_END_PROPERTIES_TABLE()
WX_PROPERTY( Min , int , SetMin, GetMin, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY( Max , int , SetMax, GetMax, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY_FLAGS( WindowStyle , wxSpinButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
-/*
- TODO PROPERTIES
- style wxSP_VERTICAL | wxSP_ARROW_KEYS
-*/
WX_END_PROPERTIES_TABLE()
WX_BEGIN_HANDLERS_TABLE(wxSpinButton)
IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox, wxControl,"wx/statbox.h")
WX_BEGIN_PROPERTIES_TABLE(wxStaticBox)
- WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxEmptyString , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY_FLAGS( WindowStyle , wxStaticBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
/*
TODO PROPERTIES :
IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticText, wxControl,"wx/stattext.h")
WX_BEGIN_PROPERTIES_TABLE(wxStaticText)
- WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxEmptyString , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY_FLAGS( WindowStyle , wxStaticTextStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
WX_END_PROPERTIES_TABLE()
WX_BEGIN_PROPERTIES_TABLE(wxTextCtrl)
WX_PROPERTY( Font , wxFont , SetFont , GetFont ,, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- WX_PROPERTY( Value , wxString , SetValue, GetValue, wxEmptyString , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ WX_PROPERTY( Value , wxString , SetValue, GetValue, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
WX_PROPERTY_FLAGS( WindowStyle , wxTextCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
WX_END_PROPERTIES_TABLE()