manager.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/propgrid/manager.h
  3. // Purpose: wxPropertyGridManager
  4. // Author: Jaakko Salli
  5. // Modified by:
  6. // Created: 2005-01-14
  7. // Copyright: (c) Jaakko Salli
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_PROPGRID_MANAGER_H_
  11. #define _WX_PROPGRID_MANAGER_H_
  12. #include "wx/defs.h"
  13. #if wxUSE_PROPGRID
  14. #include "wx/propgrid/propgrid.h"
  15. #include "wx/dcclient.h"
  16. #include "wx/scrolwin.h"
  17. #include "wx/toolbar.h"
  18. #include "wx/stattext.h"
  19. #include "wx/button.h"
  20. #include "wx/textctrl.h"
  21. #include "wx/dialog.h"
  22. #include "wx/headerctrl.h"
  23. // -----------------------------------------------------------------------
  24. #ifndef SWIG
  25. extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridManagerNameStr[];
  26. #endif
  27. /** @class wxPropertyGridPage
  28. Holder of property grid page information. You can subclass this and
  29. give instance in wxPropertyGridManager::AddPage. It inherits from
  30. wxEvtHandler and can be used to process events specific to this
  31. page (id of events will still be same as manager's). If you don't
  32. want to use it to process all events of the page, you need to
  33. return false in the derived wxPropertyGridPage::IsHandlingAllEvents.
  34. Please note that wxPropertyGridPage lacks many non-const property
  35. manipulation functions found in wxPropertyGridManager. Please use
  36. parent manager (m_manager member variable) when needed.
  37. Please note that most member functions are inherited and as such not
  38. documented on this page. This means you will probably also want to read
  39. wxPropertyGridInterface class reference.
  40. @section propgridpage_event_handling Event Handling
  41. wxPropertyGridPage receives events emitted by its wxPropertyGridManager, but
  42. only those events that are specific to that page. If
  43. wxPropertyGridPage::IsHandlingAllEvents returns false, then unhandled
  44. events are sent to the manager's parent, as usual.
  45. See @ref propgrid_event_handling "wxPropertyGrid Event Handling"
  46. for more information.
  47. @library{wxpropgrid}
  48. @category{propgrid}
  49. */
  50. class WXDLLIMPEXP_PROPGRID wxPropertyGridPage : public wxEvtHandler,
  51. public wxPropertyGridInterface,
  52. public wxPropertyGridPageState
  53. {
  54. friend class wxPropertyGridManager;
  55. DECLARE_CLASS(wxPropertyGridPage)
  56. public:
  57. wxPropertyGridPage();
  58. virtual ~wxPropertyGridPage();
  59. /** Deletes all properties on page.
  60. */
  61. virtual void Clear();
  62. /**
  63. Reduces column sizes to minimum possible that contents are still
  64. visibly (naturally some margin space will be applied as well).
  65. @return
  66. Minimum size for the page to still display everything.
  67. @remarks
  68. This function only works properly if size of containing grid was
  69. already fairly large.
  70. Note that you can also get calculated column widths by calling
  71. GetColumnWidth() immediately after this function returns.
  72. */
  73. wxSize FitColumns();
  74. /** Returns page index in manager;
  75. */
  76. inline int GetIndex() const;
  77. /** Returns x-coordinate position of splitter on a page.
  78. */
  79. int GetSplitterPosition( int col = 0 ) const
  80. { return GetStatePtr()->DoGetSplitterPosition(col); }
  81. /** Returns "root property". It does not have name, etc. and it is not
  82. visible. It is only useful for accessing its children.
  83. */
  84. wxPGProperty* GetRoot() const { return GetStatePtr()->DoGetRoot(); }
  85. /** Return pointer to contained property grid state.
  86. */
  87. wxPropertyGridPageState* GetStatePtr()
  88. {
  89. return this;
  90. }
  91. /** Return pointer to contained property grid state.
  92. */
  93. const wxPropertyGridPageState* GetStatePtr() const
  94. {
  95. return this;
  96. }
  97. /**
  98. Returns id of the tool bar item that represents this page on
  99. wxPropertyGridManager's wxToolBar.
  100. */
  101. int GetToolId() const
  102. {
  103. return m_toolId;
  104. }
  105. /** Do any member initialization in this method.
  106. @remarks
  107. - Called every time the page is added into a manager.
  108. - You can add properties to the page here.
  109. */
  110. virtual void Init() {}
  111. /** Return false here to indicate unhandled events should be
  112. propagated to manager's parent, as normal.
  113. */
  114. virtual bool IsHandlingAllEvents() const { return true; }
  115. /** Called every time page is about to be shown.
  116. Useful, for instance, creating properties just-in-time.
  117. */
  118. virtual void OnShow();
  119. virtual void RefreshProperty( wxPGProperty* p );
  120. /** Sets splitter position on page.
  121. @remarks
  122. Splitter position cannot exceed grid size, and therefore setting it
  123. during form creation may fail as initial grid size is often smaller
  124. than desired splitter position, especially when sizers are being used.
  125. */
  126. void SetSplitterPosition( int splitterPos, int col = 0 );
  127. protected:
  128. /** Propagate to other pages.
  129. */
  130. virtual void DoSetSplitterPosition( int pos,
  131. int splitterColumn = 0,
  132. int flags = wxPG_SPLITTER_REFRESH );
  133. /** Page label (may be referred as name in some parts of documentation).
  134. Can be set in constructor, or passed in
  135. wxPropertyGridManager::AddPage(), but *not* in both.
  136. */
  137. wxString m_label;
  138. //virtual bool ProcessEvent( wxEvent& event );
  139. wxPropertyGridManager* m_manager;
  140. // Toolbar tool id. Note that this is only valid when the tool bar
  141. // exists.
  142. int m_toolId;
  143. private:
  144. bool m_isDefault; // is this base page object?
  145. DECLARE_EVENT_TABLE()
  146. };
  147. // -----------------------------------------------------------------------
  148. #if wxUSE_HEADERCTRL
  149. class wxPGHeaderCtrl;
  150. #endif
  151. /** @class wxPropertyGridManager
  152. wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid,
  153. which can optionally have toolbar for mode and page selection, and help
  154. text box.
  155. Use window flags to select components to include.
  156. @section propgridmanager_window_styles_ Window Styles
  157. See @ref propgrid_window_styles.
  158. @section propgridmanager_event_handling Event Handling
  159. See @ref propgrid_event_handling "wxPropertyGrid Event Handling"
  160. for more information.
  161. @library{wxpropgrid}
  162. @category{propgrid}
  163. */
  164. class WXDLLIMPEXP_PROPGRID
  165. wxPropertyGridManager : public wxPanel, public wxPropertyGridInterface
  166. {
  167. DECLARE_CLASS(wxPropertyGridManager)
  168. friend class wxPropertyGridPage;
  169. public:
  170. #ifndef SWIG
  171. /**
  172. Two step constructor.
  173. Call Create when this constructor is called to build up the
  174. wxPropertyGridManager.
  175. */
  176. wxPropertyGridManager();
  177. #endif
  178. /** The default constructor. The styles to be used are styles valid for
  179. the wxWindow.
  180. @see @link wndflags Additional Window Styles@endlink
  181. */
  182. wxPropertyGridManager( wxWindow *parent, wxWindowID id = wxID_ANY,
  183. const wxPoint& pos = wxDefaultPosition,
  184. const wxSize& size = wxDefaultSize,
  185. long style = wxPGMAN_DEFAULT_STYLE,
  186. const wxString& name = wxPropertyGridManagerNameStr );
  187. /** Destructor */
  188. virtual ~wxPropertyGridManager();
  189. /** Creates new property page. Note that the first page is not created
  190. automatically.
  191. @param label
  192. A label for the page. This may be shown as a toolbar tooltip etc.
  193. @param bmp
  194. Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
  195. default image is used.
  196. @param pageObj
  197. wxPropertyGridPage instance. Manager will take ownership of this object.
  198. NULL indicates that a default page instance should be created.
  199. @return
  200. Returns pointer to created page.
  201. @remarks
  202. If toolbar is used, it is highly recommended that the pages are
  203. added when the toolbar is not turned off using window style flag
  204. switching.
  205. */
  206. wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
  207. const wxBitmap& bmp = wxPG_NULL_BITMAP,
  208. wxPropertyGridPage* pageObj = NULL )
  209. {
  210. return InsertPage(-1, label, bmp, pageObj);
  211. }
  212. /** Deletes all all properties and all pages.
  213. */
  214. virtual void Clear();
  215. /** Deletes all properties on given page.
  216. */
  217. void ClearPage( int page );
  218. /** Forces updating the value of property from the editor control.
  219. Returns true if DoPropertyChanged was actually called.
  220. */
  221. bool CommitChangesFromEditor( wxUint32 flags = 0 )
  222. {
  223. return m_pPropGrid->CommitChangesFromEditor(flags);
  224. }
  225. /**
  226. Two step creation.
  227. Whenever the control is created without any parameters, use Create to
  228. actually create it. Don't access the control's public methods before
  229. this is called.
  230. @see @link wndflags Additional Window Styles@endlink
  231. */
  232. bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
  233. const wxPoint& pos = wxDefaultPosition,
  234. const wxSize& size = wxDefaultSize,
  235. long style = wxPGMAN_DEFAULT_STYLE,
  236. const wxString& name = wxPropertyGridManagerNameStr );
  237. /**
  238. Enables or disables (shows/hides) categories according to parameter
  239. enable.
  240. WARNING: Not tested properly, use at your own risk.
  241. */
  242. bool EnableCategories( bool enable )
  243. {
  244. long fl = m_windowStyle | wxPG_HIDE_CATEGORIES;
  245. if ( enable ) fl = m_windowStyle & ~(wxPG_HIDE_CATEGORIES);
  246. SetWindowStyleFlag(fl);
  247. return true;
  248. }
  249. /** Selects page, scrolls and/or expands items to ensure that the
  250. given item is visible. Returns true if something was actually done.
  251. */
  252. bool EnsureVisible( wxPGPropArg id );
  253. /** Returns number of columns on given page. By the default,
  254. returns number of columns on current page. */
  255. int GetColumnCount( int page = -1 ) const;
  256. /** Returns height of the description text box. */
  257. int GetDescBoxHeight() const;
  258. /** Returns pointer to the contained wxPropertyGrid. This does not change
  259. after wxPropertyGridManager has been created, so you can safely obtain
  260. pointer once and use it for the entire lifetime of the instance.
  261. */
  262. wxPropertyGrid* GetGrid()
  263. {
  264. wxASSERT(m_pPropGrid);
  265. return m_pPropGrid;
  266. }
  267. const wxPropertyGrid* GetGrid() const
  268. {
  269. wxASSERT(m_pPropGrid);
  270. return (const wxPropertyGrid*)m_pPropGrid;
  271. }
  272. /** Returns iterator class instance.
  273. @remarks
  274. Calling this method in wxPropertyGridManager causes run-time assertion
  275. failure. Please only iterate through individual pages or use
  276. CreateVIterator().
  277. */
  278. wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
  279. wxPGProperty* firstProp = NULL )
  280. {
  281. wxFAIL_MSG( "Please only iterate through individual pages "
  282. "or use CreateVIterator()" );
  283. return wxPropertyGridInterface::GetIterator( flags, firstProp );
  284. }
  285. wxPropertyGridConstIterator
  286. GetIterator(int flags = wxPG_ITERATE_DEFAULT,
  287. wxPGProperty* firstProp = NULL) const
  288. {
  289. wxFAIL_MSG( "Please only iterate through individual pages "
  290. " or use CreateVIterator()" );
  291. return wxPropertyGridInterface::GetIterator( flags, firstProp );
  292. }
  293. /** Returns iterator class instance.
  294. @remarks
  295. Calling this method in wxPropertyGridManager causes run-time assertion
  296. failure. Please only iterate through individual pages or use
  297. CreateVIterator().
  298. */
  299. wxPropertyGridIterator GetIterator( int flags, int startPos )
  300. {
  301. wxFAIL_MSG( "Please only iterate through individual pages "
  302. "or use CreateVIterator()" );
  303. return wxPropertyGridInterface::GetIterator( flags, startPos );
  304. }
  305. wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const
  306. {
  307. wxFAIL_MSG( "Please only iterate through individual pages "
  308. "or use CreateVIterator()" );
  309. return wxPropertyGridInterface::GetIterator( flags, startPos );
  310. }
  311. /** Similar to GetIterator, but instead returns wxPGVIterator instance,
  312. which can be useful for forward-iterating through arbitrary property
  313. containers.
  314. */
  315. virtual wxPGVIterator GetVIterator( int flags ) const;
  316. /** Returns currently selected page.
  317. */
  318. wxPropertyGridPage* GetCurrentPage() const
  319. {
  320. return GetPage(m_selPage);
  321. }
  322. /** Returns page object for given page index.
  323. */
  324. wxPropertyGridPage* GetPage( unsigned int ind ) const
  325. {
  326. return m_arrPages[ind];
  327. }
  328. /** Returns page object for given page name.
  329. */
  330. wxPropertyGridPage* GetPage( const wxString& name ) const
  331. {
  332. return GetPage(GetPageByName(name));
  333. }
  334. /**
  335. Returns index for a page name.
  336. If no match is found, wxNOT_FOUND is returned.
  337. */
  338. int GetPageByName( const wxString& name ) const;
  339. /** Returns index for a relevant propertygrid state.
  340. If no match is found, wxNOT_FOUND is returned.
  341. */
  342. int GetPageByState( const wxPropertyGridPageState* pstate ) const;
  343. protected:
  344. /** Returns wxPropertyGridPageState of given page, current page's for -1.
  345. */
  346. virtual wxPropertyGridPageState* GetPageState( int page ) const;
  347. public:
  348. /** Returns number of managed pages. */
  349. size_t GetPageCount() const;
  350. /** Returns name of given page. */
  351. const wxString& GetPageName( int index ) const;
  352. /** Returns "root property" of the given page. It does not have name, etc.
  353. and it is not visible. It is only useful for accessing its children.
  354. */
  355. wxPGProperty* GetPageRoot( int index ) const;
  356. /** Returns index to currently selected page. */
  357. int GetSelectedPage() const { return m_selPage; }
  358. /** Alias for GetSelection(). */
  359. wxPGProperty* GetSelectedProperty() const
  360. {
  361. return GetSelection();
  362. }
  363. /** Shortcut for GetGrid()->GetSelection(). */
  364. wxPGProperty* GetSelection() const
  365. {
  366. return m_pPropGrid->GetSelection();
  367. }
  368. /** Returns a pointer to the toolbar currently associated with the
  369. wxPropertyGridManager (if any). */
  370. wxToolBar* GetToolBar() const { return m_pToolbar; }
  371. /** Creates new property page. Note that the first page is not created
  372. automatically.
  373. @param index
  374. Add to this position. -1 will add as the last item.
  375. @param label
  376. A label for the page. This may be shown as a toolbar tooltip etc.
  377. @param bmp
  378. Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
  379. default image is used.
  380. @param pageObj
  381. wxPropertyGridPage instance. Manager will take ownership of this object.
  382. If NULL, default page object is constructed.
  383. @return
  384. Returns pointer to created page.
  385. */
  386. virtual wxPropertyGridPage* InsertPage( int index,
  387. const wxString& label,
  388. const wxBitmap& bmp = wxNullBitmap,
  389. wxPropertyGridPage* pageObj = NULL );
  390. /**
  391. Returns true if any property on any page has been modified by the user.
  392. */
  393. bool IsAnyModified() const;
  394. /**
  395. Returns true if updating is frozen (ie Freeze() called but not yet
  396. Thaw() ).
  397. */
  398. bool IsFrozen() const { return m_pPropGrid->m_frozen > 0; }
  399. /**
  400. Returns true if any property on given page has been modified by the
  401. user.
  402. */
  403. bool IsPageModified( size_t index ) const;
  404. /**
  405. Returns true if property is selected. Since selection is page
  406. based, this function checks every page in the manager.
  407. */
  408. virtual bool IsPropertySelected( wxPGPropArg id ) const;
  409. virtual void Refresh( bool eraseBackground = true,
  410. const wxRect* rect = (const wxRect*) NULL );
  411. /** Removes a page.
  412. @return
  413. Returns false if it was not possible to remove page in question.
  414. */
  415. virtual bool RemovePage( int page );
  416. /** Select and displays a given page.
  417. @param index
  418. Index of page being seleced. Can be -1 to select nothing.
  419. */
  420. void SelectPage( int index );
  421. /** Select and displays a given page (by label). */
  422. void SelectPage( const wxString& label )
  423. {
  424. int index = GetPageByName(label);
  425. wxCHECK_RET( index >= 0, wxT("No page with such name") );
  426. SelectPage( index );
  427. }
  428. /** Select and displays a given page. */
  429. void SelectPage( wxPropertyGridPage* ptr )
  430. {
  431. SelectPage( GetPageByState(ptr) );
  432. }
  433. /** Select a property. */
  434. bool SelectProperty( wxPGPropArg id, bool focus = false )
  435. {
  436. wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
  437. return p->GetParentState()->DoSelectProperty(p, focus);
  438. }
  439. /**
  440. Sets a column title. Default title for column 0 is "Property",
  441. and "Value" for column 1.
  442. @remarks If header is not shown yet, then calling this
  443. member function will make it visible.
  444. */
  445. void SetColumnTitle( int idx, const wxString& title );
  446. /**
  447. Sets number of columns on given page (default is current page).
  448. @remarks If you use header, then you should always use this
  449. member function to set the column count, instead of
  450. ones present in wxPropertyGrid or wxPropertyGridPage.
  451. */
  452. void SetColumnCount( int colCount, int page = -1 );
  453. /** Sets label and text in description box.
  454. */
  455. void SetDescription( const wxString& label, const wxString& content );
  456. /** Sets y coordinate of the description box splitter. */
  457. void SetDescBoxHeight( int ht, bool refresh = true );
  458. /** Moves splitter as left as possible, while still allowing all
  459. labels to be shown in full.
  460. @param subProps
  461. If false, will still allow sub-properties (ie. properties which
  462. parent is not root or category) to be cropped.
  463. @param allPages
  464. If true, takes labels on all pages into account.
  465. */
  466. void SetSplitterLeft( bool subProps = false, bool allPages = true );
  467. /** Moves splitter as left as possible on an individual page, while still allowing all
  468. labels to be shown in full.
  469. */
  470. void SetPageSplitterLeft(int page, bool subProps = false);
  471. /**
  472. Sets splitter position on individual page.
  473. @remarks If you use header, then you should always use this
  474. member function to set the splitter position, instead of
  475. ones present in wxPropertyGrid or wxPropertyGridPage.
  476. */
  477. void SetPageSplitterPosition( int page, int pos, int column = 0 );
  478. /**
  479. Sets splitter position for all pages.
  480. @remarks Splitter position cannot exceed grid size, and therefore
  481. setting it during form creation may fail as initial grid
  482. size is often smaller than desired splitter position,
  483. especially when sizers are being used.
  484. If you use header, then you should always use this
  485. member function to set the splitter position, instead of
  486. ones present in wxPropertyGrid or wxPropertyGridPage.
  487. */
  488. void SetSplitterPosition( int pos, int column = 0 );
  489. #if wxUSE_HEADERCTRL
  490. /**
  491. Show or hide the property grid header control. It is hidden
  492. by the default.
  493. @remarks Grid may look better if you use wxPG_NO_INTERNAL_BORDER
  494. window style when showing a header.
  495. */
  496. void ShowHeader(bool show = true);
  497. #endif
  498. protected:
  499. //
  500. // Subclassing helpers
  501. //
  502. /**
  503. Creates property grid for the manager. Reimplement in derived class to
  504. use subclassed wxPropertyGrid. However, if you do this then you
  505. must also use the two-step construction (ie. default constructor and
  506. Create() instead of constructor with arguments) when creating the
  507. manager.
  508. */
  509. virtual wxPropertyGrid* CreatePropertyGrid() const;
  510. public:
  511. virtual void RefreshProperty( wxPGProperty* p );
  512. //
  513. // Overridden functions - no documentation required.
  514. //
  515. void SetId( wxWindowID winid );
  516. virtual void Freeze();
  517. virtual void Thaw();
  518. virtual void SetExtraStyle ( long exStyle );
  519. virtual bool SetFont ( const wxFont& font );
  520. virtual void SetWindowStyleFlag ( long style );
  521. virtual bool Reparent( wxWindowBase *newParent );
  522. protected:
  523. virtual wxSize DoGetBestSize() const;
  524. //
  525. // Event handlers
  526. //
  527. void OnMouseMove( wxMouseEvent &event );
  528. void OnMouseClick( wxMouseEvent &event );
  529. void OnMouseUp( wxMouseEvent &event );
  530. void OnMouseEntry( wxMouseEvent &event );
  531. void OnPaint( wxPaintEvent &event );
  532. void OnToolbarClick( wxCommandEvent &event );
  533. void OnResize( wxSizeEvent& event );
  534. void OnPropertyGridSelect( wxPropertyGridEvent& event );
  535. void OnPGColDrag( wxPropertyGridEvent& event );
  536. wxPropertyGrid* m_pPropGrid;
  537. wxVector<wxPropertyGridPage*> m_arrPages;
  538. #if wxUSE_TOOLBAR
  539. wxToolBar* m_pToolbar;
  540. #endif
  541. #if wxUSE_HEADERCTRL
  542. wxPGHeaderCtrl* m_pHeaderCtrl;
  543. #endif
  544. wxStaticText* m_pTxtHelpCaption;
  545. wxStaticText* m_pTxtHelpContent;
  546. wxPropertyGridPage* m_emptyPage;
  547. wxArrayString m_columnLabels;
  548. long m_iFlags;
  549. // Selected page index.
  550. int m_selPage;
  551. int m_width;
  552. int m_height;
  553. int m_extraHeight;
  554. int m_splitterY;
  555. int m_splitterHeight;
  556. int m_dragOffset;
  557. wxCursor m_cursorSizeNS;
  558. int m_nextDescBoxSize;
  559. // Toolbar tool ids for categorized and alphabetic mode selectors.
  560. int m_categorizedModeToolId;
  561. int m_alphabeticModeToolId;
  562. unsigned char m_dragStatus;
  563. unsigned char m_onSplitter;
  564. bool m_showHeader;
  565. virtual wxPGProperty* DoGetPropertyByName( const wxString& name ) const;
  566. /** Select and displays a given page. */
  567. virtual bool DoSelectPage( int index );
  568. // Sets some members to defaults.
  569. void Init1();
  570. // Initializes some members.
  571. void Init2( int style );
  572. /*#ifdef __WXMSW__
  573. virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const;
  574. #endif*/
  575. virtual bool ProcessEvent( wxEvent& event );
  576. /** Recalculates new positions for components, according to the
  577. given size.
  578. */
  579. void RecalculatePositions( int width, int height );
  580. /** (Re)creates/destroys controls, according to the window style bits. */
  581. void RecreateControls();
  582. void UpdateDescriptionBox( int new_splittery, int new_width, int new_height );
  583. void RepaintDescBoxDecorations( wxDC& dc,
  584. int newSplitterY,
  585. int newWidth,
  586. int newHeight );
  587. void SetDescribedProperty( wxPGProperty* p );
  588. // Reimplement these to handle "descboxheight" state item
  589. virtual bool SetEditableStateItem( const wxString& name, wxVariant value );
  590. virtual wxVariant GetEditableStateItem( const wxString& name ) const;
  591. private:
  592. DECLARE_EVENT_TABLE()
  593. };
  594. // -----------------------------------------------------------------------
  595. inline int wxPropertyGridPage::GetIndex() const
  596. {
  597. if ( !m_manager )
  598. return wxNOT_FOUND;
  599. return m_manager->GetPageByState(this);
  600. }
  601. // -----------------------------------------------------------------------
  602. #endif // wxUSE_PROPGRID
  603. #endif // _WX_PROPGRID_MANAGER_H_