Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
csnotebk.h
Go to the documentation of this file.00001 /* 00002 Crystal Space Windowing System: notebook class 00003 Copyright (C) 2000 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSNOTEBK_H__ 00021 #define __CS_CSNOTEBK_H__ 00022 00031 #include "csextern.h" 00032 00033 #include "cscomp.h" 00034 #include "csbutton.h" 00035 #include "csutil/parray.h" 00036 00045 00046 #define CSNBS_TABPOS_MASK 0x00000003 00047 00048 #define CSNBS_TABPOS_TOP 0x00000000 00049 00050 #define CSNBS_TABPOS_BOTTOM 0x00000001 00051 00052 #define CSNBS_TABPOS_LEFT 0x00000002 00053 00054 #define CSNBS_TABPOS_RIGHT 0x00000003 00055 00056 #define CSNBS_PAGEFRAME 0x00000010 00057 00058 #define CSNBS_PAGEINFO 0x00000020 00059 00060 #define CSNBS_THINTABS 0x00000040 00061 00062 #define CSNBS_DEFAULTVALUE \ 00063 CSNBS_TABPOS_TOP | CSNBS_PAGEFRAME | CSNBS_PAGEINFO 00064 00069 enum 00070 { 00080 cscmdNotebookLeavePage = 0x00000c00, 00091 cscmdNotebookSelectPage, 00099 cscmdNotebookNextPage, 00107 cscmdNotebookPrevPage, 00115 cscmdNotebookScrollTabsForward, 00123 cscmdNotebookScrollTabsBackward 00124 }; 00125 00126 class cspNotebookButton; 00127 00136 class CS_CSWS_EXPORT csNotebook : public csComponent 00137 { 00138 // Structure used to keep per-page private information 00139 struct cspPageData 00140 { 00141 // The page component 00142 csComponent *page; 00143 // Tab bounds (empty if not visible) 00144 csRect bound; 00145 // The Z-order of this tab (-1 if not visible) 00146 int zorder; 00147 // Notebook page flags (see NOTEBOOK_PAGE_XXX) 00148 unsigned char flags; 00149 00150 // The image on this tab (only primary pages) 00151 csPixmap *image; 00152 // The text on this tab 00153 char *text; 00154 // The underline position 00155 size_t underline_pos; 00156 00157 // Constructor 00158 cspPageData (csComponent *ipage, unsigned char iflags); 00159 // Destructor 00160 ~cspPageData (); 00161 // Check if this character is the hotkey for this tab 00162 bool IsHotKey (int iKey); 00163 }; 00164 00166 int style; 00168 csButton *nextpage, *prevpage; 00170 cspNotebookButton *tabfor, *taback; 00172 static csPixmap *sprites [12]; 00174 bool fReposition; 00176 size_t firsttab, activetab; 00178 csPDelArray<cspPageData> pages; 00179 00180 public: 00182 csNotebook (csComponent *iParent, int iStyle = CSNBS_DEFAULTVALUE); 00184 virtual ~csNotebook (); 00186 virtual void Draw (); 00188 virtual bool HandleEvent (iEvent &Event); 00189 00191 virtual bool SetRect (int xmin, int ymin, int xmax, int ymax); 00192 00194 int GetStyle () { return style; } 00196 void SetStyle (int iStyle); 00197 00199 bool AddPrimaryTab (csComponent *iComponent, const char *iText, 00200 const char *iInfo = 0, csComponent *iBefore = 0); 00202 bool AddSecondaryTab (csComponent *iComponent, const char *iInfo, 00203 csComponent *iBefore = 0); 00205 bool AddPrimaryTab (csComponent *iComponent, csPixmap *iPixmap, 00206 bool iDeletePixmap = true, const char *iInfo = 0, 00207 csComponent *iBefore = 0); 00208 00210 bool DeleteTab (size_t iIndex); 00212 bool DeleteTab (csComponent *iComponent); 00213 00215 bool SelectTab (size_t iIndex); 00217 bool SelectTab (csComponent *iComponent); 00218 00219 protected: 00221 int tabx, taby, tabw, tabh; 00222 size_t lasttab; 00223 int lastpos; 00224 size_t primary; 00225 00227 void PlaceGadgets (); 00229 bool AddTab (cspPageData *iPageData, const char *iInfo, 00230 csComponent *iBefore); 00232 void GetClientRect (csRect &oRect); 00234 int InfoHeight (); 00236 bool GetTabSize (size_t iTab, int &oW, int &oH); 00238 bool InsideTab (size_t iIndex, int x, int y); 00240 size_t FindPage (csComponent *iComponent); 00241 }; 00242 00245 #endif // __CS_CSNOTEBK_H__
Generated for Crystal Space by doxygen 1.3.9.1