00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __vtkKWNotebook_h
00020 #define __vtkKWNotebook_h
00021
00022 #include "vtkKWCompositeWidget.h"
00023
00024 class vtkKWFrame;
00025 class vtkKWIcon;
00026 class vtkKWLabel;
00027 class vtkKWSmallCounterLabel;
00028 class vtkKWMenu;
00029 class vtkKWNotebookInternals;
00030 class vtkKWBalloonHelpManager;
00031
00032 class KWWidgets_EXPORT vtkKWNotebook : public vtkKWCompositeWidget
00033 {
00034 public:
00035 static vtkKWNotebook* New();
00036 vtkTypeRevisionMacro(vtkKWNotebook,vtkKWCompositeWidget);
00037 void PrintSelf(ostream& os, vtkIndent indent);
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 int AddPage(const char *title, const char* balloon, vtkKWIcon *icon,int tag);
00050 int AddPage(const char *title, const char* balloon, vtkKWIcon *icon);
00051 int AddPage(const char *title, const char* balloon);
00052 int AddPage(const char *title);
00053
00054
00055
00056 int HasPage(int id);
00057 int HasPage(const char *title, int tag);
00058 int GetPageId(const char *title, int tag);
00059
00060
00061
00062 const char* GetPageTitle(int id);
00063 virtual void SetPageTitle(int id, const char *title);
00064
00065
00066
00067 const char* GetPageBalloonHelpString(int id);
00068 virtual void SetPageBalloonHelpString(int id, const char *str);
00069
00070
00071
00072
00073 vtkKWIcon* GetPageIcon(int id);
00074 virtual void SetPageIcon(int id, vtkKWIcon *icon);
00075 virtual void SetPageIconToPredefinedIcon(int id, int icon_index);
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 int GetPageSmallCounterValue(int id);
00086 virtual void SetPageSmallCounterValue(int id, int v);
00087
00088
00089
00090 unsigned int GetNumberOfPages();
00091 unsigned int GetNumberOfPagesMatchingTag(int tag);
00092
00093
00094
00095
00096
00097
00098
00099 void SetPageTag(int id, int tag);
00100 void SetPageTag(const char *title, int tag);
00101 int GetPageTag(int id);
00102 int GetPageTag(const char *title);
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 void RaisePage(int id);
00113 void RaisePage(const char *title);
00114 void RaisePage(const char *title, int tag);
00115 int GetRaisedPageId();
00116 void RaiseFirstPageMatchingTag(int tag);
00117
00118
00119
00120
00121
00122
00123
00124
00125 vtkKWFrame *GetFrame(int id);
00126 vtkKWFrame *GetFrame(const char *title);
00127 vtkKWFrame *GetFrame(const char *title, int tag);
00128 int GetPageIdFromFrameWidgetName(const char *frame_wname);
00129
00130
00131
00132
00133
00134
00135
00136
00137 int RemovePage(int id);
00138 int RemovePage(const char *title);
00139
00140
00141
00142 void RemovePagesMatchingTag(int tag);
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 void ShowPage(int id);
00156 void ShowPage(const char *title);
00157 void ShowPage(const char *title, int tag);
00158 void HidePage(int id);
00159 void HidePage(const char *title);
00160 void HidePage(const char *title, int tag);
00161 void SetPageVisibility(int id, int flag);
00162 void SetPageVisibility(const char *title, int flag);
00163 void SetPageVisibility(const char *title, int tag, int flag);
00164 int GetPageVisibility(int id);
00165 int GetPageVisibility(const char *title);
00166 int GetPageVisibility(const char *title, int tag);
00167 void TogglePageVisibility(int id);
00168 void TogglePageVisibility(const char *title);
00169 void TogglePageVisibility(const char *title, int tag);
00170 int CanBeHidden(int id);
00171 int CanBeHidden(const char *title);
00172 int CanBeHidden(const char *title, int tag);
00173 void HideAllPages();
00174
00175
00176
00177
00178
00179
00180
00181
00182 void SetPageEnabled(int id, int flag);
00183 void SetPageEnabled(const char *title, int flag);
00184 void SetPageEnabled(const char *title, int tag, int fkag);
00185
00186
00187
00188 unsigned int GetNumberOfVisiblePages();
00189 unsigned int GetNumberOfVisiblePagesMatchingTag(int tag);
00190
00191
00192
00193
00194
00195
00196
00197 int GetVisiblePageId(int idx);
00198
00199
00200
00201
00202 void HidePagesMatchingTag(int tag);
00203 void ShowPagesMatchingTag(int tag);
00204 void ShowPagesMatchingTagReverse(int tag);
00205 void HidePagesNotMatchingTag(int tag);
00206 void ShowPagesNotMatchingTag(int tag);
00207
00208
00209
00210
00211 virtual void SetShowAllPagesWithSameTag(int);
00212 vtkGetMacro(ShowAllPagesWithSameTag, int);
00213 vtkBooleanMacro(ShowAllPagesWithSameTag, int);
00214
00215
00216
00217
00218
00219 virtual void SetShowOnlyPagesWithSameTag(int);
00220 vtkGetMacro(ShowOnlyPagesWithSameTag, int);
00221 vtkBooleanMacro(ShowOnlyPagesWithSameTag, int);
00222
00223
00224
00225
00226
00227
00228
00229 virtual void SetShowOnlyMostRecentPages(int);
00230 vtkGetMacro(ShowOnlyMostRecentPages, int);
00231 vtkBooleanMacro(ShowOnlyMostRecentPages, int);
00232 vtkSetMacro(NumberOfMostRecentPages, int);
00233 vtkGetMacro(NumberOfMostRecentPages, int);
00234
00235
00236
00237
00238
00239
00240 int GetMostRecentPageId(int idx);
00241
00242
00243
00244
00245
00246
00247 void PinPage(int id);
00248 void PinPage(const char *title);
00249 void PinPage(const char *title, int tag);
00250 void UnpinPage(int id);
00251 void UnpinPage(const char *title);
00252 void UnpinPage(const char *title, int tag);
00253 void TogglePagePinned(int id);
00254 void TogglePagePinned(const char *title);
00255 void TogglePagePinned(const char *title, int tag);
00256 int GetPagePinned(int id);
00257 int GetPagePinned(const char *title);
00258 int GetPagePinned(const char *title, int tag);
00259
00260
00261
00262 void PinPagesMatchingTag(int tag);
00263 void UnpinPagesMatchingTag(int tag);
00264
00265
00266
00267 virtual void SetPagesCanBePinned(int);
00268 vtkGetMacro(PagesCanBePinned, int);
00269 vtkBooleanMacro(PagesCanBePinned, int);
00270
00271
00272
00273 unsigned int GetNumberOfPinnedPages();
00274
00275
00276
00277
00278
00279
00280 int GetPinnedPageId(int idx);
00281
00282
00283
00284
00285
00286
00287
00288
00289 vtkSetMacro(UseFrameWithScrollbars, int);
00290 vtkGetMacro(UseFrameWithScrollbars, int);
00291 vtkBooleanMacro(UseFrameWithScrollbars, int);
00292
00293
00294
00295
00296
00297
00298
00299 virtual void SetMinimumWidth(int);
00300 vtkGetMacro(MinimumWidth,int);
00301 virtual void SetMinimumHeight(int);
00302 vtkGetMacro(MinimumHeight,int);
00303
00304
00305
00306
00307 virtual void SetAlwaysShowTabs(int);
00308 vtkGetMacro(AlwaysShowTabs, int);
00309 vtkBooleanMacro(AlwaysShowTabs, int);
00310
00311
00312
00313 virtual void SetShowIcons(int);
00314 vtkGetMacro(ShowIcons, int);
00315 vtkBooleanMacro(ShowIcons, int);
00316
00317
00318
00319 vtkSetMacro(EnablePageTabContextMenu, int);
00320 vtkGetMacro(EnablePageTabContextMenu, int);
00321 vtkBooleanMacro(EnablePageTabContextMenu, int);
00322
00323
00324
00325
00326 virtual void SetBackgroundColor(double r, double g, double b);
00327 virtual void SetBackgroundColor(double rgb[3])
00328 { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338 vtkGetVector3Macro(PageTabColor,double);
00339 virtual void SetPageTabColor(double r, double g, double b);
00340 virtual void SetPageTabColor(double rgb[3])
00341 { this->SetPageTabColor(rgb[0], rgb[1], rgb[2]); };
00342 vtkGetVector3Macro(SelectedPageTabColor,double);
00343 virtual void SetSelectedPageTabColor(double r, double g, double b);
00344 virtual void SetSelectedPageTabColor(double rgb[3])
00345 { this->SetSelectedPageTabColor(rgb[0], rgb[1], rgb[2]); };
00346 vtkGetVector3Macro(PinnedPageTabOutlineColor,double);
00347 virtual void SetPinnedPageTabOutlineColor(double r, double g, double b);
00348 virtual void SetPinnedPageTabOutlineColor(double rgb[3])
00349 { this->SetPinnedPageTabOutlineColor(rgb[0], rgb[1], rgb[2]); };
00350 vtkGetVector3Macro(PageTabTextColor,double);
00351 virtual void SetPageTabTextColor(double r, double g, double b);
00352 virtual void SetPageTabTextColor(double rgb[3])
00353 { this->SetPageTabTextColor(rgb[0], rgb[1], rgb[2]); };
00354 vtkGetVector3Macro(SelectedPageTabTextColor,double);
00355 virtual void SetSelectedPageTabTextColor(double r, double g, double b);
00356 virtual void SetSelectedPageTabTextColor(double rgb[3])
00357 { this->SetSelectedPageTabTextColor(rgb[0], rgb[1], rgb[2]); };
00358
00359
00360
00361
00362
00363 vtkGetMacro(SelectedPageTabPadding, int);
00364 virtual void SetSelectedPageTabPadding(int arg);
00365
00366
00367
00368
00369 virtual int GetPageIdContainingCoordinatesInTab(int x, int y);
00370
00371
00372
00373
00374
00375
00376
00377
00378 virtual void UpdateEnableState();
00379
00380
00381
00382 virtual void ScheduleResize();
00383 virtual void Resize();
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401 virtual void PageTabContextMenuCallback(int id, int x, int y);
00402 virtual void RaiseCallback(int id);
00403 virtual void TogglePagePinnedCallback(int id);
00404 virtual void TogglePageVisibilityCallback(int id);
00405
00406 protected:
00407 vtkKWNotebook();
00408 ~vtkKWNotebook();
00409
00410
00411
00412 virtual void CreateWidget();
00413
00414 int MinimumWidth;
00415 int MinimumHeight;
00416 int AlwaysShowTabs;
00417 int ShowIcons;
00418 int ShowAllPagesWithSameTag;
00419 int ShowOnlyPagesWithSameTag;
00420 int ShowOnlyMostRecentPages;
00421 int NumberOfMostRecentPages;
00422 int PagesCanBePinned;
00423 int EnablePageTabContextMenu;
00424 int UseFrameWithScrollbars;
00425
00426 double PageTabColor[3];
00427 double SelectedPageTabColor[3];
00428 double PageTabTextColor[3];
00429 double SelectedPageTabTextColor[3];
00430 double PinnedPageTabOutlineColor[3];
00431 int SelectedPageTabPadding;
00432
00433 vtkKWFrame *TabsFrame;
00434 vtkKWFrame *Body;
00435 vtkKWFrame *Mask;
00436 vtkKWMenu *TabPopupMenu;
00437
00438
00439
00440
00441
00442 class Page
00443 {
00444 public:
00445 Page();
00446 void Delete();
00447 void UpdateEnableState();
00448 void Bind();
00449 void UnBind();
00450
00451 int Id;
00452 int Visibility;
00453 int Pinned;
00454 int Tag;
00455 int Enabled;
00456 char *Title;
00457 vtkKWCoreWidget *Frame;
00458 vtkKWFrame *TabFrame;
00459 vtkKWLabel *Label;
00460 vtkKWLabel *ImageLabel;
00461 vtkKWIcon *Icon;
00462 vtkKWSmallCounterLabel *SmallCounterLabel;
00463 };
00464
00465
00466
00467 vtkKWNotebookInternals *Internals;
00468 friend class vtkKWNotebookInternals;
00469
00470
00471
00472
00473
00474
00475 Page* GetPage(int id);
00476 Page* GetPage(const char *title);
00477 Page* GetPage(const char *title, int tag);
00478
00479
00480
00481
00482
00483 Page* GetFirstVisiblePage();
00484 Page* GetFirstPageMatchingTag(int tag);
00485 Page* GetFirstPackedPageNotMatchingTag(int tag);
00486
00487
00488
00489 void SetPageTag(Page*, int tag);
00490 void RaisePage(Page*);
00491 void ShowPageTab(Page*);
00492 void ShowPageTabAsLow(Page*);
00493 void LowerPage(Page*);
00494 int RemovePage(Page*);
00495 void ShowPage(Page*);
00496 void HidePage(Page*);
00497 void PinPage(Page*);
00498 void UnpinPage(Page*);
00499 void TogglePagePinned(Page*);
00500 int GetPageVisibility(Page*);
00501 void TogglePageVisibility(Page*);
00502 int CanBeHidden(Page*);
00503 int GetPageTag(Page*);
00504 int GetPagePinned(Page*);
00505 const char* GetPageTitle(Page*);
00506 const char* GetPageBalloonHelpString(Page*);
00507 vtkKWIcon* GetPageIcon(Page*);
00508 void SetPageEnabled(Page*, int flag);
00509 void BuildPage(Page*,const char *title,const char* balloon,vtkKWIcon *icon);
00510
00511 int AddToMostRecentPages(Page*);
00512 int RemoveFromMostRecentPages(Page*);
00513 int PutOnTopOfMostRecentPages(Page*);
00514
00515
00516
00517 virtual void UpdatePageTabAspect(Page*);
00518 virtual void UpdateAllPagesTabAspect();
00519
00520
00521
00522 int IdCounter;
00523 int CurrentId;
00524 int Expanding;
00525
00526
00527
00528 int AreTabsVisible();
00529
00530
00531
00532 void UpdateBodyPosition();
00533 void UpdateMaskPosition();
00534
00535
00536
00537
00538
00539
00540 void ConstrainVisiblePages();
00541
00542
00543
00544 void SendEventForPage(unsigned long event, int id);
00545
00546
00547
00548 virtual void Bind();
00549 virtual void UnBind();
00550
00551 vtkKWBalloonHelpManager *TabBalloonHelpManager;
00552
00553 private:
00554 vtkKWNotebook(const vtkKWNotebook&);
00555 void operator=(const vtkKWNotebook&);
00556 };
00557
00558 #endif
00559