Main Page | Class Hierarchy | Class List | File List | Class Members

TablessNotebook.h

00001 00002 // Name: TablessNotebook.h 00003 // Purpose: wxTablessNotebook class 00004 // Author: Alex Thuering (a modifiecation of generic/notebook.h) 00005 // Created: 06.10.03 00006 // RCS-ID: $Id: TablessNotebook.h,v 1.8 2004/03/21 12:50:30 ntalex Exp $ 00007 // Copyright: (c) Alex Thuering 00008 // Licence: wxWindows licence 00010 00011 #ifndef WXVILLALIB_WX_TABLESSNOTEBOOK_H_ 00012 #define WXVILLALIB_WX_TABLESSNOTEBOOK_H_ 00013 00014 // ---------------------------------------------------------------------------- 00015 // headers 00016 // ---------------------------------------------------------------------------- 00017 #include "wx/dynarray.h" 00018 #include "wx/event.h" 00019 #include "wx/control.h" 00020 #include "wx/panel.h" 00021 #include "wx/generic/tabg.h" 00022 #include "wx/notebook.h" 00023 00024 // ---------------------------------------------------------------------------- 00025 // types 00026 // ---------------------------------------------------------------------------- 00027 00028 // ---------------------------------------------------------------------------- 00029 // wxTablessNotebook 00030 // ---------------------------------------------------------------------------- 00031 #if wxCHECK_VERSION(2,5,0) 00032 #define size_tt size_t 00033 #else 00034 #define size_tt int 00035 #endif 00036 00037 class wxTablessNotebook : public wxNotebookBase 00038 { 00039 public: 00040 // ctors 00041 // ----- 00042 // default for dynamic class 00043 wxTablessNotebook(); 00044 // the same arguments as for wxControl (@@@ any special styles?) 00045 wxTablessNotebook(wxWindow *parent, 00046 wxWindowID id, 00047 const wxPoint& pos = wxDefaultPosition, 00048 const wxSize& size = wxDefaultSize, 00049 long style = 0, 00050 const wxString& name = _T("notebook")); 00051 // Create() function 00052 bool Create(wxWindow *parent, 00053 wxWindowID id, 00054 const wxPoint& pos = wxDefaultPosition, 00055 const wxSize& size = wxDefaultSize, 00056 long style = 0, 00057 const wxString& name = _T("notebook")); 00058 // dtor 00059 ~wxTablessNotebook(); 00060 00061 // accessors 00062 // --------- 00063 // Find the position of the wxNotebookPage, -1 if not found. 00064 int FindPagePosition(wxNotebookPage* page) const; 00065 00066 // set the currently selected page, return the index of the previously 00067 // selected one (or -1 on error) 00068 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events 00069 int SetSelection(size_tt nPage); 00070 // cycle thru the tabs 00071 // void AdvanceSelection(bool bForward = TRUE); 00072 // get the currently selected page 00073 int GetSelection() const { return m_nSelection; } 00074 00075 // set/get the title of a page 00076 bool SetPageText(size_tt n, const wxString& strText) { return true; }; 00077 wxString GetPageText(size_tt n) const { return wxEmptyString; } 00078 00079 // get the number of rows for a control with wxNB_MULTILINE style (not all 00080 // versions support it - they will always return 1 then) 00081 virtual int GetRowCount() const ; 00082 00083 // sets/returns item's image index in the current image list 00084 int GetPageImage(size_tt n) const { return 0; } 00085 bool SetPageImage(size_tt n, int imageId) { return true; } 00086 00087 // control the appearance of the notebook pages 00088 // set the size (the same for all pages) 00089 void SetPageSize(const wxSize& size) {} 00090 // set the padding between tabs (in pixels) 00091 void SetPadding(const wxSize& padding) {} 00092 00093 // Sets the size of the tabs (assumes all tabs are the same size) 00094 void SetTabSize(const wxSize& sz) {} 00095 00096 // operations 00097 // ---------- 00098 // remove one page from the notebook, and delete the page. 00099 bool DeletePage(size_tt nPage); 00100 bool DeletePage(wxNotebookPage* page); 00101 // remove one page from the notebook, without deleting the page. 00102 bool RemovePage(size_tt nPage); 00103 bool RemovePage(wxNotebookPage* page); 00104 // remove all pages 00105 bool DeleteAllPages(); 00106 // the same as AddPage(), but adds it at the specified position 00107 bool InsertPage(size_tt nPage, 00108 wxNotebookPage *pPage, 00109 const wxString& strText, 00110 bool bSelect = FALSE, 00111 int imageId = -1); 00112 00113 // callbacks 00114 // --------- 00115 void OnSize(wxSizeEvent& event); 00116 void OnIdle(wxIdleEvent& event); 00117 void OnSelChange(wxNotebookEvent& event); 00118 void OnSetFocus(wxFocusEvent& event); 00119 void OnNavigationKey(wxNavigationKeyEvent& event); 00120 00121 // base class virtuals 00122 // ------------------- 00123 virtual void Command(wxCommandEvent& event); 00124 virtual void SetConstraintSizes(bool recurse = TRUE); 00125 virtual bool DoPhase(int nPhase); 00126 00127 // Implementation 00128 00129 void OnMouseEvent(wxMouseEvent& event); 00130 void OnPaint(wxPaintEvent& event); 00131 00132 virtual wxRect GetAvailableClientSize(); 00133 00134 // Implementation: calculate the layout of the view rect 00135 // and resize the children if required 00136 bool RefreshLayout(bool force = TRUE); 00137 00138 protected: 00139 // remove the page and return a pointer to it 00140 wxWindow *DoRemovePage(size_t page) { return NULL; } 00141 00142 // common part of all ctors 00143 void Init(); 00144 00145 // helper functions 00146 void ChangePage(int nOldSel, int nSel); // change pages 00147 00148 int m_nSelection; // the current selection (-1 if none) 00149 00150 DECLARE_DYNAMIC_CLASS(wxTablessNotebook) 00151 DECLARE_EVENT_TABLE() 00152 }; 00153 00154 #endif // WXVILLALIB_WX_TABLESSNOTEBOOK_H_

Generated on Mon Nov 19 21:06:44 2007 for wxVillaLib by doxygen 1.3.7