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 vtkKWFrame;
00027 class vtkKWIcon;
00028 class vtkKWLabel;
00029 class vtkKWSmallCounterLabel;
00030 class vtkKWMenu;
00031 class vtkKWNotebookInternals;
00032 class vtkKWBalloonHelpManager;
00033
00034 class KWWidgets_EXPORT vtkKWNotebook : public vtkKWCompositeWidget
00035 {
00036
00037 public:
00038 static vtkKWNotebook* New();
00039 vtkTypeRevisionMacro(vtkKWNotebook,vtkKWCompositeWidget);
00040 void PrintSelf(ostream& os, vtkIndent indent);
00041
00043
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
00067 const char* GetPageTitle(int id);
00068 virtual void SetPageTitle(int id, const char *title);
00070
00072
00073 const char* GetPageBalloonHelpString(int id);
00074 virtual void SetPageBalloonHelpString(int id, const char *str);
00076
00078
00080 vtkKWIcon* GetPageIcon(int id);
00081 virtual void SetPageIcon(int id, vtkKWIcon *icon);
00082 virtual void SetPageIconToPredefinedIcon(int id, int icon_index);
00084
00086
00093 int GetPageSmallCounterValue(int id);
00094 virtual void SetPageSmallCounterValue(int id, int v);
00096
00098
00099 unsigned int GetNumberOfPages();
00100 unsigned int GetNumberOfPagesMatchingTag(int tag);
00102
00104
00108 void SetPageTag(int id, int tag);
00109 void SetPageTag(const char *title, int tag);
00110 int GetPageTag(int id);
00111 int GetPageTag(const char *title);
00113
00115
00122 void RaisePage(int id);
00123 void RaisePage(const char *title);
00124 void RaisePage(const char *title, int tag);
00125 int GetRaisedPageId();
00126 void RaiseFirstPageMatchingTag(int tag);
00128
00130
00136 vtkKWFrame *GetFrame(int id);
00137 vtkKWFrame *GetFrame(const char *title);
00138 vtkKWFrame *GetFrame(const char *title, int tag);
00139 int GetPageIdFromFrameWidgetName(const char *frame_wname);
00141
00143
00148 int RemovePage(int id);
00149 int RemovePage(const char *title);
00151
00153 void RemovePagesMatchingTag(int tag);
00154
00156
00166 void ShowPage(int id);
00167 void ShowPage(const char *title);
00168 void ShowPage(const char *title, int tag);
00169 void HidePage(int id);
00170 void HidePage(const char *title);
00171 void HidePage(const char *title, int tag);
00172 void SetPageVisibility(int id, int flag);
00173 void SetPageVisibility(const char *title, int flag);
00174 void SetPageVisibility(const char *title, int tag, int flag);
00175 int GetPageVisibility(int id);
00176 int GetPageVisibility(const char *title);
00177 int GetPageVisibility(const char *title, int tag);
00178 void TogglePageVisibility(int id);
00179 void TogglePageVisibility(const char *title);
00180 void TogglePageVisibility(const char *title, int tag);
00181 int CanBeHidden(int id);
00182 int CanBeHidden(const char *title);
00183 int CanBeHidden(const char *title, int tag);
00184 void HideAllPages();
00186
00188
00194 void SetPageEnabled(int id, int flag);
00195 void SetPageEnabled(const char *title, int flag);
00196 void SetPageEnabled(const char *title, int tag, int fkag);
00198
00200
00201 unsigned int GetNumberOfVisiblePages();
00202 unsigned int GetNumberOfVisiblePagesMatchingTag(int tag);
00204
00210 int GetVisiblePageId(int idx);
00211
00213
00216 void HidePagesMatchingTag(int tag);
00217 void ShowPagesMatchingTag(int tag);
00218 void ShowPagesMatchingTagReverse(int tag);
00219 void HidePagesNotMatchingTag(int tag);
00220 void ShowPagesNotMatchingTag(int tag);
00222
00224
00226 virtual void SetShowAllPagesWithSameTag(int);
00227 vtkGetMacro(ShowAllPagesWithSameTag, int);
00228 vtkBooleanMacro(ShowAllPagesWithSameTag, int);
00230
00232
00235 virtual void SetShowOnlyPagesWithSameTag(int);
00236 vtkGetMacro(ShowOnlyPagesWithSameTag, int);
00237 vtkBooleanMacro(ShowOnlyPagesWithSameTag, int);
00239
00241
00247 virtual void SetShowOnlyMostRecentPages(int);
00248 vtkGetMacro(ShowOnlyMostRecentPages, int);
00249 vtkBooleanMacro(ShowOnlyMostRecentPages, int);
00250 vtkSetMacro(NumberOfMostRecentPages, int);
00251 vtkGetMacro(NumberOfMostRecentPages, int);
00253
00258 int GetMostRecentPageId(int idx);
00259
00261
00265 void PinPage(int id);
00266 void PinPage(const char *title);
00267 void PinPage(const char *title, int tag);
00268 void UnpinPage(int id);
00269 void UnpinPage(const char *title);
00270 void UnpinPage(const char *title, int tag);
00271 void TogglePagePinned(int id);
00272 void TogglePagePinned(const char *title);
00273 void TogglePagePinned(const char *title, int tag);
00274 int GetPagePinned(int id);
00275 int GetPagePinned(const char *title);
00276 int GetPagePinned(const char *title, int tag);
00278
00280
00281 void PinPagesMatchingTag(int tag);
00282 void UnpinPagesMatchingTag(int tag);
00284
00286
00287 virtual void SetPagesCanBePinned(int);
00288 vtkGetMacro(PagesCanBePinned, int);
00289 vtkBooleanMacro(PagesCanBePinned, int);
00291
00293 unsigned int GetNumberOfPinnedPages();
00294
00298 int GetPinnedPageId(int idx);
00299
00301
00308 vtkSetMacro(UseFrameWithScrollbars, int);
00309 vtkGetMacro(UseFrameWithScrollbars, int);
00310 vtkBooleanMacro(UseFrameWithScrollbars, int);
00312
00314
00318 virtual void SetMinimumWidth(int);
00319 vtkGetMacro(MinimumWidth,int);
00320 virtual void SetMinimumHeight(int);
00321 vtkGetMacro(MinimumHeight,int);
00323
00325
00327 virtual void SetAlwaysShowTabs(int);
00328 vtkGetMacro(AlwaysShowTabs, int);
00329 vtkBooleanMacro(AlwaysShowTabs, int);
00331
00333
00334 virtual void SetShowIcons(int);
00335 vtkGetMacro(ShowIcons, int);
00336 vtkBooleanMacro(ShowIcons, int);
00338
00340
00341 vtkSetMacro(EnablePageTabContextMenu, int);
00342 vtkGetMacro(EnablePageTabContextMenu, int);
00343 vtkBooleanMacro(EnablePageTabContextMenu, int);
00345
00347
00349 virtual void SetBackgroundColor(double r, double g, double b);
00350 virtual void SetBackgroundColor(double rgb[3])
00351 { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00353
00355
00361 vtkGetVector3Macro(PageTabColor,double);
00362 virtual void SetPageTabColor(double r, double g, double b);
00363 virtual void SetPageTabColor(double rgb[3])
00364 { this->SetPageTabColor(rgb[0], rgb[1], rgb[2]); };
00365 vtkGetVector3Macro(SelectedPageTabColor,double);
00366 virtual void SetSelectedPageTabColor(double r, double g, double b);
00367 virtual void SetSelectedPageTabColor(double rgb[3])
00368 { this->SetSelectedPageTabColor(rgb[0], rgb[1], rgb[2]); };
00369 vtkGetVector3Macro(PinnedPageTabOutlineColor,double);
00370 virtual void SetPinnedPageTabOutlineColor(double r, double g, double b);
00371 virtual void SetPinnedPageTabOutlineColor(double rgb[3])
00372 { this->SetPinnedPageTabOutlineColor(rgb[0], rgb[1], rgb[2]); };
00373 vtkGetVector3Macro(PageTabTextColor,double);
00374 virtual void SetPageTabTextColor(double r, double g, double b);
00375 virtual void SetPageTabTextColor(double rgb[3])
00376 { this->SetPageTabTextColor(rgb[0], rgb[1], rgb[2]); };
00377 vtkGetVector3Macro(SelectedPageTabTextColor,double);
00378 virtual void SetSelectedPageTabTextColor(double r, double g, double b);
00379 virtual void SetSelectedPageTabTextColor(double rgb[3])
00380 { this->SetSelectedPageTabTextColor(rgb[0], rgb[1], rgb[2]); };
00382
00384
00388 vtkGetMacro(SelectedPageTabPadding, int);
00389 virtual void SetSelectedPageTabPadding(int arg);
00391
00394 virtual int GetPageIdContainingCoordinatesInTab(int x, int y);
00395
00402 virtual void UpdateEnableState();
00403
00405
00406 virtual void ScheduleResize();
00407 virtual void Resize();
00409
00425 virtual void PageTabContextMenuCallback(int id, int x, int y);
00426 virtual void RaiseCallback(int id);
00427 virtual void TogglePagePinnedCallback(int id);
00428 virtual void TogglePageVisibilityCallback(int id);
00430
00431
00432
00433 protected:
00434 vtkKWNotebook();
00435 ~vtkKWNotebook();
00436
00438 virtual void CreateWidget();
00439
00440 int MinimumWidth;
00441 int MinimumHeight;
00442 int AlwaysShowTabs;
00443 int ShowIcons;
00444 int ShowAllPagesWithSameTag;
00445 int ShowOnlyPagesWithSameTag;
00446 int ShowOnlyMostRecentPages;
00447 int NumberOfMostRecentPages;
00448 int PagesCanBePinned;
00449 int EnablePageTabContextMenu;
00450 int UseFrameWithScrollbars;
00451
00452 double PageTabColor[3];
00453 double SelectedPageTabColor[3];
00454 double PageTabTextColor[3];
00455 double SelectedPageTabTextColor[3];
00456 double PinnedPageTabOutlineColor[3];
00457 int SelectedPageTabPadding;
00458
00459 vtkKWFrame *TabsFrame;
00460 vtkKWFrame *Body;
00461 vtkKWFrame *Mask;
00462 vtkKWMenu *TabPopupMenu;
00463
00464
00465
00466
00467
00468 class Page
00469 {
00470 public:
00471 Page();
00472 void Delete();
00473 void UpdateEnableState();
00474 void Bind();
00475 void UnBind();
00476
00477 int Id;
00478 int Visibility;
00479 int Pinned;
00480 int Tag;
00481 int Enabled;
00482 char *Title;
00483 vtkKWCoreWidget *Frame;
00484 vtkKWFrame *TabFrame;
00485 vtkKWLabel *Label;
00486 vtkKWLabel *ImageLabel;
00487 vtkKWIcon *Icon;
00488 vtkKWSmallCounterLabel *SmallCounterLabel;
00489 };
00490
00491
00492
00493 vtkKWNotebookInternals *Internals;
00494 friend class vtkKWNotebookInternals;
00495
00496
00497
00498
00499
00500
00501 Page* GetPage(int id);
00502 Page* GetPage(const char *title);
00503 Page* GetPage(const char *title, int tag);
00504
00505
00506
00507
00508
00509 Page* GetFirstVisiblePage();
00510 Page* GetFirstPageMatchingTag(int tag);
00511 Page* GetFirstPackedPageNotMatchingTag(int tag);
00512
00513
00514
00515 void SetPageTag(Page*, int tag);
00516 void RaisePage(Page*);
00517 void ShowPageTab(Page*);
00518 void ShowPageTabAsLow(Page*);
00519 void LowerPage(Page*);
00520 int RemovePage(Page*);
00521 void ShowPage(Page*);
00522 void HidePage(Page*);
00523 void PinPage(Page*);
00524 void UnpinPage(Page*);
00525 void TogglePagePinned(Page*);
00526 int GetPageVisibility(Page*);
00527 void TogglePageVisibility(Page*);
00528 int CanBeHidden(Page*);
00529 int GetPageTag(Page*);
00530 int GetPagePinned(Page*);
00531 const char* GetPageTitle(Page*);
00532 const char* GetPageBalloonHelpString(Page*);
00533 vtkKWIcon* GetPageIcon(Page*);
00534 void SetPageEnabled(Page*, int flag);
00535 void BuildPage(Page*,const char *title,const char* balloon,vtkKWIcon *icon);
00536
00537 int AddToMostRecentPages(Page*);
00538 int RemoveFromMostRecentPages(Page*);
00539 int PutOnTopOfMostRecentPages(Page*);
00540
00541
00542
00543 virtual void UpdatePageTabAspect(Page*);
00544 virtual void UpdateAllPagesTabAspect();
00545
00546
00547
00548 int IdCounter;
00549 int CurrentId;
00550 int Expanding;
00551
00552
00553
00554 int AreTabsVisible();
00555
00556
00557
00558 void UpdateBodyPosition();
00559 void UpdateMaskPosition();
00560
00561
00562
00563
00564
00565
00566 void ConstrainVisiblePages();
00567
00568
00569
00570 void SendEventForPage(unsigned long event, int id);
00571
00573
00574 virtual void Bind();
00575 virtual void UnBind();
00577
00578 vtkKWBalloonHelpManager *TabBalloonHelpManager;
00579
00580
00581
00582 private:
00583 vtkKWNotebook(const vtkKWNotebook&);
00584 void operator=(const vtkKWNotebook&);
00585 };
00586
00587 #endif
00588
00589