notebook.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/notebook.h
  3. // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
  4. // Author: David Webster
  5. // Modified by:
  6. // Copyright: (c) David Webster
  7. // Licence: wxWindows licence
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef _NOTEBOOK_H
  10. #define _NOTEBOOK_H
  11. #if wxUSE_NOTEBOOK
  12. // ----------------------------------------------------------------------------
  13. // headers
  14. // ----------------------------------------------------------------------------
  15. #include "wx/control.h"
  16. // ----------------------------------------------------------------------------
  17. // wxNotebook
  18. // ----------------------------------------------------------------------------
  19. class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
  20. {
  21. public:
  22. //
  23. // Ctors
  24. // -----
  25. // Default for dynamic class
  26. //
  27. wxNotebook();
  28. //
  29. // the same arguments as for wxControl
  30. //
  31. wxNotebook( wxWindow* pParent
  32. ,wxWindowID vId
  33. ,const wxPoint& rPos = wxDefaultPosition
  34. ,const wxSize& rSize = wxDefaultSize
  35. ,long lStyle = 0
  36. ,const wxString& rsName = wxNotebookNameStr
  37. );
  38. bool Create( wxWindow* pParent
  39. ,wxWindowID vId
  40. ,const wxPoint& rPos = wxDefaultPosition
  41. ,const wxSize& rSize = wxDefaultSize
  42. ,long lStyle = 0
  43. ,const wxString& rsName = wxNotebookNameStr
  44. );
  45. //
  46. // Accessors
  47. // ---------
  48. // Get number of pages in the dialog
  49. //
  50. virtual size_t GetPageCount(void) const;
  51. //
  52. // Set the currently selected page, return the index of the previously
  53. // selected one (or wxNOT_FOUND on error)
  54. // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
  55. //
  56. int SetSelection(size_t nPage);
  57. // changes selected page without sending events
  58. int ChangeSelection(size_t nPage);
  59. //
  60. // Set/Get the title of a page
  61. //
  62. bool SetPageText( size_t nPage
  63. ,const wxString& sStrText
  64. );
  65. wxString GetPageText(size_t nPage) const;
  66. //
  67. // Image list stuff: each page may have an image associated with it. All
  68. // the images belong to an image list, so you have to
  69. // 1) create an image list
  70. // 2) associate it with the notebook
  71. // 3) set for each page it's image
  72. // associate image list with a control
  73. //
  74. void SetImageList(wxImageList* pImageList);
  75. //
  76. // Sets/returns item's image index in the current image list
  77. //
  78. int GetPageImage(size_t nPage) const;
  79. bool SetPageImage( size_t nPage
  80. ,int nImage
  81. );
  82. //
  83. // Currently it's always 1 because wxGTK doesn't support multi-row
  84. // tab controls
  85. //
  86. int GetRowCount(void) const;
  87. //
  88. // control the appearance of the notebook pages
  89. // set the size (the same for all pages)
  90. //
  91. void SetPageSize(const wxSize& rSize);
  92. //
  93. // Set the padding between tabs (in pixels)
  94. //
  95. void SetPadding(const wxSize& rPadding);
  96. //
  97. // Operations
  98. // ----------
  99. // Remove all pages
  100. //
  101. bool DeleteAllPages(void);
  102. //
  103. // Adds a new page to the notebook (it will be deleted ny the notebook,
  104. // don't delete it yourself). If bSelect, this page becomes active.
  105. //
  106. bool AddPage( wxNotebookPage* pPage
  107. ,const wxString& rsStrText
  108. ,bool bSelect = false
  109. ,int nImageId = -1
  110. );
  111. //
  112. // The same as AddPage(), but adds it at the specified position
  113. //
  114. bool InsertPage( size_t nPage
  115. ,wxNotebookPage* pPage
  116. ,const wxString& rsStrText
  117. ,bool bSelect = false
  118. ,int nImageId = -1
  119. );
  120. //
  121. // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
  122. // style.
  123. //
  124. void SetTabSize(const wxSize& rSize);
  125. //
  126. // Callbacks
  127. // ---------
  128. //
  129. void OnSize(wxSizeEvent& rEvent);
  130. void OnSelChange(wxBookCtrlEvent& rEvent);
  131. void OnSetFocus(wxFocusEvent& rEvent);
  132. void OnNavigationKey(wxNavigationKeyEvent& rEvent);
  133. //
  134. // Base class virtuals
  135. // -------------------
  136. //
  137. virtual bool OS2OnScroll( int nOrientation
  138. ,WXWORD wSBCode
  139. ,WXWORD wPos
  140. ,WXHWND hControl
  141. );
  142. virtual void SetConstraintSizes(bool bRecurse = true);
  143. virtual bool DoPhase(int nPhase);
  144. protected:
  145. //
  146. // Common part of all ctors
  147. //
  148. void Init(void);
  149. //
  150. // Translate wxWin styles to the PM ones
  151. //
  152. virtual WXDWORD OS2GetStyle( long lFlags
  153. ,WXDWORD* pwExstyle = NULL
  154. ) const;
  155. //
  156. // Remove one page from the notebook, without deleting
  157. //
  158. virtual wxNotebookPage* DoRemovePage(size_t nPage);
  159. //
  160. // Helper functions
  161. //
  162. private:
  163. wxArrayLong m_alPageId;
  164. int m_nTabSize; // holds the largest tab size
  165. DECLARE_DYNAMIC_CLASS(wxNotebook)
  166. DECLARE_EVENT_TABLE()
  167. }; // end of CLASS wxNotebook
  168. #endif // wxUSE_NOTEBOOK
  169. #endif // _NOTEBOOK_H