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

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWUserInterfaceManager.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 vtkKWUserInterfaceManager - a user interface manager.
00015 // .SECTION Description
00016 // This class is used to abstract the way a set of interface "panels" 
00017 // (vtkKWUserInterfacePanel) can be grouped inside a widget. 
00018 // For example, if a concrete implementation of that class
00019 // uses a notebook as its underlying widget, then it will deliver a notebook's 
00020 // page when one of its managed panels request a "page" (i.e. a section 
00021 // within a panel). If another concrete implementation chooses for
00022 // a flat GUI for example, then it will likely return frames as pages and 
00023 // pack them on top of each other.
00024 // This class is not a widget. Concrete implementation of this class will
00025 // provide an access point to a widget into which the manager will organize
00026 // its panels (a notebook, a frame, etc.). 
00027 // Besides packing this widget, you will just have to set each panel's
00028 // UserInterfaceManager ivar to point to this manager, and the rest should 
00029 // be taken care of (i.e. you do not need to manually add a panel to a manager,
00030 // or manually request a page from the manager, it should be done through the 
00031 // panel's API).
00032 // .SECTION See Also
00033 // vtkKWUserInterfaceManagerNotebook vtkKWUserInterfacePanel
00034 
00035 #ifndef __vtkKWUserInterfaceManager_h
00036 #define __vtkKWUserInterfaceManager_h
00037 
00038 #include "vtkKWObject.h"
00039 
00040 class vtkKWIcon;
00041 class vtkKWWidget;
00042 class vtkKWUserInterfacePanel;
00043 class vtkKWUserInterfaceManagerInternals;
00044 
00045 class KWWidgets_EXPORT vtkKWUserInterfaceManager : public vtkKWObject
00046 {
00047 public:
00048   vtkTypeRevisionMacro(vtkKWUserInterfaceManager,vtkKWObject);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00051   // Description:
00052   // Create the manager widget (i.e. the widget that will group and display
00053   // all user interface panels).
00054   virtual void Create();
00055   virtual int IsCreated();
00056 
00057   // Description:
00058   // Enable/Disable this interface. This propagates SetEnabled() calls to all
00059   // panels.
00060   virtual void SetEnabled(int);
00061   virtual void UpdateEnableState();
00062 
00063   // Description:
00064   // Iterate over all panels and call Update() for each one. This will refresh
00065   // the panels (provided that Update() has been reimplemented).
00066   virtual void Update();
00067 
00068   // Description:
00069   // Add a panel to the manager.
00070   // Note that you most probably do not need to call this method, since setting
00071   // a panel's UserInterfaceManager ivar will add the panel automatically 
00072   // (see vtkKWUserInterfacePanel::SetUserInterfaceManager()).
00073   // Return a unique positive ID corresponding to that panel, or < 0 on error.
00074   virtual int AddPanel(vtkKWUserInterfacePanel *panel);
00075   virtual int HasPanel(vtkKWUserInterfacePanel *panel);
00076 
00077   // Description:
00078   // Get the number of panel
00079   virtual int GetNumberOfPanels();
00080 
00081   // Description:
00082   // Get the panel from its name or ID, from a page ID (return the ID of the
00083   // panel that holds that page), or the nth panel.
00084   virtual vtkKWUserInterfacePanel* GetPanel(const char *panel_name);
00085   virtual vtkKWUserInterfacePanel* GetPanel(int id);
00086   virtual vtkKWUserInterfacePanel* GetPanelFromPageId(int id) = 0;
00087   virtual vtkKWUserInterfacePanel* GetNthPanel(int rank);
00088 
00089   // Description:
00090   // Remove a panel (or all) from the manager.
00091   // Note that you most probably do not need to call this method, since setting
00092   // a panel's UserInterfaceManager ivar to NULL will remove the panel 
00093   // automatically (this is done in the panel's destructor).
00094   // Return 1 on success, 0 on error.
00095   virtual int RemovePanel(vtkKWUserInterfacePanel *panel);
00096   virtual void RemoveAllPanels();
00097 
00098   // Description:
00099   // Instruct the manager to reserve or remove a page for a given panel.
00100   // Note that you should use the panel's own API to add a page to a panel: 
00101   // this will automatically call this method with the proper panel parameter 
00102   // (see vtkKWUserInterfacePanel::AddPage() and 
00103   // vtkKWUserInterfacePanel::RemovePage()).
00104   // Return a unique positive ID for the page that was reserved/removed,
00105   // or < 0 on error.
00106   virtual int AddPage(vtkKWUserInterfacePanel *panel, 
00107                       const char *title, 
00108                       const char *balloon = 0, 
00109                       vtkKWIcon *icon = 0) = 0;
00110   virtual int RemovePage(vtkKWUserInterfacePanel *panel, 
00111                          const char *title) = 0;
00112 
00113   // Description:
00114   // Set a page's title, balloon help and icon.
00115   virtual void SetPageTitle(int id, const char *title) = 0;
00116   virtual void SetPageBalloonHelpString(int id, const char *str) = 0;
00117   virtual void SetPageIcon(int id, vtkKWIcon *icon) = 0;
00118   virtual void SetPageIconToPredefinedIcon(int id, int icon_index) = 0;
00119 
00120   // Description:
00121   // Retrieve the widget corresponding to a given page reserved by the manager.
00122   // This can be done through the unique page ID, or using a panel and the
00123   // page title. The user UI components should be inserted into this widget.
00124   // Note that you should use the panel's own API to get a page widget: this
00125   // will automatically call this method with the proper ID or panel parameter
00126   // (see vtkKWUserInterfacePanel::GetPageWidget()).
00127   // Return NULL on error.
00128   virtual vtkKWWidget* GetPageWidget(int id) = 0;
00129   virtual vtkKWWidget* GetPageWidget(vtkKWUserInterfacePanel *panel, 
00130                                      const char *title) = 0;
00131                       
00132   // Description:
00133   // Retrieve the parent widget of the pages associated to a panel. It is
00134   // the unique widget that is common to all pages in the chain of parents.
00135   // Note that you should use the panel's own API to get the page parent: this
00136   // will automatically call this method with the proper panel parameter
00137   // (see vtkKWUserInterfacePanel::GetPagesParentWidget()).
00138   virtual vtkKWWidget *GetPagesParentWidget(vtkKWUserInterfacePanel *panel)= 0;
00139 
00140   // Description:
00141   // Raise a page reserved by the manager. This can be done through the unique 
00142   // page ID, or using a panel and the page title.
00143   // Note that you should use the panel's own API to raise a page: this
00144   // will automatically call this method with the proper ID or panel parameter
00145   // (see vtkKWUserInterfacePanel::RaisePage()).
00146   virtual void RaisePage(int id) = 0;
00147   virtual void RaisePage(vtkKWUserInterfacePanel *panel, 
00148                          const char *title) = 0;
00149 
00150   // Description:
00151   // Show/Hide a panel. It will make sure the pages reserved by the manager
00152   // for this panel are shown/hidden.
00153   // RaisePanel() behaves like ShowPanel(), but it will also try to bring
00154   // up the first page of the panel to the front (i.e., "select" it).
00155   // IsPanelVisible() checks if the pages of the panel are visible/shown.
00156   // Note that you should use the panel's own API to show/raise a panel: this
00157   // will automatically call this method with the proper panel parameter
00158   // (see vtkKWUserInterfacePanel::Show/Raise()).
00159   // Return 1 on success, 0 on error.
00160   virtual int ShowPanel(vtkKWUserInterfacePanel *panel) = 0;
00161   virtual int HidePanel(vtkKWUserInterfacePanel *panel) = 0;
00162   virtual int IsPanelVisible(vtkKWUserInterfacePanel *panel) = 0;
00163   virtual int RaisePanel(vtkKWUserInterfacePanel *panel) 
00164     { return this->ShowPanel(panel); };
00165 
00166   // Description:
00167   // Show/hide all panels.
00168   virtual void ShowAllPanels();
00169   virtual void HideAllPanels();
00170 
00171   // Description:
00172   // Update a panel according to the manager settings (i.e., it just performs 
00173   // manager-specific changes on the panel). Note that it does not call the
00174   // panel's Update() method, on the opposite the panel's Update() will call
00175   // this method if the panel has a UIM set.
00176   virtual void UpdatePanel(vtkKWUserInterfacePanel *) {};
00177 
00178 protected:
00179   vtkKWUserInterfaceManager();
00180   ~vtkKWUserInterfaceManager();
00181 
00182   // Description:
00183   // Remove the widgets of all pages belonging to a panel. It is called
00184   // by RemovePanel() and should be overloaded if the concrete implementation
00185   // of the manager needs to unmap/unpack widgets before everything is deleted.
00186   // Return 1 on success, 0 on error.
00187   virtual int RemovePageWidgets(vtkKWUserInterfacePanel *) 
00188     { return 1; };
00189 
00190   int IdCounter;
00191 
00192   //BTX
00193 
00194   // A panel slot associate a panel to a unique Id
00195  
00196   class PanelSlot
00197   {
00198   public:
00199     int Id;
00200     vtkKWUserInterfacePanel *Panel;
00201   };
00202 
00203   // PIMPL Encapsulation for STL containers
00204 
00205   vtkKWUserInterfaceManagerInternals *Internals;
00206   friend class vtkKWUserInterfaceManagerInternals;
00207 
00208   // Helper methods
00209   // Get a panel slot given a panel or an id, check if the manager has a given
00210   // panel, get a panel id given a panel, etc.
00211 
00212   PanelSlot* GetPanelSlot(vtkKWUserInterfacePanel *panel);
00213   PanelSlot* GetPanelSlot(int id);
00214   PanelSlot* GetPanelSlot(const char *panel_name);
00215   PanelSlot* GetNthPanelSlot(int rank);
00216   int GetPanelId(vtkKWUserInterfacePanel *panel);
00217 
00218   //ETX
00219 
00220   // Description:
00221   // This method is (and should be) called each time the number of panels
00222   // changes (for example, after AddPanel() / RemovePanel())
00223   virtual void NumberOfPanelsChanged() {};
00224 
00225 private:
00226 
00227   int ManagerIsCreated;
00228 
00229   vtkKWUserInterfaceManager(const vtkKWUserInterfaceManager&); // Not implemented
00230   void operator=(const vtkKWUserInterfaceManager&); // Not Implemented
00231 };
00232 
00233 #endif
00234 

Generated by  doxygen 1.6.2