• Main Page
  • Classes
  • Files
  • Directories
  • File List
  • File Members

vtkKWUserInterfaceManagerDialog.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWUserInterfaceManagerDialog.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 vtkKWUserInterfaceManagerDialog - 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. As such, it is a 
00018 // concrete implementation of a vtkKWUserInterfaceManager. It uses a dialog
00019 // under the hood to display all pages in a "Preferences" dialog style: the
00020 // dialog is split into two parts: on the left, a tree with entries
00021 // corresponding to the name of specific UI elements found in the panels. 
00022 // If an entry is selected, the corresponding UI element is display on the
00023 // right side of the dialog. This allows a lot of small UI elements to be
00024 // accessed pretty easily while keeping the size of the whole dialog small.
00025 // For each panel, this class creates an entry in the tree using the
00026 // panel name. For each page in the panel, it creates a sub-entry (leaf)
00027 // under the panel name entry, using the page name. Then for each UI elements
00028 // in that page, it looks for instances of vtkKWFrameWithLabel. This is the
00029 // only constraint put on the panels, other than that, the panels
00030 // (vtkKWUserInterfacePanel) can be created as usual, and managed by any
00031 // subclass of vtkKWUserInterfaceManager. This is not too big a constraint
00032 // since most panels are built that way. For a concrete example of such
00033 // a panel, check vtkKWApplicationSettingsInterface.
00034 // .SECTION Thanks
00035 // This work is part of the National Alliance for Medical Image
00036 // Computing (NAMIC), funded by the National Institutes of Health
00037 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
00038 // Information on the National Centers for Biomedical Computing
00039 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
00040 // .SECTION See Also
00041 // vtkKWUserInterfaceManager vtkKWUserInterfacePanel vtkKWApplicationSettingsInterface
00042 
00043 #ifndef __vtkKWUserInterfaceManagerDialog_h
00044 #define __vtkKWUserInterfaceManagerDialog_h
00045 
00046 #include "vtkKWUserInterfaceManager.h"
00047 
00048 class vtkKWIcon;
00049 class vtkKWNotebook;
00050 class vtkKWPushButton;
00051 class vtkKWSeparator;
00052 class vtkKWSplitFrame;
00053 class vtkKWTopLevel;
00054 class vtkKWTreeWithScrollbars;
00055 class vtkKWUserInterfaceManagerDialogInternals;
00056 class vtkKWUserInterfacePanel;
00057 class vtkKWWidget;
00058 
00059 class KWWidgets_EXPORT vtkKWUserInterfaceManagerDialog : public vtkKWUserInterfaceManager
00060 {
00061 public:
00062   static vtkKWUserInterfaceManagerDialog* New();
00063   vtkTypeRevisionMacro(vtkKWUserInterfaceManagerDialog,vtkKWUserInterfaceManager);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00066   // Description:
00067   // Create the manager widget (i.e. the widget that will group and display
00068   // all user interface panels). A notebook must be associated to the manager
00069   // before it is created.
00070   virtual void Create();
00071 
00072   // Description:
00073   // Set the panel node visibility. If On, each panel will show up as
00074   // a node in the tree, acting as a parent to the page nodes or the section
00075   // nodes. Defaults to Off to avoid too much clutter in the tree.
00076   virtual void SetPanelNodeVisibility(int);
00077   vtkGetMacro(PanelNodeVisibility, int);
00078   vtkBooleanMacro(PanelNodeVisibility, int);
00079 
00080   // Description:
00081   // Set the page node visibility. If On, each page will show up as
00082   // a node in the tree, acting as a parent to the section nodes.
00083   // Default to On. Since sections can have the same name within different
00084   // pages, it is advised to leave it On. 
00085   virtual void SetPageNodeVisibility(int);
00086   vtkGetMacro(PageNodeVisibility, int);
00087   vtkBooleanMacro(PageNodeVisibility, int);
00088 
00089   // Description:
00090   // Access to the dialog/toplevel
00091   // Can be used to change its title, and master window
00092   vtkGetObjectMacro(TopLevel, vtkKWTopLevel);
00093 
00094   // Description:
00095   // Get the application instance for this object.
00096   // Override the superclass to try to retrieve the toplevel's application
00097   // if it was not set already.
00098   virtual vtkKWApplication* GetApplication();
00099 
00100   // Description:
00101   // Raise a specific section, given a panel, a page id (or page title) 
00102   // and a section name. If panel is NULL, page_id is < 0, 
00103   // page_title is NULL or empty, section is NULL or empty, then any of these
00104   // parameters will be ignored and the first matching section will be picked.
00105   virtual void RaiseSection(int page_id, 
00106                             const char *section);
00107   virtual void RaiseSection(vtkKWUserInterfacePanel *panel, 
00108                             const char *page_title, 
00109                             const char *section);
00110 
00111   // Description:
00112   // Instruct the manager to reserve or remove a page for a given panel.
00113   // In this concrete implementation, this adds or removes a page to the 
00114   // notebook, and sets the page tag to be the panel's ID.
00115   // Note that you should use the panel's own API to add a page to a panel: 
00116   // this will automatically call this method with the proper panel parameter 
00117   // (see vtkKWUserInterfacePanel::AddPage() and 
00118   // vtkKWUserInterfacePanel::RemovePage()).
00119   // Return a unique positive ID for the page that was reserved/removed,
00120   // or < 0 on error.
00121   virtual int AddPage(vtkKWUserInterfacePanel *panel, 
00122                       const char *title, 
00123                       const char *balloon = 0, 
00124                       vtkKWIcon *icon = 0);
00125   virtual int RemovePage(vtkKWUserInterfacePanel *panel, 
00126                          const char *title);
00127 
00128   // Description:
00129   // Set a page's title, balloon help and icon.
00130   virtual void SetPageTitle(int id, const char *new_title);
00131   virtual void SetPageBalloonHelpString(int id, const char *str);
00132   virtual void SetPageIcon(int id, vtkKWIcon *icon);
00133   virtual void SetPageIconToPredefinedIcon(int id, int icon_index);
00134 
00135   // Description:
00136   // Retrieve the widget corresponding to a given page reserved by the manager.
00137   // This can be done through the unique page ID, or using a panel and the
00138   // page title. The user UI components should be inserted into this widget.
00139   // In this concrete implementation, this returns the inner frame of a
00140   // notebook's page.
00141   // Note that you should use the panel's own API to get a page widget: this
00142   // will automatically call this method with the proper ID or panel parameter
00143   // (see vtkKWUserInterfacePanel::GetPageWidget()).
00144   // Return NULL on error.
00145   virtual vtkKWWidget* GetPageWidget(int id);
00146   virtual vtkKWWidget* GetPageWidget(vtkKWUserInterfacePanel *panel, 
00147                                      const char *title);
00148 
00149   // Description:
00150   // Retrieve the parent widget of the pages associated to a panel. It is
00151   // the unique widget that is common to all pages in the chain of parents.
00152   // Note that you should use the panel's own API to get the page parent: this
00153   // will automatically call this method with the proper panel parameter
00154   // (see vtkKWUserInterfacePanel::GetPagesParentWidget()).
00155   virtual vtkKWWidget *GetPagesParentWidget(vtkKWUserInterfacePanel *panel);
00156 
00157   // Description:
00158   // Raise a page reserved by the manager. This can be done through the unique 
00159   // page ID, or using a panel and the page title.
00160   // In this concrete implementation, this raises a notebook's page.
00161   // Note that you should use the panel's own API to raise a page: this
00162   // will automatically call this method with the proper ID or panel parameter
00163   // (see vtkKWUserInterfacePanel::RaisePage()).
00164   // Note that if the panel corresponding to the page to raise has not been
00165   // created yet, it will be created automatically by calling the panel's 
00166   // Create() method (see vtkKWUserInterfacePanel::Create()) ; this allows the
00167   // creation of the panel to be delayed until it is really needed.
00168   virtual void RaisePage(int id);
00169   virtual void RaisePage(vtkKWUserInterfacePanel *panel, 
00170                          const char *title);
00171   
00172   // Description:
00173   // Show/Hide a panel. It will make sure the pages reserved by the manager
00174   // for this panel are shown/hidden.
00175   // In this concrete implementation, this shows/hides all notebook's pages
00176   // belonging to this panel.
00177   // RaisePanel() behaves like ShowPanel(), but it will also try to bring
00178   // up the first page of the panel to the front (i.e., "select" it).
00179   // IsPanelVisible() checks if the pages of the panel are visible/shown.
00180   // Note that you should use the panel's own API to show a panel: this
00181   // will automatically call this method with the proper panel parameter
00182   // (see vtkKWUserInterfacePanel::Show()).
00183   // Note that if the panel has not been created yet, it will be created 
00184   // automatically by calling the panel's Create() method (see 
00185   // vtkKWUserInterfacePanel::Create()) ; this allows the creation of the 
00186   // panel to be delayed until it is really needed.
00187   // Return 1 on success, 0 on error.
00188   virtual int ShowPanel(vtkKWUserInterfacePanel *panel);
00189   virtual int HidePanel(vtkKWUserInterfacePanel *panel);
00190   virtual int IsPanelVisible(vtkKWUserInterfacePanel *panel);
00191   
00192   // Description:
00193   // Get the panel from a page ID (return the ID of the panel that holds
00194   // that page).
00195   virtual vtkKWUserInterfacePanel* GetPanelFromPageId(int page_id);
00196 
00197   // Description:
00198   // Set/Get the vertical scrollbar visibility of the tree (off by default)
00199   virtual void SetVerticalScrollbarVisibility(int val);
00200   virtual int GetVerticalScrollbarVisibility();
00201   vtkBooleanMacro(VerticalScrollbarVisibility, int);
00202 
00203   // Description:
00204   // Callbacks. Internal, do not use.
00205   virtual void SelectionChangedCallback();
00206 
00207 protected:
00208   vtkKWUserInterfaceManagerDialog();
00209   ~vtkKWUserInterfaceManagerDialog();
00210 
00211   // Description:
00212   // Remove the widgets of all pages belonging to a panel. It is called
00213   // by RemovePanel().
00214   // In this concrete implementation, this will remove all notebook's pages 
00215   // belonging to this panel.
00216   // Return 1 on success, 0 on error.
00217   virtual int RemovePageWidgets(vtkKWUserInterfacePanel *panel);
00218   
00219   vtkKWNotebook           *Notebook;
00220   vtkKWTopLevel           *TopLevel;
00221   vtkKWSplitFrame         *SplitFrame;
00222   vtkKWTreeWithScrollbars *Tree;
00223   vtkKWPushButton         *CloseButton;
00224   vtkKWSeparator          *Separator;
00225 
00226   // PIMPL Encapsulation for STL containers
00227   //BTX
00228   vtkKWUserInterfaceManagerDialogInternals *Internals;
00229   //ETX
00230 
00231   virtual void PopulateTree();
00232   virtual int ShowSelectedNodeSection();
00233   virtual int CreateAllPanels();
00234 
00235   int PanelNodeVisibility;
00236   int PageNodeVisibility;
00237 
00238   // Description:
00239   // This method is (and should be) called each time the number of panels
00240   // changes (for example, after AddPanel() / RemovePanel())
00241   virtual void NumberOfPanelsChanged();
00242 
00243   int GetWidgetLocation(
00244     const char *widget, vtkKWUserInterfacePanel **panel, int *page_id);
00245 
00246 private:
00247 
00248   vtkKWUserInterfaceManagerDialog(const vtkKWUserInterfaceManagerDialog&); // Not implemented
00249   void operator=(const vtkKWUserInterfaceManagerDialog&); // Not Implemented
00250 };
00251 
00252 #endif
00253 

Generated on Sat Dec 11 2010 02:08:01 for KWWidgets by  doxygen 1.7.2