debian/tmp/usr/include/KWWidgets/vtkKWSelectionFrame.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWSelectionFrame.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 // .NAME vtkKWSelectionFrame - Selection Frame 
00015 // .SECTION Description
00016 // The selction frame is what contains a render widget.  
00017 // It is called a "selection frame" because in its title bar, you can 
00018 // select which render widget to display in it.
00019 // .SECTION See Also
00020 // vtkKWSelectionFrameLayoutManager
00021 
00022 #ifndef __vtkKWSelectionFrame_h
00023 #define __vtkKWSelectionFrame_h
00024 
00025 #include "vtkKWCompositeWidget.h"
00026 
00027 class vtkKWFrame;
00028 class vtkKWLabel;
00029 class vtkKWMenuButton;
00030 class vtkKWPushButton;
00031 class vtkKWSelectionFrameInternals;
00032 class vtkKWToolbarSet;
00033 class vtkStringArray;
00034 
00035 class KWWidgets_EXPORT vtkKWSelectionFrame : public vtkKWCompositeWidget
00036 {
00037 public:
00038   static vtkKWSelectionFrame* New();
00039   vtkTypeRevisionMacro(vtkKWSelectionFrame, vtkKWCompositeWidget);
00040   void PrintSelf(ostream& os, vtkIndent indent);
00041   
00042   // Description:
00043   // Set/Get title
00044   virtual void SetTitle(const char *title);
00045   virtual const char* GetTitle();
00046 
00047   // Description:
00048   // Select/Deselect the window
00049   virtual void SetSelected(int);
00050   vtkGetMacro(Selected, int);
00051   vtkBooleanMacro(Selected, int);
00052 
00053   // Description:
00054   // Set the selection list (array of num strings).
00055   // The selection list is represented as a pull down menu, which
00056   // visibility can be set. As a convenience, any entry made of two
00057   // dashes "--" is used as a separator.
00058   // This selection list can be used, for example, to display the titles
00059   // of other selection frames that can be switched with the current 
00060   // selection frame.
00061   virtual void SetSelectionList(int num, const char **list);
00062   virtual void SetSelectionList(vtkStringArray *list);
00063   vtkGetObjectMacro(SelectionListMenuButton, vtkKWMenuButton);
00064 
00065   // Description:
00066   // Specifies a command to associate with the widget. This command is 
00067   // invoked when an item is picked by the user in the selection list.
00068   // The 'object' argument is the object that will have the method called on
00069   // it. The 'method' argument is the name of the method to be called and any
00070   // arguments in string form. If the object is NULL, the method is still
00071   // evaluated as a simple command. 
00072   // The following parameters are also passed to the command:
00073   // - item selected in the list: const char *
00074   // - pointer to this object: vtkKWSelectionFrame*
00075   virtual void SetSelectionListCommand(vtkObject *object, const char *method);
00076 
00077   // Description:
00078   // Set/Get the selection list visibility.
00079   virtual void SetSelectionListVisibility(int);
00080   vtkGetMacro(SelectionListVisibility, int);
00081   vtkBooleanMacro(SelectionListVisibility, int);
00082 
00083   // Description:
00084   // Allow the close functionality (button and menu entry)
00085   // If set, a close button is added in the top right corner,
00086   // and a "Close" entry is added to the end of the selection list.
00087   virtual void SetAllowClose(int);
00088   vtkGetMacro(AllowClose, int);
00089   vtkBooleanMacro(AllowClose, int);
00090   vtkGetObjectMacro(CloseButton, vtkKWPushButton);
00091 
00092   // Description:
00093   // Specifies a command to associate with the widget. This command is 
00094   // typically invoked when the widget is closed (using the close button
00095   // or the Close() method).
00096   // The 'object' argument is the object that will have the method called on
00097   // it. The 'method' argument is the name of the method to be called and any
00098   // arguments in string form. If the object is NULL, the method is still
00099   // evaluated as a simple command. 
00100   // The following parameters are also passed to the command:
00101   // - pointer to this object: vtkKWSelectionFrame*
00102   virtual void SetCloseCommand(vtkObject *object, const char *method);
00103 
00104   // Description:
00105   // Close the selection frame. It can be re-implemented by
00106   // subclasses to add more functionalities, release resources, etc.
00107   // The current implementation invokes the CloseCommand, if any.
00108   virtual void Close();
00109 
00110   // Description:
00111   // Allow title to be changed (menu entry)
00112   // If set, a "Change title" entry is added to the end of the selection list,
00113   // enabling the title to be changed using the ChangeTitleCommand. There
00114   // is actually no code or user interface to change the title, it is left
00115   // to the ChangeTitleCommand.
00116   virtual void SetAllowChangeTitle(int);
00117   vtkGetMacro(AllowChangeTitle, int);
00118   vtkBooleanMacro(AllowChangeTitle, int);
00119 
00120   // Description:
00121   // Specifies a command to associate with the widget. This command is 
00122   // typically invoked when the "Change title" menu entry is selected.
00123   // This command is usually implemented by a different class and will, 
00124   // for example, query the user for a new title, check that this title meet
00125   // some constraints, and call SetTitle() on this object (which in turn will
00126   // trigger the TitleChangedCommand).
00127   // The 'object' argument is the object that will have the method called on
00128   // it. The 'method' argument is the name of the method to be called and any
00129   // arguments in string form. If the object is NULL, the method is still
00130   // evaluated as a simple command. 
00131   // The following parameters are also passed to the command:
00132   // - pointer to this object: vtkKWSelectionFrame*
00133   virtual void SetChangeTitleCommand(vtkObject *object, const char *method);
00134 
00135   // Description:
00136   // Specifies a command to associate with the widget. This command is 
00137   // typically invoked when the title is changed.
00138   // This command can be used, for example, to notify a layout manager that
00139   // it should refresh its list of available selection frame titles 
00140   // (see vtkKWSelectionFrameLayoutManager).
00141   // Do not confuse this command with the ChangeTitleCommand, which is invoked
00142   // when the "Change Title" menu entry is selected by the user, and is used
00143   // to allow a third-party class to provide some user-dialog and change
00144   // the title (given some potential constraints). This user-dialog will, in
00145   // turn, most probably call SetTitle, which will trigger TitleChangedCommand.
00146   // The 'object' argument is the object that will have the method called on
00147   // it. The 'method' argument is the name of the method to be called and any
00148   // arguments in string form. If the object is NULL, the method is still
00149   // evaluated as a simple command. 
00150   // The following parameters are also passed to the command:
00151   // - pointer to this object: vtkKWSelectionFrame*
00152   virtual void SetTitleChangedCommand(vtkObject *object, const char *method);
00153 
00154   // Description:
00155   // Specifies a command to associate with the widget. This command is 
00156   // typically invoked when the frame title is selected by the user
00157   // (click in title bar).
00158   // The 'object' argument is the object that will have the method called on
00159   // it. The 'method' argument is the name of the method to be called and any
00160   // arguments in string form. If the object is NULL, the method is still
00161   // evaluated as a simple command. 
00162   // The following parameters are also passed to the command:
00163   // - pointer to this object: vtkKWSelectionFrame*
00164   virtual void SetSelectCommand(vtkObject *object, const char *method);
00165 
00166   // Description:
00167   // Specifies a command to associate with the widget. This command is 
00168   // typically invoked when the frame title is double-clicked on.
00169   // Note that this will also invoke the SelectCommand, since the first
00170   // click acts as a select event.
00171   // The 'object' argument is the object that will have the method called on
00172   // it. The 'method' argument is the name of the method to be called and any
00173   // arguments in string form. If the object is NULL, the method is still
00174   // evaluated as a simple command. 
00175   // The following parameters are also passed to the command:
00176   // - pointer to this object: vtkKWSelectionFrame*
00177   virtual void SetDoubleClickCommand(vtkObject *object, const char *method);
00178 
00179   // Description:
00180   // Set/Get the title foregroud/background color (in both normal and 
00181   // selected mode). 
00182   vtkGetVector3Macro(TitleColor, double);
00183   virtual void SetTitleColor(double r, double g, double b);
00184   virtual void SetTitleColor(double rgb[3])
00185     { this->SetTitleColor(rgb[0], rgb[1], rgb[2]); };
00186   vtkGetVector3Macro(TitleSelectedColor, double);
00187   virtual void SetTitleSelectedColor(double r, double g, double b);
00188   virtual void SetTitleSelectedColor(double rgb[3])
00189     { this->SetTitleSelectedColor(rgb[0], rgb[1], rgb[2]); };
00190   vtkGetVector3Macro(TitleBackgroundColor, double);
00191   virtual void SetTitleBackgroundColor(double r, double g, double b);
00192   virtual void SetTitleBackgroundColor(double rgb[3])
00193     { this->SetTitleBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00194   vtkGetVector3Macro(TitleSelectedBackgroundColor, double);
00195   virtual void SetTitleSelectedBackgroundColor(double r, double g, double b);
00196   virtual void SetTitleSelectedBackgroundColor(double rgb[3])
00197     { this->SetTitleSelectedBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00198   
00199   // Description:
00200   // Set/Get the title bar visibility.
00201   virtual void SetTitleBarVisibility(int);
00202   vtkGetMacro(TitleBarVisibility, int);
00203   vtkBooleanMacro(TitleBarVisibility, int);
00204 
00205   // Description:
00206   // Set/Get the toolbar set visibility, and retrieve the toolbar set.
00207   // The toolbar set is usually displayed below the title bar
00208   virtual vtkKWToolbarSet* GetToolbarSet();
00209   virtual void SetToolbarSetVisibility(int);
00210   vtkGetMacro(ToolbarSetVisibility, int);
00211   vtkBooleanMacro(ToolbarSetVisibility, int);
00212 
00213   // Description:
00214   // Retrieve the title bar user frame. This frame sits in the title
00215   // bar, on the right side of the title itself, and be used to insert
00216   // user-defined UI elements. It is not visible if TitleBarVisibility
00217   // is Off.
00218   virtual vtkKWFrame* GetTitleBarUserFrame();
00219 
00220   // Description:
00221   // Retrieve the body frame. This is the main frame, below the title bar,
00222   // where to pack the real contents of whatever that object is supposed
00223   // to display (say, a render widget).
00224   vtkGetObjectMacro(BodyFrame, vtkKWFrame);
00225   
00226   // Description:
00227   // Set/Get the left user-frame visibility, and retrieve the frame.
00228   // The left user-frame is displayed on the left side of the BodyFrame, as
00229   // its name implies, can be used to put any extra UI the user wants.
00230   virtual vtkKWFrame* GetLeftUserFrame();
00231   virtual void SetLeftUserFrameVisibility(int);
00232   vtkGetMacro(LeftUserFrameVisibility, int);
00233   vtkBooleanMacro(LeftUserFrameVisibility, int);
00234 
00235   // Description:
00236   // Set/Get the right user-frame visibility, and retrieve the frame.
00237   // The right user-frame is displayed on the right side of the BodyFrame, as
00238   // its name implies, can be used to put any extra UI the user wants.
00239   virtual vtkKWFrame* GetRightUserFrame();
00240   virtual void SetRightUserFrameVisibility(int);
00241   vtkGetMacro(RightUserFrameVisibility, int);
00242   vtkBooleanMacro(RightUserFrameVisibility, int);
00243 
00244   // Description:
00245   // Set/Get the outer selection frame width and color. The outer selection
00246   // frame is a thin frame around the whole widget which color is changed
00247   // when the widget is selected. This is useful, for example, when the
00248   // title bar is not visible (the title bar color also changes when the
00249   // widget is selected). Set the width of the selection frame to 0 to
00250   // discard this feature. Colors can be customized.
00251   virtual void SetOuterSelectionFrameWidth(int);
00252   vtkGetMacro(OuterSelectionFrameWidth, int);
00253   vtkGetVector3Macro(OuterSelectionFrameColor, double);
00254   virtual void SetOuterSelectionFrameColor(double r, double g, double b);
00255   virtual void SetOuterSelectionFrameColor(double rgb[3])
00256     { this->SetOuterSelectionFrameColor(rgb[0], rgb[1], rgb[2]); };
00257   vtkGetVector3Macro(OuterSelectionFrameSelectedColor, double);
00258   virtual void SetOuterSelectionFrameSelectedColor(
00259     double r, double g, double b);
00260   virtual void SetOuterSelectionFrameSelectedColor(double rgb[3])
00261     { this->SetOuterSelectionFrameSelectedColor(rgb[0], rgb[1], rgb[2]); };
00262 
00263   // Description:
00264   // Set/Get if the outer selection frame is blinking.
00265   virtual void SetOuterSelectionFrameBlinking(int);
00266   vtkGetMacro(OuterSelectionFrameBlinking, int);
00267   vtkBooleanMacro(OuterSelectionFrameBlinking, int);
00268   
00269   // Description:
00270   // Update the "enable" state of the object and its internal parts.
00271   // Depending on different Ivars (this->Enabled, the application's 
00272   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00273   // and propagated to its internal parts/subwidgets. This will, for example,
00274   // enable/disable parts of the widget UI, enable/disable the visibility
00275   // of 3D widgets, etc.
00276   virtual void UpdateEnableState();
00277 
00278   // Description:
00279   // Callbacks. Internal, do not use.
00280   virtual void CloseCallback();
00281   virtual void SelectionListCallback(const char *menuItem);
00282   virtual void SelectCallback();
00283   virtual void DoubleClickCallback();
00284   virtual void ChangeTitleCallback();
00285   virtual void OuterSelectionFrameBlinkingCallback();
00286   
00287 protected:
00288   vtkKWSelectionFrame();
00289   ~vtkKWSelectionFrame();
00290   
00291   // Description:
00292   // Create the widget.
00293   virtual void CreateWidget();
00294   
00295   vtkKWFrame      *OuterSelectionFrame;
00296   vtkKWFrame      *TitleBarFrame;
00297   vtkKWMenuButton *SelectionListMenuButton;
00298   vtkKWPushButton *CloseButton;
00299   vtkKWLabel      *TitleLabel;
00300   vtkKWFrame      *BodyFrame;
00301 
00302   virtual void Pack();
00303   virtual void Bind();
00304   virtual void UnBind();
00305 
00306   virtual int SetColor(double *color, double r, double g, double b);
00307   virtual void UpdateSelectedAspect();
00308   virtual void UpdateOuterSelectionFrameColor();
00309   virtual void UpdateSelectionListMenuButton();
00310 
00311   double TitleColor[3];
00312   double TitleSelectedColor[3];
00313   double TitleBackgroundColor[3];
00314   double TitleSelectedBackgroundColor[3];
00315 
00316   double OuterSelectionFrameColor[3];
00317   double OuterSelectionFrameSelectedColor[3];
00318 
00319   char *SelectionListCommand;
00320   char *CloseCommand;
00321   char *SelectCommand;
00322   char *DoubleClickCommand;
00323   char *ChangeTitleCommand;
00324   char *TitleChangedCommand;
00325   virtual void InvokeSelectionListCommand(const char*, vtkKWSelectionFrame*);
00326   virtual void InvokeCloseCommand(vtkKWSelectionFrame *obj);
00327   virtual void InvokeSelectCommand(vtkKWSelectionFrame *obj);
00328   virtual void InvokeDoubleClickCommand(vtkKWSelectionFrame *obj);
00329   virtual void InvokeChangeTitleCommand(vtkKWSelectionFrame *obj);
00330   virtual void InvokeTitleChangedCommand(vtkKWSelectionFrame *obj);
00331 
00332   int Selected;
00333   int SelectionListVisibility;
00334   int AllowClose;
00335   int AllowChangeTitle;
00336   int ToolbarSetVisibility;
00337   int LeftUserFrameVisibility;
00338   int RightUserFrameVisibility;
00339   int TitleBarVisibility;
00340   int OuterSelectionFrameWidth;
00341   int OuterSelectionFrameBlinking;
00342 
00343   virtual void CreateOuterSelectionFrameBlinkingTimer();
00344   virtual void CancelOuterSelectionFrameBlinkingTimer();
00345 
00346   // PIMPL Encapsulation for STL containers
00347 
00348   vtkKWSelectionFrameInternals *Internals;
00349 
00350 private:
00351 
00352   vtkKWToolbarSet *ToolbarSet;
00353   vtkKWFrame      *LeftUserFrame;
00354   vtkKWFrame      *RightUserFrame;
00355   vtkKWFrame      *TitleBarUserFrame;
00356 
00357   vtkKWSelectionFrame(const vtkKWSelectionFrame&);  // Not implemented
00358   void operator=(const vtkKWSelectionFrame&);  // Not implemented
00359 };
00360 
00361 #endif
00362 

Generated by  doxygen 1.6.2