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

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    vtkKWWidgetSet.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 vtkKWWidgetSet - an abstract set of a specific type of vtkKWWidget
00015 // .SECTION Description
00016 // This class is a composite widget that can be used to conveniently 
00017 // allocate, store and layout a set of widgets of the same type. 
00018 // Each widget is created, removed or queried based on a unique ID provided
00019 // by the user (ids are *not* handled by the class since it is likely that 
00020 // they will be defined as enum's or #define by the user for easier retrieval).
00021 // Widgets are packed (gridded) in the order they were added to the set.
00022 //
00023 // IMPORTANT: this is an abstract superclass, it can not be used as-is.
00024 // A subclass of vtkKWWidgetSet is tailored for a *specific* type of widget
00025 // (see vtkKWPushButtonSet, which is a set of vtkKWPushButton); it can not be
00026 // used to store or layout a set of heterogeneous widgets. 
00027 //
00028 // This class acts as a container of widgets of the same type; the main point
00029 // of this container is not to provide a layout mechanism, but to make it a
00030 // little more convenient to create and allocate a whole bunch of widgets
00031 // of the same type without explicitly declaring a pointer to each and 
00032 // everyone of them. Say, if you need ten buttons, and you do not want to
00033 // make 10 calls to vtkKWPushButton::New(), 10 calls to 
00034 // vtkKWPushButton::Create(), and 10 calls to vtkKWPushButton::Delete(): just
00035 // create one instance of a vtkKWPushButtonSet, then call
00036 // vtkKWPushButtonSet::AddWidget to automatically allocate and create an
00037 // instance of a vtkKWPushButton. This widget will be packed in a grid 
00038 // fashion with the other widgets in the set, as a bonus. Widgets that are
00039 // added, allocated and created that way are automatically de-allocated when
00040 // the vtkKWWidgetSet instance is deleted. 
00041 //
00042 // Be aware that the pretty much all subclasses of vtkKWWidgetSet are 
00043 // generated automatically out of the vtkKWWidgetSetSubclass template located
00044 // in the Templates directory. Therefore, even though the source code for
00045 // those vtkKWWidgetSet subclasses does not exist in the KWWidgets repository,
00046 // they are still generated automatically and documented in the API online;
00047 // check the vtkKWWidgetSet API online for its subclasses, as well as the
00048 // \subpage kwwidgets_autogenerated_page page. 
00049 // Classes related to the same template can be found in the 
00050 // \ref kwwidgets_autogenerated_widget_set_group section.
00051 // Subclasses need to implement AllocateAndCreateWidget
00052 // .SECTION See Also
00053 // vtkKWCheckButtonSet vtkKWComboBoxSet vtkKWEntrySet vtkKWLabelSet vtkKWLabelWithLabelSet vtkKWPushButtonSet vtkKWScaleSet vtkKWScaleWithEntrySet vtkKWSpinBoxSet
00054 
00055 #ifndef __vtkKWWidgetSet_h
00056 #define __vtkKWWidgetSet_h
00057 
00058 #include "vtkKWCompositeWidget.h"
00059 
00060 class vtkKWWidget;
00061 class vtkKWWidgetSetInternals;
00062 
00063 class KWWidgets_EXPORT vtkKWWidgetSet : public vtkKWCompositeWidget
00064 {
00065 public:
00066   vtkTypeRevisionMacro(vtkKWWidgetSet,vtkKWCompositeWidget);
00067   void PrintSelf(ostream& os, vtkIndent indent);
00068 
00069   // Description:
00070   // Get the number of widget in the set.
00071   virtual int GetNumberOfWidgets();
00072 
00073   // Description:
00074   // Retrieve the id of the n-th widget (-1 if not found)
00075   virtual int GetIdOfNthWidget(int rank);
00076 
00077   // Description:
00078   // Check if a widget is in the set, given its unique id.
00079   // Return 1 if exists, 0 otherwise.
00080   virtual int HasWidget(int id);
00081 
00082   // Description:
00083   // Retrieve the position in the set the widget was inserted at.
00084   // Return pos if exists, -1 otherwise
00085   virtual int GetWidgetPosition(int id);
00086 
00087   // Description:
00088   // Hide/show a widget, given its unique id.
00089   // Get the number of visible widget in the set.
00090   // Since the changing the widget visibility will trigger an expensive call
00091   // to Pack(), one can use SetWidgetsVisibility to change the visibility of
00092   // many widgets in a single call.
00093   virtual void HideWidget(int id);
00094   virtual void ShowWidget(int id);
00095   virtual int GetWidgetVisibility(int id);
00096   virtual void SetWidgetVisibility(int id, int flag);
00097   virtual int GetNumberOfVisibleWidgets();
00098   virtual int GetIdOfNthVisibleWidget(int rank);
00099   virtual void SetWidgetsVisibility(int nb_ids, int *ids, int *flags);
00100 
00101   // Description:
00102   // Delete all widgets.
00103   virtual void DeleteAllWidgets();
00104 
00105   // Description:
00106   // Set the packing direction to be horizontal (default is vertical).
00107   virtual void SetPackHorizontally(int);
00108   vtkBooleanMacro(PackHorizontally, int);
00109   vtkGetMacro(PackHorizontally, int);
00110 
00111   // Description:
00112   // Set the maximum number of widgets that will be packed in the packing
00113   // direction (i.e. horizontally or vertically).
00114   // For example, if set to 3 and the packing direction is horizontal, 
00115   // the layout ends up as 3 columns of widgets.
00116   // The default is 0, i.e. all widgets are packed along the same direction. 
00117   virtual void SetMaximumNumberOfWidgetsInPackingDirection(int);
00118   vtkGetMacro(MaximumNumberOfWidgetsInPackingDirection, int);
00119 
00120   // Description:
00121   // Set/Get the padding that will be applied around each widget.
00122   // (default to 0).
00123   virtual void SetWidgetsPadX(int);
00124   vtkGetMacro(WidgetsPadX, int);
00125   virtual void SetWidgetsPadY(int);
00126   vtkGetMacro(WidgetsPadY, int);
00127 
00128   // Description:
00129   // Set/Get the internal padding that will be left around each widget.
00130   // This space is added inside the widget border.
00131   // (default to 0).
00132   virtual void SetWidgetsInternalPadX(int);
00133   vtkGetMacro(WidgetsInternalPadX, int);
00134   virtual void SetWidgetsInternalPadY(int);
00135   vtkGetMacro(WidgetsInternalPadY, int);
00136 
00137   // Description:
00138   // Set the layout to allow the widgets to expand automatically
00139   // within the set.
00140   virtual void SetExpandWidgets(int);
00141   vtkBooleanMacro(ExpandWidgets, int);
00142   vtkGetMacro(ExpandWidgets, int);
00143 
00144   // Description:
00145   // Set/Get if the column/row layout should be uniform (enforce same size).
00146   virtual void SetUniformColumns(int);
00147   vtkBooleanMacro(UniformColumns, int);
00148   vtkGetMacro(UniformColumns, int);
00149   virtual void SetUniformRows(int);
00150   vtkBooleanMacro(UniformRows, int);
00151   vtkGetMacro(UniformRows, int);
00152 
00153   // Description:
00154   // Update the "enable" state of the object and its internal parts.
00155   // Depending on different Ivars (this->Enabled, the application's 
00156   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00157   // and propagated to its internal parts/subwidgets. This will, for example,
00158   // enable/disable parts of the widget UI, enable/disable the visibility
00159   // of 3D widgets, etc.
00160   virtual void UpdateEnableState();
00161 
00162 protected:
00163   vtkKWWidgetSet();
00164   ~vtkKWWidgetSet();
00165 
00166   // Description:
00167   // Create the widget.
00168   virtual void CreateWidget();
00169 
00170   int PackHorizontally;
00171   int MaximumNumberOfWidgetsInPackingDirection;
00172   int WidgetsPadX;
00173   int WidgetsPadY;
00174   int WidgetsInternalPadX;
00175   int WidgetsInternalPadY;
00176   int ExpandWidgets;
00177   int UniformColumns;
00178   int UniformRows;
00179 
00180   // Description:
00181   // To be implemented by superclasses.
00182   // Allocate and create a widget of the right type.
00183   // Return a pointer to the superclass though.
00184   virtual vtkKWWidget* AllocateAndCreateWidget() = 0;
00185 
00186   // BTX
00187   // PIMPL Encapsulation for STL containers
00188 
00189   vtkKWWidgetSetInternals *Internals;
00190   //ETX
00191 
00192   // Helper methods
00193 
00194   virtual vtkKWWidget* GetWidgetInternal(int id);
00195   virtual vtkKWWidget* InsertWidgetInternal(int id, int pos);
00196 
00197   // Description:
00198   // Pack the widgets
00199   virtual void Pack();
00200 
00201 private:
00202   vtkKWWidgetSet(const vtkKWWidgetSet&); // Not implemented
00203   void operator=(const vtkKWWidgetSet&); // Not implemented
00204 };
00205 
00206 #endif

Generated by  doxygen 1.6.2