From 6a89f9ee4212a2268df1a7ed97145944e937fa0f Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 18 Aug 2003 09:59:18 +0000 Subject: [PATCH] RTTI simplifications git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/button.cpp | 6 +++--- src/msw/checkbox.cpp | 4 ++-- src/msw/choice.cpp | 17 +++++++++++++++- src/msw/combobox.cpp | 25 ++++++++++++++++-------- src/msw/font.cpp | 2 +- src/msw/frame.cpp | 2 +- src/msw/listbox.cpp | 16 +++++++++++++++ src/msw/notebook.cpp | 5 +++++ src/msw/radiobut.cpp | 4 ++-- src/msw/statbox.cpp | 2 +- src/msw/stattext.cpp | 2 +- src/msw/textctrl.cpp | 4 ++-- src/msw/window.cpp | 46 ++++++++++++++++++++++++++++++-------------- 13 files changed, 99 insertions(+), 36 deletions(-) diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 640365319a..3f5cd007c8 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -52,14 +52,14 @@ IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl,"wx/button.h") WX_BEGIN_PROPERTIES_TABLE(wxButton) WX_DELEGATE( OnClick , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent ) - WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( Font , wxFont , SetFont , GetFont , ) - WX_PROPERTY_SET_BY_REF( Label,wxString, SetLabel, GetLabel, wxT("") ) + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) WX_END_PROPERTIES_TABLE() WX_BEGIN_HANDLERS_TABLE(wxButton) WX_END_HANDLERS_TABLE() -WX_CONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) +WX_CONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) #else diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index c3ac6bac00..426f7d8786 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -53,8 +53,8 @@ IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl,"wx/checkbox.h") WX_BEGIN_PROPERTIES_TABLE(wxCheckBox) WX_DELEGATE( OnClick , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent ) - WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( Font , wxFont , SetFont , GetFont , ) - WX_PROPERTY_SET_BY_REF( Label,wxString, SetLabel, GetLabel, wxT("") ) + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) WX_PROPERTY( Value ,bool, SetValue, GetValue, ) WX_END_PROPERTIES_TABLE() diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index bf8abfcb42..46c09070d8 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -40,8 +40,23 @@ #include "wx/msw/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +#if wxUSE_EXTENDED_RTTI +IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl,"wx/checkbox.h") + +WX_BEGIN_PROPERTIES_TABLE(wxChoice) + // TODO DELEGATES + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings ) + WX_PROPERTY( Selection ,int, SetSelection, GetSelection, ) +WX_END_PROPERTIES_TABLE() + +WX_BEGIN_HANDLERS_TABLE(wxChoice) +WX_END_HANDLERS_TABLE() +WX_CONSTRUCTOR_4( wxChoice , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +#endif /* TODO PROPERTIES selection (long) diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 1c62aa80f3..06aefa8f64 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -53,15 +53,24 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) +#if wxUSE_EXTENDED_RTTI +IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl,"wx/combobox.h") + +WX_BEGIN_PROPERTIES_TABLE(wxComboBox) + // TODO DELEGATES + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings ) + WX_PROPERTY( Value ,wxString, SetValue, GetValue, ) + WX_PROPERTY( Selection ,int, SetSelectionLine, GetSelection, ) +WX_END_PROPERTIES_TABLE() + +WX_BEGIN_HANDLERS_TABLE(wxComboBox) +WX_END_HANDLERS_TABLE() -/* - TODO PROPERTIES - selection (long¨) - content - value - item -*/ +WX_CONSTRUCTOR_5( wxComboBox , wxWindow* , Parent , wxWindowID , Id , wxString , Value , wxPoint , Position , wxSize , Size ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) +#endif // ---------------------------------------------------------------------------- // function prototypes diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 45a5473ca9..02cd9c93da 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -76,7 +76,7 @@ WX_BEGIN_PROPERTIES_TABLE(wxFont) WX_PROPERTY( Style, int , SetStyle, GetStyle, (int)wxNORMAL ) // wxFontStyle WX_PROPERTY( Weight, int , SetWeight, GetWeight, (int)wxNORMAL ) // wxFontWeight WX_PROPERTY( Underlined, bool , SetUnderlined, GetUnderlined, false ) - WX_PROPERTY_SET_BY_REF( Face, wxString , SetFaceName, GetFaceName, ) + WX_PROPERTY( Face, wxString , SetFaceName, GetFaceName, ) WX_PROPERTY( Encoding, wxFontEncoding , SetEncoding, GetEncoding, wxFONTENCODING_DEFAULT ) WX_END_PROPERTIES_TABLE() diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 3ceedd4938..d5597c1c83 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -83,7 +83,7 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h") WX_BEGIN_PROPERTIES_TABLE(wxFrame) - WX_PROPERTY_SET_BY_REF( Title,wxString, SetTitle, GetTitle, wxT("") ) + WX_PROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") ) /* TODO PROPERTIES diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index b587d32dba..f081fc8c67 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -47,7 +47,23 @@ #include "wx/msw/gnuwin32/extra.h" #endif +#if wxUSE_EXTENDED_RTTI +IMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl,"wx/listbox.h") + +WX_BEGIN_PROPERTIES_TABLE(wxListBox) + // TODO DELEGATES + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings ) + WX_PROPERTY( Selection ,int, SetSelectionLine, GetSelection, ) +WX_END_PROPERTIES_TABLE() + +WX_BEGIN_HANDLERS_TABLE(wxListBox) +WX_END_HANDLERS_TABLE() + +WX_CONSTRUCTOR_4( wxListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) +#else IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) +#endif /* TODO PROPERTIES diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index ea3334de80..d9f975ef40 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -158,6 +158,11 @@ WX_END_HANDLERS_TABLE() WX_CONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text , bool , Selected , int , ImageId ) +template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theList, wxxVariantArray &value) +{ + wxListCollectionToVariantArray( theList , value ) ; +} + #else IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject ) diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index abc19d681f..1919617648 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -53,8 +53,8 @@ IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioButton, wxControl,"wx/radiobut.h") WX_BEGIN_PROPERTIES_TABLE(wxRadioButton) WX_DELEGATE( OnClick , wxEVT_COMMAND_RADIOBUTTON_SELECTED , wxCommandEvent ) - WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( Font , wxFont , SetFont , GetFont , ) - WX_PROPERTY_SET_BY_REF( Label,wxString, SetLabel, GetLabel, wxT("") ) + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) WX_PROPERTY( Value ,bool, SetValue, GetValue, ) WX_END_PROPERTIES_TABLE() diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 162a8a30b6..84eb048bd0 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -47,7 +47,7 @@ IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox, wxControl,"wx/statbox.h") WX_BEGIN_PROPERTIES_TABLE(wxStaticBox) - WX_PROPERTY_SET_BY_REF( Label,wxString, SetLabel, GetLabel, wxT("") ) + WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) /* TODO PROPERTIES : label diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index f05b7147cf..606e2d5d8d 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -36,7 +36,7 @@ IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticText, wxControl,"wx/stattext.h") WX_BEGIN_PROPERTIES_TABLE(wxStaticText) - WX_PROPERTY_SET_BY_REF( Label,wxString, SetLabel, GetLabel, wxT("") ) + WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) WX_END_PROPERTIES_TABLE() WX_BEGIN_HANDLERS_TABLE(wxStaticText) diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index ff93bacff4..9127559181 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -120,8 +120,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxRichEditModule, wxModule) IMPLEMENT_DYNAMIC_CLASS_XTI(wxTextCtrl, wxControl,"wx/textctrl.h") WX_BEGIN_PROPERTIES_TABLE(wxTextCtrl) - WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( Font , wxFont , SetFont , GetFont , ) - WX_PROPERTY_SET_BY_REF( Value , wxString , SetValue, GetValue, wxEmptyString ) + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY( Value , wxString , SetValue, GetValue, wxEmptyString ) WX_END_PROPERTIES_TABLE() WX_BEGIN_HANDLERS_TABLE(wxTextCtrl) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 93c237878c..8e8603fcb6 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -230,40 +230,57 @@ static inline void wxBringWindowToTop(HWND hwnd) IMPLEMENT_ABSTRACT_CLASS(wxWindowMSW, wxWindowBase) #else // __WXMSW__ #if wxUSE_EXTENDED_RTTI + IMPLEMENT_DYNAMIC_CLASS_XTI(wxWindow, wxWindowBase,"wx/window.h") +// make wxWindowList known before the property is used + +template<> const wxTypeInfo* wxGetTypeInfo( wxWindowList * ) +{ + static wxCollectionTypeInfo s_typeInfo( (wxTypeInfo*) wxGetTypeInfo( (wxWindow **) NULL) ) ; + return &s_typeInfo ; +} + +template<> void wxCollectionToVariantArray( wxWindowList const &theList, wxxVariantArray &value) +{ + wxListCollectionToVariantArray( theList , value ) ; +} + WX_BEGIN_PROPERTIES_TABLE(wxWindow) // Always constructor Properties first WX_READONLY_PROPERTY( Parent,wxWindow*, GetParent, ) WX_PROPERTY( Id,wxWindowID, SetId, GetId, -1 ) - WX_PROPERTY_SET_BY_REF( Position,wxPoint, SetPosition , GetPosition, wxPoint(-1,-1) ) // pos - WX_PROPERTY_SET_BY_REF( Size,wxSize, SetSize, GetSize, wxSize(-1,-1) ) // size - WX_PROPERTY( WindowStyle , long , SetWindowStyle , GetWindowStyle , ) // style + WX_PROPERTY( Position,wxPoint, SetWindowPosition , GetWindowPosition, wxPoint(-1,-1) ) // pos + WX_PROPERTY( Size,wxSize, SetWindowSize, GetWindowSize, wxSize(-1,-1) ) // size + WX_PROPERTY( WindowStyle , long , SetWindowStyle , GetWindowStyle , ) // style // Then all relations of the object graph - WX_READONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetChildren ) + WX_READONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetWindowChildren ) // and finally all other properties WX_PROPERTY( ExtraStyle , long , SetExtraStyle , GetExtraStyle , ) // extstyle - WX_PROPERTY_SET_BY_REF_RET_BOOL( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , ) // bg - WX_PROPERTY_SET_BY_REF_RET_BOOL( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , ) // fg - WX_PROPERTY_SET_RET_BOOL( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) ) - WX_PROPERTY_SET_RET_BOOL( Shown , bool , Show , IsShown , wxxVariant((bool)true) ) + WX_PROPERTY( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , ) // bg + WX_PROPERTY( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , ) // fg + WX_PROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) ) + WX_PROPERTY( Shown , bool , Show , IsShown , wxxVariant((bool)true) ) #if 0 // possible property candidates (not in xrc) or not valid in all subclasses - WX_PROPERTY_SET_BY_REF( Title,wxString, SetTitle, GetTitle, wxT("") ) - WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( Font , wxFont , SetFont , GetFont , ) - WX_PROPERTY_SET_BY_REF( Label,wxString, SetLabel, GetLabel, wxT("") ) + WX_PROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") ) + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) // MaxHeight, Width , MinHeight , Width // TODO switch label to control and title to toplevels - + WX_PROPERTY( ThemeEnabled , bool , SetThemeEnabled , GetThemeEnabled , ) - //WX_PROPERTY_SET_BY_REF( Cursor , wxCursor , SetCursor , GetCursor , ) + //WX_PROPERTY( Cursor , wxCursor , SetCursor , GetCursor , ) // WX_PROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , ) WX_PROPERTY( AutoLayout , bool , SetAutoLayout , GetAutoLayout , ) + + + #endif WX_END_PROPERTIES_TABLE() @@ -271,6 +288,7 @@ WX_BEGIN_HANDLERS_TABLE(wxWindow) WX_END_HANDLERS_TABLE() WX_CONSTRUCTOR_DUMMY(wxWindow) + #else IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) #endif @@ -3458,7 +3476,7 @@ wxWindowMSW::MSWOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id), #endif // USE_OWNER_DRAWN -#if wxUSE_CONTROLS && !defined(__WXUNIVERSAL__) +#if wxUSE_CONTROLS && !defined(__WXUNIVERSAL__) #if wxUSE_OWNER_DRAWN wxControl *item = wxDynamicCast(FindItem(id), wxControl); -- 2.45.2