notebook.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/notebook.h
  3. // Purpose: wxNotebook class
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2004/04/08
  7. // Copyright: (c) 2004 David Elliott
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COCOA_NOTEBOOK_H__
  11. #define _WX_COCOA_NOTEBOOK_H__
  12. #include "wx/cocoa/NSTabView.h"
  13. // ========================================================================
  14. // wxNotebook
  15. // ========================================================================
  16. class WXDLLIMPEXP_CORE wxNotebook: public wxNotebookBase, protected wxCocoaNSTabView
  17. {
  18. DECLARE_DYNAMIC_CLASS(wxNotebook)
  19. DECLARE_EVENT_TABLE()
  20. WX_DECLARE_COCOA_OWNER(NSTabView,NSView,NSView)
  21. // ------------------------------------------------------------------------
  22. // initialization
  23. // ------------------------------------------------------------------------
  24. public:
  25. wxNotebook() { }
  26. wxNotebook(wxWindow *parent, wxWindowID winid,
  27. const wxPoint& pos = wxDefaultPosition,
  28. const wxSize& size = wxDefaultSize,
  29. long style = 0,
  30. const wxString& name = wxNotebookNameStr)
  31. {
  32. Create(parent, winid, pos, size, style, name);
  33. }
  34. bool Create(wxWindow *parent, wxWindowID winid,
  35. const wxPoint& pos = wxDefaultPosition,
  36. const wxSize& size = wxDefaultSize,
  37. long style = 0,
  38. const wxString& name = wxNotebookNameStr);
  39. virtual ~wxNotebook();
  40. // ------------------------------------------------------------------------
  41. // Cocoa callbacks
  42. // ------------------------------------------------------------------------
  43. protected:
  44. // Notebooks cannot be enabled/disabled
  45. virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { }
  46. virtual void CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabviewItem);
  47. virtual bool CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabviewItem);
  48. // ------------------------------------------------------------------------
  49. // Implementation
  50. // ------------------------------------------------------------------------
  51. public:
  52. // set the currently selected page, return the index of the previously
  53. // selected one (or wxNOT_FOUND on error)
  54. int SetSelection(size_t nPage);
  55. // get the currently selected page
  56. int GetSelection() const;
  57. // changes selected page without sending events
  58. int ChangeSelection(size_t nPage);
  59. // set/get the title of a page
  60. bool SetPageText(size_t nPage, const wxString& strText);
  61. wxString GetPageText(size_t nPage) const;
  62. // sets/returns item's image index in the current image list
  63. int GetPageImage(size_t nPage) const;
  64. bool SetPageImage(size_t nPage, int nImage);
  65. // set the size (the same for all pages)
  66. void SetPageSize(const wxSize& size);
  67. // SetPadding and SetTabSize aren't possible to implement
  68. void SetPadding(const wxSize& padding);
  69. void SetTabSize(const wxSize& sz);
  70. //-----------------------
  71. // adding/removing pages
  72. // remove one page from the notebook, without deleting
  73. virtual wxNotebookPage *DoRemovePage(size_t nPage);
  74. // remove one page from the notebook
  75. bool DeletePage(size_t nPage);
  76. // remove all pages
  77. bool DeleteAllPages();
  78. // adds a new page to the notebook (it will be deleted ny the notebook,
  79. // don't delete it yourself). If bSelect, this page becomes active.
  80. // the same as AddPage(), but adds it at the specified position
  81. bool InsertPage( size_t position,
  82. wxNotebookPage *win,
  83. const wxString& strText,
  84. bool bSelect = false,
  85. int imageId = NO_IMAGE );
  86. protected:
  87. };
  88. #endif //ndef _WX_COCOA_NOTEBOOK_H__