X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/066f1b7a9580fc6c487efa753d61e3683de61407..22026088535d0c7dafaae15133a8d1078195a366:/src/msw/notebook.cpp diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index cb9d37a573..d9f975ef40 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "notebook.h" #endif @@ -68,16 +68,6 @@ #include "wx/panel.h" #endif -/* - notebookpage - object - object_ref - label - selected - style - usenotebooksizer -*/ - // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -109,6 +99,10 @@ // event table // ---------------------------------------------------------------------------- +#include <wx/listimpl.cpp> + +WX_DEFINE_LIST( wxNotebookPageInfoList ) ; + DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING) @@ -123,9 +117,27 @@ BEGIN_EVENT_TABLE(wxNotebook, wxControl) END_EVENT_TABLE() #if wxUSE_EXTENDED_RTTI + IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxControl,"wx/notebook.h") +IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject , "wx/notebook.h" ) + +template<> const wxTypeInfo* wxGetTypeInfo( wxNotebookPageInfoList * ) +{ + static wxCollectionTypeInfo s_typeInfo( (wxTypeInfo*) wxGetTypeInfo( (wxNotebookPageInfo **) NULL) ) ; + return &s_typeInfo ; +} WX_BEGIN_PROPERTIES_TABLE(wxNotebook) + WX_PROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos ) +/* + notebookpage + object + object_ref + label + selected + style + usenotebooksizer +*/ WX_END_PROPERTIES_TABLE() WX_BEGIN_HANDLERS_TABLE(wxNotebook) @@ -133,8 +145,27 @@ WX_END_HANDLERS_TABLE() WX_CONSTRUCTOR_4( wxNotebook , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) + +WX_BEGIN_PROPERTIES_TABLE(wxNotebookPageInfo) + WX_READONLY_PROPERTY( Page , wxNotebookPage* , GetPage , ) + WX_READONLY_PROPERTY( Text , wxString , GetText , wxEmptyString ) + WX_READONLY_PROPERTY( Selected , bool , GetSelected , false ) + WX_READONLY_PROPERTY( ImageId , int , GetImageId , -1 ) +WX_END_PROPERTIES_TABLE() + +WX_BEGIN_HANDLERS_TABLE(wxNotebookPageInfo) +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 ) #endif IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) @@ -146,6 +177,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // wxNotebook construction // ---------------------------------------------------------------------------- +const wxNotebookPageInfoList& wxNotebook::GetPageInfos() const +{ + wxNotebookPageInfoList* list = const_cast< wxNotebookPageInfoList* >( &m_pageInfos ) ; + WX_CLEAR_LIST( wxNotebookPageInfoList , *list ) ; + for( int i = 0 ; i < GetPageCount() ; ++i ) + { + wxNotebookPageInfo *info = new wxNotebookPageInfo() ; + info->Create( const_cast<wxNotebook*>(this)->GetPage(i) , GetPageText(i) , GetSelection() == i , GetPageImage(i) ) ; + list->Append( info ) ; + } + return m_pageInfos ; +} + // common part of all ctors void wxNotebook::Init() {