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

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWToolbarSet.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 vtkKWToolbarSet - a "set of toolbars" widget
00015 // .SECTION Description
00016 // A simple widget representing a set of toolbars..
00017 
00018 #ifndef __vtkKWToolbarSet_h
00019 #define __vtkKWToolbarSet_h
00020 
00021 #include "vtkKWCompositeWidget.h"
00022 
00023 class vtkKWFrame;
00024 class vtkKWMenu;
00025 class vtkKWSeparator;
00026 class vtkKWToolbar;
00027 class vtkKWToolbarSetInternals;
00028 
00029 class KWWidgets_EXPORT vtkKWToolbarSet : public vtkKWCompositeWidget
00030 {
00031 public:
00032   static vtkKWToolbarSet* New();
00033   vtkTypeRevisionMacro(vtkKWToolbarSet,vtkKWCompositeWidget);
00034   void PrintSelf(ostream& os, vtkIndent indent);
00035 
00036   // Description:
00037   // Get the frame that can be used as a parent to a toolbar
00038   vtkGetObjectMacro(ToolbarsFrame, vtkKWFrame);
00039 
00040   // Description:
00041   // Add a toolbar to the set.
00042   // The default_visibility parameter sets the visibility of the toolbar
00043   // in the set once it is added (so that it can be added hidden for example,
00044   // before its visibility setting is retrieved from the registry).
00045   // Return 1 on success, 0 otherwise.
00046   virtual int AddToolbar(vtkKWToolbar *toolbar)
00047     { return this->AddToolbar(toolbar, 1); };
00048   virtual int AddToolbar(vtkKWToolbar *toolbar, int default_visibility);
00049   virtual int HasToolbar(vtkKWToolbar *toolbar);
00050   
00051   // Description:
00052   // Get the n-th toolbar, and the number of toolbars.
00053   virtual vtkKWToolbar* GetNthToolbar(int rank);
00054   virtual int GetNumberOfToolbars();
00055 
00056   // Description:
00057   // Remove a toolbar (or all) from the set.
00058   // Return 1 on success, 0 otherwise.
00059   virtual int RemoveToolbar(vtkKWToolbar *toolbar);
00060   virtual void RemoveAllToolbars();
00061 
00062   // Description:
00063   // Set/Get the aspect of the toolbar (flat or 3D GUI style, or unchanged)
00064   // Important: this will *not* override the toolbar aspect of a toolbar
00065   // which aspect was already set to 'UnChanged'.
00066   virtual void SetToolbarsAspect(int);
00067 
00068   // Description:
00069   // Set/Get the aspect of the widgets (flat, 3D GUI style, or unchanged)
00070   // Important: this will *not* override the widgets aspect of a toolbar
00071   // which widgets aspect was already set to 'UnChanged'.
00072   virtual void SetToolbarsWidgetsAspect(int);
00073 
00074   // Description:
00075   // Set the visibility of a toolbar.
00076   virtual void HideToolbar(vtkKWToolbar *toolbar);
00077   virtual void ShowToolbar(vtkKWToolbar *toolbar);
00078   virtual void SetToolbarVisibility(vtkKWToolbar *toolbar, int flag);
00079   virtual int GetToolbarVisibility(vtkKWToolbar *toolbar);
00080   virtual void ToggleToolbarVisibility(vtkKWToolbar *toolbar);
00081 
00082   // Description:
00083   // Return the number of visible toolbars
00084   virtual int GetNumberOfVisibleToolbars();
00085 
00086   // Description:
00087   // Set a toolbar's anchor. By default, toolbars are packed from left
00088   // to right in the order they were added to the toolbar set, i.e. each
00089   // toolbar is "anchored" to the west side of the set. One can change
00090   // this anchor on a per-toolbar basis. This means that all toolbars anchored
00091   // to the west side will be grouped together on that side, and all toolbars
00092   // anchored to the east side will be grouped on the opposite side. Note
00093   // though that anchoring acts like a "mirror": packing starts from the
00094   // anchor side, progressing towards the middle of the toolbar set (i.e.,
00095   // toolbars anchored west are packed left to right, toolbars anchored east
00096   // are packed right to left, following the order they were inserted in
00097   // the set).
00098   //BTX
00099   enum 
00100   {
00101     ToolbarAnchorWest = 0,
00102     ToolbarAnchorEast
00103   };
00104   //ETX
00105   virtual void SetToolbarAnchor(vtkKWToolbar *toolbar, int anchor);
00106   virtual int GetToolbarAnchor(vtkKWToolbar *toolbar);
00107   virtual void SetToolbarAnchorToWest(vtkKWToolbar *toolbar)
00108     { this->SetToolbarAnchor(toolbar, vtkKWToolbarSet::ToolbarAnchorWest); };
00109   virtual void SetToolbarAnchorToEast(vtkKWToolbar *toolbar)
00110     { this->SetToolbarAnchor(toolbar, vtkKWToolbarSet::ToolbarAnchorEast); };
00111 
00112   // Description:
00113   // Save/Restore the visibility flag of one/all toolbars to/from the registry
00114   // Note that the name of each toolbar to save/restore should have been set
00115   // for this method to work (see vtkKWToolbar).
00116   virtual void SaveToolbarVisibilityToRegistry(vtkKWToolbar *toolbar);
00117   virtual void RestoreToolbarVisibilityFromRegistry(vtkKWToolbar *toolbar);
00118   virtual void SaveToolbarsVisibilityToRegistry();
00119   virtual void RestoreToolbarsVisibilityFromRegistry();
00120 
00121   // Description:
00122   // Set/Get if the visibility flag of the toolbars should be saved
00123   // or restored to the registry automatically.
00124   // It is restored when the toolbar is added, and saved when the visibility
00125   // flag is changed.
00126   vtkBooleanMacro(SynchronizeToolbarsVisibilityWithRegistry, int); 
00127   vtkGetMacro(SynchronizeToolbarsVisibilityWithRegistry, int); 
00128   vtkSetMacro(SynchronizeToolbarsVisibilityWithRegistry, int); 
00129 
00130   // Description:
00131   // Create and update a menu that can be used to control the visibility of
00132   // all toolbars.
00133   // The Populate...() method will repopulate the menu (note that it does 
00134   // *not* remove all entries, so that this menu can be used for several
00135   // toolbar sets).
00136   // The Update...() method will update the state of the entries according
00137   // to the toolbarsvisibility (the first one will call the second one
00138   // automatically).
00139   virtual void PopulateToolbarsVisibilityMenu(vtkKWMenu *menu);
00140   virtual void UpdateToolbarsVisibilityMenu(vtkKWMenu *menu);
00141 
00142   // Description:
00143   // Specifies a command to associate with the widget. This command is 
00144   // typically invoked when the visibility of a toolbar is changed.
00145   // The 'object' argument is the object that will have the method called on
00146   // it. The 'method' argument is the name of the method to be called and any
00147   // arguments in string form. If the object is NULL, the method is still
00148   // evaluated as a simple command. 
00149   // The following parameters are also passed to the command:
00150   // - pointer to the toolbar which visibility changed: vtkKWToolbar*
00151   virtual void SetToolbarVisibilityChangedCommand(
00152     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 number of toolbars has changed 
00157   // (i.e. a toolbar is added or removed).
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   virtual void SetNumberOfToolbarsChangedCommand(
00163     vtkObject *object, const char *method);
00164 
00165   // Description:
00166   // Set/Get the visibility of the separator at the bottom of the set
00167   virtual void SetBottomSeparatorVisibility(int);
00168   vtkBooleanMacro(BottomSeparatorVisibility, int); 
00169   vtkGetMacro(BottomSeparatorVisibility, int); 
00170 
00171   // Description:
00172   // Set/Get the visibility of the separator at the top of the set
00173   virtual void SetTopSeparatorVisibility(int);
00174   vtkBooleanMacro(TopSeparatorVisibility, int); 
00175   vtkGetMacro(TopSeparatorVisibility, int); 
00176 
00177   // Description:
00178   // Update the toolbar set 
00179   // (update the enabled state of all toolbars, call PackToolbars(), etc.).
00180   virtual void Update();
00181 
00182   // Description:
00183   // (Re)Pack the toolbars, if needed (if the widget is created, and the
00184   // toolbar is created, AddToolbar will pack the toolbar automatically).
00185   virtual void Pack();
00186   
00187   // Description:
00188   // Update the "enable" state of the object and its internal parts.
00189   // Depending on different Ivars (this->Enabled, the application's 
00190   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00191   // and propagated to its internal parts/subwidgets. This will, for example,
00192   // enable/disable parts of the widget UI, enable/disable the visibility
00193   // of 3D widgets, etc.
00194   virtual void UpdateEnableState();
00195 
00196 protected:
00197   vtkKWToolbarSet();
00198   ~vtkKWToolbarSet();
00199 
00200   // Description:
00201   // Create the widget.
00202   virtual void CreateWidget();
00203 
00204   vtkKWSeparator *TopSeparator;
00205   vtkKWFrame     *ToolbarsFrame;
00206   vtkKWSeparator *BottomSeparator;
00207 
00208   int BottomSeparatorVisibility;
00209   int TopSeparatorVisibility;
00210   int SynchronizeToolbarsVisibilityWithRegistry;
00211 
00212   char *ToolbarVisibilityChangedCommand;
00213   char *NumberOfToolbarsChangedCommand;
00214 
00215   virtual void InvokeToolbarVisibilityChangedCommand(
00216     vtkKWToolbar *toolbar);
00217   virtual void InvokeNumberOfToolbarsChangedCommand();
00218 
00219   //BTX
00220 
00221   // A toolbar slot stores a toolbar + some infos
00222  
00223   class ToolbarSlot
00224   {
00225   public:
00226     int Visibility;
00227     int Anchor;
00228     vtkKWSeparator *Separator;
00229     vtkKWToolbar   *Toolbar;
00230   };
00231 
00232   // PIMPL Encapsulation for STL containers
00233 
00234   vtkKWToolbarSetInternals *Internals;
00235   friend class vtkKWToolbarSetInternals;
00236 
00237   // Helper methods
00238 
00239   ToolbarSlot* GetToolbarSlot(vtkKWToolbar *toolbar);
00240 
00241   //ETX
00242 
00243   virtual void PackToolbars();
00244   virtual void PackBottomSeparator();
00245   virtual void PackTopSeparator();
00246 
00247 private:
00248   vtkKWToolbarSet(const vtkKWToolbarSet&); // Not implemented
00249   void operator=(const vtkKWToolbarSet&); // Not implemented
00250 };
00251 
00252 #endif
00253 

Generated on Sat Dec 12 16:04:57 2009 for KWWidgets by  doxygen 1.6.1