00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00021 #ifndef __vtkKWNotebook_h
00022 #define __vtkKWNotebook_h
00023
00024 #include "vtkKWCompositeWidget.h"
00025
00026 class vtkKWApplication;
00027 class vtkKWFrame;
00028 class vtkKWIcon;
00029 class vtkKWLabel;
00030 class vtkKWMenu;
00031 class vtkKWNotebookInternals;
00032
00033 class KWWIDGETS_EXPORT vtkKWNotebook : public vtkKWCompositeWidget
00034 {
00035 public:
00036
00037 static vtkKWNotebook* New();
00038 vtkTypeRevisionMacro(vtkKWNotebook,vtkKWCompositeWidget);
00039 void PrintSelf(ostream& os, vtkIndent indent);
00040
00042 virtual void Create(vtkKWApplication *app);
00043
00045
00052 int AddPage(const char *title, const char* balloon, vtkKWIcon *icon,int tag);
00053 int AddPage(const char *title, const char* balloon, vtkKWIcon *icon);
00054 int AddPage(const char *title, const char* balloon);
00055 int AddPage(const char *title);
00057
00059
00060 int HasPage(int id);
00061 int HasPage(const char *title, int tag);
00062 int GetPageId(const char *title, int tag);
00064
00066 const char* GetPageTitle(int id);
00067
00069
00070 unsigned int GetNumberOfPages();
00071 unsigned int GetNumberOfPagesMatchingTag(int tag);
00073
00075
00079 void SetPageTag(int id, int tag);
00080 void SetPageTag(const char *title, int tag);
00081 int GetPageTag(int id);
00082 int GetPageTag(const char *title);
00084
00086
00093 void Raise(int id);
00094 void Raise(const char *title);
00095 void Raise(const char *title, int tag);
00096 int GetRaisedPageId();
00097 void RaiseFirstPageMatchingTag(int tag);
00099
00101
00107 vtkKWWidget *GetFrame(int id);
00108 vtkKWWidget *GetFrame(const char *title);
00109 vtkKWWidget *GetFrame(const char *title, int tag);
00110 int GetPageIdFromFrameWidgetName(const char *frame_wname);
00112
00114
00119 int RemovePage(int id);
00120 int RemovePage(const char *title);
00122
00124 void RemovePagesMatchingTag(int tag);
00125
00127
00137 void ShowPage(int id);
00138 void ShowPage(const char *title);
00139 void ShowPage(const char *title, int tag);
00140 void HidePage(int id);
00141 void HidePage(const char *title);
00142 void HidePage(const char *title, int tag);
00143 void SetPageVisibility(int id, int flag);
00144 void SetPageVisibility(const char *title, int flag);
00145 void SetPageVisibility(const char *title, int tag, int flag);
00146 int GetPageVisibility(int id);
00147 int GetPageVisibility(const char *title);
00148 int GetPageVisibility(const char *title, int tag);
00149 void TogglePageVisibility(int id);
00150 void TogglePageVisibility(const char *title);
00151 void TogglePageVisibility(const char *title, int tag);
00152 int CanBeHidden(int id);
00153 int CanBeHidden(const char *title);
00154 int CanBeHidden(const char *title, int tag);
00155 void HideAllPages();
00157
00159
00160 unsigned int GetNumberOfVisiblePages();
00161 unsigned int GetNumberOfVisiblePagesMatchingTag(int tag);
00163
00169 int GetVisiblePageId(int idx);
00170
00172
00175 void HidePagesMatchingTag(int tag);
00176 void ShowPagesMatchingTag(int tag);
00177 void ShowPagesMatchingTagReverse(int tag);
00178 void HidePagesNotMatchingTag(int tag);
00179 void ShowPagesNotMatchingTag(int tag);
00181
00183
00185 virtual void SetShowAllPagesWithSameTag(int);
00186 vtkGetMacro(ShowAllPagesWithSameTag, int);
00187 vtkBooleanMacro(ShowAllPagesWithSameTag, int);
00189
00191
00194 virtual void SetShowOnlyPagesWithSameTag(int);
00195 vtkGetMacro(ShowOnlyPagesWithSameTag, int);
00196 vtkBooleanMacro(ShowOnlyPagesWithSameTag, int);
00198
00200
00206 virtual void SetShowOnlyMostRecentPages(int);
00207 vtkGetMacro(ShowOnlyMostRecentPages, int);
00208 vtkBooleanMacro(ShowOnlyMostRecentPages, int);
00209 vtkSetMacro(NumberOfMostRecentPages, int);
00210 vtkGetMacro(NumberOfMostRecentPages, int);
00212
00217 int GetMostRecentPageId(int idx);
00218
00220
00224 void PinPage(int id);
00225 void PinPage(const char *title);
00226 void PinPage(const char *title, int tag);
00227 void UnpinPage(int id);
00228 void UnpinPage(const char *title);
00229 void UnpinPage(const char *title, int tag);
00230 void TogglePagePinned(int id);
00231 void TogglePagePinned(const char *title);
00232 void TogglePagePinned(const char *title, int tag);
00233 int GetPagePinned(int id);
00234 int GetPagePinned(const char *title);
00235 int GetPagePinned(const char *title, int tag);
00237
00239
00241 void PinPagesMatchingTag(int tag);
00242 void UnpinPagesMatchingTag(int tag);
00244
00246
00247 virtual void SetPagesCanBePinned(int);
00248 vtkGetMacro(PagesCanBePinned, int);
00249 vtkBooleanMacro(PagesCanBePinned, int);
00251
00253 unsigned int GetNumberOfPinnedPages();
00254
00258 int GetPinnedPageId(int idx);
00259
00261
00265 virtual void SetMinimumWidth(int);
00266 vtkGetMacro(MinimumWidth,int);
00267 virtual void SetMinimumHeight(int);
00268 vtkGetMacro(MinimumHeight,int);
00270
00272
00274 virtual void SetAlwaysShowTabs(int);
00275 vtkGetMacro(AlwaysShowTabs, int);
00276 vtkBooleanMacro(AlwaysShowTabs, int);
00278
00280
00281 virtual void SetShowIcons(int);
00282 vtkGetMacro(ShowIcons, int);
00283 vtkBooleanMacro(ShowIcons, int);
00285
00287
00288 vtkSetMacro(EnablePageTabContextMenu, int);
00289 vtkGetMacro(EnablePageTabContextMenu, int);
00290 vtkBooleanMacro(EnablePageTabContextMenu, int);
00292
00295 int GetPageIdContainingCoordinatesInTab(int x, int y);
00296
00298
00299 void ScheduleResize();
00300 void Resize();
00301 void PageTabContextMenuCallback(int id, int x, int y);
00302 void RaiseCallback(int id);
00303 void TogglePagePinnedCallback(int id);
00304 void TogglePageVisibilityCallback(int id);
00306
00313 virtual void UpdateEnableState();
00314
00315 protected:
00316 vtkKWNotebook();
00317 ~vtkKWNotebook();
00318
00319 int MinimumWidth;
00320 int MinimumHeight;
00321 int AlwaysShowTabs;
00322 int ShowIcons;
00323 int ShowAllPagesWithSameTag;
00324 int ShowOnlyPagesWithSameTag;
00325 int ShowOnlyMostRecentPages;
00326 int NumberOfMostRecentPages;
00327 int PagesCanBePinned;
00328 int EnablePageTabContextMenu;
00329
00330 vtkKWFrame *TabsFrame;
00331 vtkKWFrame *Body;
00332 vtkKWFrame *Mask;
00333 vtkKWMenu *TabPopupMenu;
00334
00335
00336
00337
00338
00339 class Page
00340 {
00341 public:
00342 void Delete();
00343 void SetEnabled(int);
00344
00345 int Id;
00346 int Visibility;
00347 int Pinned;
00348 int Tag;
00349 char *Title;
00350 vtkKWFrame *Frame;
00351 vtkKWFrame *TabFrame;
00352 vtkKWLabel *Label;
00353 vtkKWLabel *ImageLabel;
00354 vtkKWIcon *Icon;
00355 };
00356
00357
00358
00359 vtkKWNotebookInternals *Internals;
00360 friend class vtkKWNotebookInternals;
00361
00362
00363
00364
00365
00366
00367 Page* GetPage(int id);
00368 Page* GetPage(const char *title);
00369 Page* GetPage(const char *title, int tag);
00370
00371
00372
00373
00374
00375 Page* GetFirstVisiblePage();
00376 Page* GetFirstPageMatchingTag(int tag);
00377 Page* GetFirstPackedPageNotMatchingTag(int tag);
00378
00379
00380
00381 void SetPageTag(Page*, int tag);
00382 void RaisePage(Page*);
00383 void ShowPageTab(Page*);
00384 void ShowPageTabAsLow(Page*);
00385 void LowerPage(Page*);
00386 int RemovePage(Page*);
00387 void ShowPage(Page*);
00388 void HidePage(Page*);
00389 void PinPage(Page*);
00390 void UnpinPage(Page*);
00391 void TogglePagePinned(Page*);
00392 int GetPageVisibility(Page*);
00393 void TogglePageVisibility(Page*);
00394 int CanBeHidden(Page*);
00395 int GetPageTag(Page*);
00396 int GetPagePinned(Page*);
00397 const char* GetPageTitle(Page*);
00398 void BindPage(Page*);
00399 void UnBindPage(Page*);
00400
00401 int AddToMostRecentPages(Page*);
00402 int RemoveFromMostRecentPages(Page*);
00403 int PutOnTopOfMostRecentPages(Page*);
00404
00405
00406
00407 void UpdatePageTabBackgroundColor(Page*, int selected);
00408
00409
00410
00411 int IdCounter;
00412 int CurrentId;
00413 int Expanding;
00414
00415
00416
00417 int AreTabsVisible();
00418
00419
00420
00421 void UpdateBodyPosition();
00422 void UpdateMaskPosition();
00423
00424
00425
00426
00427
00428
00429 void ConstrainVisiblePages();
00430
00431
00432
00433 void SendEventForPage(unsigned long event, int id);
00434
00436
00437 virtual void Bind();
00438 virtual void UnBind();
00440
00441 private:
00442 vtkKWNotebook(const vtkKWNotebook&);
00443 void operator=(const vtkKWNotebook&);
00444 };
00445
00446 #endif
00447