00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CSNOTEBK_H__
00021 #define __CSNOTEBK_H__
00022
00023 #include "cscomp.h"
00024 #include "csbutton.h"
00025
00034
00035 #define CSNBS_TABPOS_MASK 0x00000003
00036
00037 #define CSNBS_TABPOS_TOP 0x00000000
00038
00039 #define CSNBS_TABPOS_BOTTOM 0x00000001
00040
00041 #define CSNBS_TABPOS_LEFT 0x00000002
00042
00043 #define CSNBS_TABPOS_RIGHT 0x00000003
00044
00045 #define CSNBS_PAGEFRAME 0x00000010
00046
00047 #define CSNBS_PAGEINFO 0x00000020
00048
00049 #define CSNBS_THINTABS 0x00000040
00050
00051 #define CSNBS_DEFAULTVALUE CSNBS_TABPOS_TOP | \
00052 CSNBS_PAGEFRAME | \
00053 CSNBS_PAGEINFO
00054
00058 enum
00059 {
00069 cscmdNotebookLeavePage = 0x00000c00,
00080 cscmdNotebookSelectPage,
00088 cscmdNotebookNextPage,
00096 cscmdNotebookPrevPage,
00104 cscmdNotebookScrollTabsForward,
00112 cscmdNotebookScrollTabsBackward
00113 };
00114
00115 class cspNotebookButton;
00116
00125 class csNotebook : public csComponent
00126 {
00127
00128 struct cspPageData
00129 {
00130
00131 csComponent *page;
00132
00133 csRect bound;
00134
00135 int zorder;
00136
00137 unsigned char flags;
00138
00139
00140 csPixmap *image;
00141
00142 char *text;
00143
00144 int underline_pos;
00145
00146
00147 cspPageData (csComponent *ipage, unsigned char iflags);
00148
00149 ~cspPageData ();
00150
00151 bool IsHotKey (int iKey);
00152 };
00153
00155 int style;
00157 csButton *nextpage, *prevpage;
00159 cspNotebookButton *tabfor, *taback;
00161 static csPixmap *sprites [12];
00163 bool fReposition;
00165 int firsttab, activetab;
00167 CS_DECLARE_TYPED_VECTOR (cspPageDataVector, cspPageData) pages;
00168
00169 public:
00171 csNotebook (csComponent *iParent, int iStyle = CSNBS_DEFAULTVALUE);
00173 virtual ~csNotebook ();
00175 virtual void Draw ();
00177 virtual bool HandleEvent (iEvent &Event);
00178
00180 virtual bool SetRect (int xmin, int ymin, int xmax, int ymax);
00181
00183 int GetStyle () { return style; }
00185 void SetStyle (int iStyle);
00186
00188 bool AddPrimaryTab (csComponent *iComponent, const char *iText,
00189 const char *iInfo = NULL, csComponent *iBefore = NULL);
00191 bool AddSecondaryTab (csComponent *iComponent, const char *iInfo,
00192 csComponent *iBefore = NULL);
00194 bool AddPrimaryTab (csComponent *iComponent, csPixmap *iPixmap,
00195 bool iDeletePixmap = true, const char *iInfo = NULL,
00196 csComponent *iBefore = NULL);
00197
00199 bool DeleteTab (int iIndex);
00201 bool DeleteTab (csComponent *iComponent);
00202
00204 bool SelectTab (int iIndex);
00206 bool SelectTab (csComponent *iComponent);
00207
00208 protected:
00210 int tabx, taby, tabw, tabh, lasttab, lastpos, primary;
00211
00213 void PlaceGadgets ();
00215 bool AddTab (cspPageData *iPageData, const char *iInfo,
00216 csComponent *iBefore);
00218 void GetClientRect (csRect &oRect);
00220 int InfoHeight ();
00222 bool GetTabSize (int iTab, int &oW, int &oH);
00224 bool InsideTab (int iIndex, int x, int y);
00226 int FindPage (csComponent *iComponent);
00227 };
00228
00229 #endif // __CSNOTEBK_H__