X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a349c43322420bff16342949e28fa87669e8610f..19c7ac3d3bf1ac2113505a805a79c40ce3db1f5b:/include/wx/propgrid/manager.h?ds=sidebyside diff --git a/include/wx/propgrid/manager.h b/include/wx/propgrid/manager.h index 2be06936ec..5885072264 100644 --- a/include/wx/propgrid/manager.h +++ b/include/wx/propgrid/manager.h @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: 2005-01-14 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) Jaakko Salli // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -12,6 +12,8 @@ #ifndef _WX_PROPGRID_MANAGER_H_ #define _WX_PROPGRID_MANAGER_H_ +#if wxUSE_PROPGRID + #include "wx/propgrid/propgrid.h" #include "wx/dcclient.h" @@ -25,7 +27,7 @@ // ----------------------------------------------------------------------- #ifndef SWIG -extern WXDLLIMPEXP_PROPGRID const wxChar *wxPropertyGridManagerNameStr; +extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridManagerNameStr[]; #endif /** @class wxPropertyGridPage @@ -161,14 +163,8 @@ protected: */ virtual void DoSetSplitterPosition( int pos, int splitterColumn = 0, - bool allPages = false ); - - /** Propagate to other pages. - */ - void DoSetSplitterPositionThisPage( int pos, int splitterColumn = 0 ) - { - wxPropertyGridPageState::DoSetSplitterPosition( pos, splitterColumn ); - } + bool allPages = false, + bool fromAutoCenter = false ); /** Page label (may be referred as name in some parts of documentation). Can be set in constructor, or passed in @@ -258,7 +254,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxPGMAN_DEFAULT_STYLE, - const wxChar* name = wxPropertyGridManagerNameStr ); + const wxString& name = wxPropertyGridManagerNameStr ); /** Destructor */ virtual ~wxPropertyGridManager(); @@ -275,25 +271,20 @@ public: @param pageObj wxPropertyGridPage instance. Manager will take ownership of this object. NULL indicates that a default page instance should be created. + @return - Returns index to the page created. + Returns pointer to created page. + @remarks If toolbar is used, it is highly recommended that the pages are added when the toolbar is not turned off using window style flag switching. */ - int AddPage( const wxString& label = wxEmptyString, - const wxBitmap& bmp = wxPG_NULL_BITMAP, - wxPropertyGridPage* pageObj = (wxPropertyGridPage*) NULL ) - { - return InsertPage(-1,label,bmp,pageObj); - } - - void ClearModifiedStatus ( wxPGPropArg id ); - - void ClearModifiedStatus () + wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString, + const wxBitmap& bmp = wxPG_NULL_BITMAP, + wxPropertyGridPage* pageObj = NULL ) { - m_pPropGrid->ClearModifiedStatus(); + return InsertPage(-1, label, bmp, pageObj); } /** Deletes all all properties and all pages. @@ -323,7 +314,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxPGMAN_DEFAULT_STYLE, - const wxChar* name = wxPropertyGridManagerNameStr ); + const wxString& name = wxPropertyGridManagerNameStr ); /** Enables or disables (shows/hides) categories according to parameter @@ -344,25 +335,6 @@ public: */ bool EnsureVisible( wxPGPropArg id ); - /** Returns number of children of the root property of the selected page. */ - size_t GetChildrenCount() - { - return GetChildrenCount( m_pPropGrid->m_pState->m_properties ); - } - - /** Returns number of children of the root property of given page. */ - size_t GetChildrenCount( int pageIndex ); - - /** Returns number of children for the property. - - NB: Cannot be in container methods class due to name hiding. - */ - size_t GetChildrenCount( wxPGPropArg id ) const - { - wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0) - return p->GetChildCount(); - } - /** Returns number of columns on given page. By the default, returns number of columns on current page. */ int GetColumnCount( int page = -1 ) const; @@ -443,18 +415,11 @@ public: return GetPage(m_selPage); } - /** Returns last page. - */ - wxPropertyGridPage* GetLastPage() const - { - return GetPage(m_arrPages.size()-1); - } - /** Returns page object for given page index. */ wxPropertyGridPage* GetPage( unsigned int ind ) const { - return (wxPropertyGridPage*)m_arrPages.Item(ind); + return m_arrPages[ind]; } /** Returns page object for given page name. @@ -477,10 +442,12 @@ public: */ int GetPageByState( const wxPropertyGridPageState* pstate ) const; +protected: /** Returns wxPropertyGridPageState of given page, current page's for -1. */ virtual wxPropertyGridPageState* GetPageState( int page ) const; +public: /** Returns number of managed pages. */ size_t GetPageCount() const; @@ -495,14 +462,17 @@ public: /** Returns index to currently selected page. */ int GetSelectedPage() const { return m_selPage; } - /** Shortcut for GetGrid()->GetSelection(). */ + /** Alias for GetSelection(). */ wxPGProperty* GetSelectedProperty() const { - return m_pPropGrid->GetSelection(); + return GetSelection(); } - /** Synonyme for GetSelectedPage. */ - int GetSelection() const { return m_selPage; } + /** Shortcut for GetGrid()->GetSelection(). */ + wxPGProperty* GetSelection() const + { + return m_pPropGrid->GetSelection(); + } /** Returns a pointer to the toolbar currently associated with the wxPropertyGridManager (if any). */ @@ -520,13 +490,14 @@ public: @param pageObj wxPropertyGridPage instance. Manager will take ownership of this object. If NULL, default page object is constructed. + @return - Returns index to the page created. + Returns pointer to created page. */ - virtual int InsertPage( int index, - const wxString& label, - const wxBitmap& bmp = wxNullBitmap, - wxPropertyGridPage* pageObj = NULL ); + virtual wxPropertyGridPage* InsertPage( int index, + const wxString& label, + const wxBitmap& bmp = wxNullBitmap, + wxPropertyGridPage* pageObj = NULL ); /** Returns true if any property on any page has been modified by the user. @@ -554,10 +525,10 @@ public: */ virtual bool RemovePage( int page ); - /** Select and displays a given page. Also makes it target page for - insert operations etc. + /** Select and displays a given page. + @param index - Index of page being seleced. Can be -1 to select nothing. + Index of page being seleced. Can be -1 to select nothing. */ void SelectPage( int index ); @@ -593,12 +564,6 @@ public: /** Sets y coordinate of the description box splitter. */ void SetDescBoxHeight( int ht, bool refresh = true ); - /** Sets property attribute for all applicapple properties. - Be sure to use this method after all properties have been - added to the grid. - */ - void SetPropertyAttributeAll( const wxString& name, wxVariant value ); - /** Moves splitter as left as possible, while still allowing all labels to be shown in full. @param subProps @@ -623,12 +588,6 @@ public: */ void SetSplitterPosition( int pos, int column = 0 ); - /** Synonyme for SelectPage(name). */ - void SetStringSelection( const wxChar* name ) - { - SelectPage( GetPageByName(name) ); - } - #ifdef SWIG %pythoncode { def GetValuesFromPage(self, @@ -653,17 +612,13 @@ protected: */ virtual wxPropertyGrid* CreatePropertyGrid() const; - virtual void RefreshProperty( wxPGProperty* p ); - public: - -#ifndef DOXYGEN + virtual void RefreshProperty( wxPGProperty* p ); // // Overridden functions - no documentation required. // - virtual wxSize DoGetBestSize() const; void SetId( wxWindowID winid ); virtual void Freeze(); @@ -673,11 +628,13 @@ public: virtual void SetWindowStyleFlag ( long style ); protected: + virtual wxSize DoGetBestSize() const; public: #ifndef SWIG + virtual bool ProcessEvent( wxEvent& event ); // // Event handlers // @@ -696,7 +653,7 @@ protected: wxPropertyGrid* m_pPropGrid; - wxArrayPtrVoid m_arrPages; + wxVector m_arrPages; #if wxUSE_TOOLBAR wxToolBar* m_pToolbar; @@ -758,7 +715,7 @@ protected: /** (Re)creates/destroys controls, according to the window style bits. */ void RecreateControls(); - void RefreshHelpBox( int new_splittery, int new_width, int new_height ); + void UpdateDescriptionBox( int new_splittery, int new_width, int new_height ); void RepaintSplitter( wxDC& dc, int new_splittery, @@ -768,12 +725,13 @@ protected: void SetDescribedProperty( wxPGProperty* p ); - virtual bool ProcessEvent( wxEvent& event ); + // Reimplement these to handle "descboxheight" state item + virtual bool SetEditableStateItem( const wxString& name, wxVariant value ); + virtual wxVariant GetEditableStateItem( const wxString& name ) const; private: DECLARE_EVENT_TABLE() #endif // #ifndef SWIG -#endif // #ifndef DOXYGEN }; // ----------------------------------------------------------------------- @@ -787,4 +745,6 @@ inline int wxPropertyGridPage::GetIndex() const // ----------------------------------------------------------------------- +#endif // wxUSE_PROPGRID + #endif // _WX_PROPGRID_MANAGER_H_