00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00038 #ifndef __vtkKWSelectionFrameLayoutManager_h
00039 #define __vtkKWSelectionFrameLayoutManager_h
00040
00041 #include "vtkKWCompositeWidget.h"
00042
00043 class vtkKWSelectionFrame;
00044 class vtkKWSelectionFrameLayoutManagerInternals;
00045 class vtkKWRenderWidget;
00046 class vtkImageData;
00047 class vtkKWMenu;
00048 class vtkKWToolbar;
00049 class vtkKWFrame;
00050
00051 class KWWidgets_EXPORT vtkKWSelectionFrameLayoutManager : public vtkKWCompositeWidget
00052 {
00053
00054 public:
00055 static vtkKWSelectionFrameLayoutManager* New();
00056 vtkTypeRevisionMacro(vtkKWSelectionFrameLayoutManager, vtkKWCompositeWidget);
00057 void PrintSelf(ostream& os, vtkIndent indent);
00058
00060
00062 virtual void SetResolution(int nb_cols, int nb_rows);
00063 virtual void SetResolution(int res[2])
00064 { this->SetResolution(res[0], res[1]); };
00065 vtkGetVector2Macro(Resolution, int);
00067
00069
00071 virtual void SetOrigin(int col, int row);
00072 virtual void SetOrigin(int origin[2])
00073 { this->SetOrigin(origin[0], origin[1]); };
00074 vtkGetVector2Macro(Origin, int);
00076
00078
00081 virtual int AddWidget(vtkKWSelectionFrame *widget);
00082 virtual int AddWidgetWithTagAndGroup(
00083 vtkKWSelectionFrame *widget, const char *tag, const char *group);
00085
00088 virtual vtkKWSelectionFrame* AllocateAndAddWidget();
00089
00091
00097 virtual int SetWidgetTag(vtkKWSelectionFrame*, const char *tag);
00098 virtual const char* GetWidgetTag(vtkKWSelectionFrame*);
00100
00102
00104 virtual int SetWidgetGroup(vtkKWSelectionFrame*, const char *group);
00105 virtual const char* GetWidgetGroup(vtkKWSelectionFrame*);
00107
00109
00110 virtual int GetNumberOfWidgets();
00111 virtual int GetNumberOfWidgetsWithTag(const char *tag);
00112 virtual int GetNumberOfWidgetsWithGroup(const char *group);
00114
00116
00117 virtual int HasWidget(vtkKWSelectionFrame *widget);
00118 virtual int HasWidgetWithTag(const char *tag);
00119 virtual int HasWidgetWithTagAndGroup(const char *tag, const char *group);
00121
00123
00128 virtual vtkKWSelectionFrame* GetWidgetWithTag(const char *tag);
00129 virtual vtkKWSelectionFrame* GetWidgetWithTagAndGroup(
00130 const char *tag, const char *group);
00131 virtual vtkKWSelectionFrame* GetWidgetWithTitle(const char *title);
00132 virtual vtkKWSelectionFrame* GetNthWidget(int index);
00133 virtual vtkKWSelectionFrame* GetNthWidgetNotMatching(
00134 int index, vtkKWSelectionFrame *avoid);
00135 virtual vtkKWSelectionFrame* GetNthWidgetWithGroup(
00136 int index, const char *group);
00138
00140
00152 virtual int GetWidgetPosition(vtkKWSelectionFrame *w, int *col, int *row);
00153 virtual int GetWidgetPosition(vtkKWSelectionFrame *w, int pos[2])
00154 { return this->GetWidgetPosition(w, pos, pos + 1); }
00155 virtual int SetWidgetPosition(vtkKWSelectionFrame *w, int col, int row);
00156 virtual int SetWidgetPosition(vtkKWSelectionFrame *w, int pos[2])
00157 { return this->SetWidgetPosition(w, pos[0], pos[1]); }
00158 virtual vtkKWSelectionFrame* GetWidgetAtPosition(int col, int row);
00159 virtual vtkKWSelectionFrame* GetWidgetAtPosition(int pos[2])
00160 { return this->GetWidgetAtPosition(pos[0], pos[1]); }
00162
00164
00166 virtual int SwitchWidgetsPosition(
00167 vtkKWSelectionFrame *w1, vtkKWSelectionFrame *w2);
00169
00171
00173 vtkBooleanMacro(ReorganizeWidgetPositionsAutomatically, int);
00174 virtual void SetReorganizeWidgetPositionsAutomatically(int);
00175 vtkGetMacro(ReorganizeWidgetPositionsAutomatically, int);
00177
00179
00181 virtual void SetMaximumResolution(int nb_cols, int nb_rows);
00182 virtual void SetMaximumResolution(int res[2])
00183 { this->SetMaximumResolution(res[0], res[1]); };
00184 vtkGetVector2Macro(MaximumResolution, int);
00186
00189 virtual int GetWidgetVisibility(vtkKWSelectionFrame *w);
00190
00192
00197 virtual int IsWidgetMaximized(vtkKWSelectionFrame *w);
00198 virtual int MaximizeWidget(vtkKWSelectionFrame *w);
00199 virtual int UndoMaximizeWidget();
00200 virtual int ToggleMaximizeWidget(vtkKWSelectionFrame *w);
00202
00205 virtual void SelectWidget(vtkKWSelectionFrame *widget);
00206
00209 virtual vtkKWSelectionFrame* GetSelectedWidget();
00210
00212
00218 virtual void SetSelectionChangedCommand(
00219 vtkObject *object, const char *method);
00220 vtkGetStringMacro(SelectionChangedCommand);
00222
00224
00227 virtual int RemoveWidget(vtkKWSelectionFrame *widget);
00228 virtual int RemoveAllWidgets();
00229 virtual int RemoveAllWidgetsWithGroup(const char *group);
00231
00236 virtual int ShowWidgetsWithGroup(const char *group);
00237
00239
00243 virtual int SaveScreenshotAllWidgets();
00244 virtual int SaveScreenshotAllWidgetsToFile(const char* fileName);
00245 virtual int CopyScreenshotAllWidgetsToClipboard();
00247
00249
00255 virtual int AppendAllWidgetsToImageData(vtkImageData *image,
00256 int OnScreenRendering = 0);
00257 virtual int AppendAllWidgetsToImageDataFast(vtkImageData *image);
00258 virtual int AppendSelectedWidgetToImageData(vtkImageData *image);
00259 virtual int AppendSelectedWidgetToImageDataFast(vtkImageData *image);
00261
00263
00265 vtkBooleanMacro(UseAlphaChannelInScreenshot, int);
00266 vtkGetMacro(UseAlphaChannelInScreenshot, int);
00267 vtkSetMacro(UseAlphaChannelInScreenshot, int);
00269
00271
00274 virtual int PrintAllWidgets();
00275 virtual int PrintAllWidgetsAtResolution(double dpi);
00276 virtual int PrintSelectedWidget();
00277 virtual int PrintSelectedWidgetAtResolution(double dpi);
00279
00281
00285 virtual void CreateResolutionEntriesMenu(vtkKWMenu *parent);
00286 vtkGetObjectMacro(ResolutionEntriesMenu, vtkKWMenu);
00287 virtual void UpdateResolutionEntriesMenu();
00289
00291
00295 virtual void CreateResolutionEntriesToolbar(vtkKWWidget *parent);
00296 vtkGetObjectMacro(ResolutionEntriesToolbar, vtkKWToolbar);
00297 virtual void UpdateResolutionEntriesToolbar();
00299
00301
00305 enum
00306 {
00307 SelectionChangedEvent = 10000,
00308 ResolutionChangedEvent
00309 };
00310
00312
00314
00317 virtual void SetDoubleClickOnLayoutFrameCommand(
00318 vtkObject *object, const char *method);
00320
00327 virtual void UpdateEnableState();
00328
00330 virtual void UpdateSelectionLists();
00331
00333
00334 virtual void SelectWidgetCallback(vtkKWSelectionFrame*);
00335 virtual void SelectAndMaximizeWidgetCallback(vtkKWSelectionFrame*);
00336 virtual void CloseWidgetCallback(vtkKWSelectionFrame*);
00337 virtual int ChangeWidgetTitleCallback(vtkKWSelectionFrame*);
00338 virtual void WidgetTitleChangedCallback(vtkKWSelectionFrame*);
00339 virtual void SwitchWidgetCallback(
00340 const char *title, vtkKWSelectionFrame *widget);
00341 virtual void ResolutionCallback(int i, int j);
00342 virtual void NumberOfWidgetsHasChangedCallback();
00343 virtual void DoubleClickOnLayoutFrameCallback();
00345
00352 virtual void Pack();
00353
00355
00357 virtual int SetImmediateWidgetPosition(vtkKWSelectionFrame *w, int pos[2])
00358 { return this->SetImmediateWidgetPosition(w, pos[0], pos[1]); }
00359 virtual int SetImmediateWidgetPosition(
00360 vtkKWSelectionFrame *w, int col, int row);
00362
00364 virtual void AdjustResolution();
00365
00367
00368 virtual void SetResolutionAndOrigin(int res[2], int origin[2])
00369 { this->SetResolutionAndOrigin(res[0], res[1], origin[0], origin[1]); };
00370 virtual void SetResolutionAndOrigin(
00371 int nb_cols, int nb_rows, int col, int row);
00373
00374
00375
00376 protected:
00377 vtkKWSelectionFrameLayoutManager();
00378 ~vtkKWSelectionFrameLayoutManager();
00379
00381
00383 virtual int IsPositionInLayout(int col, int row);
00384 virtual int IsPositionInLayout(int pos[2])
00385 { return this->IsPositionInLayout(pos[0], pos[1]); };
00387
00389 virtual void CreateWidget();
00390
00391 int Resolution[2];
00392 int MaximumResolution[2];
00393 int Origin[2];
00394 int ReorganizeWidgetPositionsAutomatically;
00395 int UseAlphaChannelInScreenshot;
00396
00397 vtkKWMenu *ResolutionEntriesMenu;
00398 vtkKWToolbar *ResolutionEntriesToolbar;
00399
00400 virtual void InvokeSelectionChangedCommand();
00401 char *SelectionChangedCommand;
00402
00403 char *DoubleClickOnLayoutFrameCommand;
00404 virtual void InvokeDoubleClickOnLayoutFrameCommand();
00405
00406 vtkKWFrame *LayoutFrame;
00407
00409 virtual vtkKWSelectionFrame* AllocateWidget();
00410
00412
00415 virtual void CreateWidget(vtkKWSelectionFrame*);
00416 virtual void ConfigureWidget(vtkKWSelectionFrame*);
00418
00423 virtual vtkKWRenderWidget* GetRenderWidget(vtkKWSelectionFrame*);
00424
00427 virtual int PrintWidgets(double dpi, int selection_only);
00428
00430
00438 virtual int AppendWidgetsToImageData(
00439 vtkImageData *image,int selection_only, int direct = 0,
00440 int ForceUpdateOnScreenRendering = 0);
00442
00444
00445 virtual void NumberOfWidgetsHasChanged();
00446 virtual void ScheduleNumberOfWidgetsHasChanged();
00448
00452 virtual int ReorganizeWidgetPositions();
00453
00455
00458 virtual int CanWidgetTitleBeChanged(
00459 vtkKWSelectionFrame *widget, const char *new_title);
00461
00462
00463
00464 vtkKWSelectionFrameLayoutManagerInternals *Internals;
00465
00467
00468 virtual void AddCallbacksToWidget(vtkKWSelectionFrame *widget);
00469 virtual void RemoveCallbacksFromWidget(vtkKWSelectionFrame *widget);
00471
00474 virtual void DeleteWidget(vtkKWSelectionFrame *widget);
00475
00480 virtual void MoveSelectionInsideVisibleLayout(int *pos_hint);
00481
00483
00485 virtual int PushResolution(int nb_cols, int nb_rows);
00486 virtual int PushResolution(int res[2])
00487 { return this->PushResolution(res[0], res[1]); };
00488 virtual int PopResolution(int *nb_cols, int *nb_rows);
00489 virtual int PopResolution(int res[2])
00490 { return this->PopResolution(&res[0], &res[1]); };
00491 virtual int PushPosition(int col, int row);
00492 virtual int PushPosition(int origin[2])
00493 { return this->PushPosition(origin[0], origin[1]); };
00494 virtual int PopPosition(int *col, int *row);
00495 virtual int PopPosition(int origin[2])
00496 { return this->PopPosition(&origin[0], &origin[1]); };
00498
00500
00502 virtual int SaveLayoutBeforeMaximize();
00503 virtual int RestoreLayoutBeforeMaximize();
00505
00506
00507
00508 private:
00509
00510 vtkKWSelectionFrameLayoutManager(const vtkKWSelectionFrameLayoutManager&);
00511 void operator=(const vtkKWSelectionFrameLayoutManager&);
00512 };
00513
00514 #endif
00515