This file is indexed.

/usr/include/vtk-5.10/vtkWidgetSet.h is in libvtk5-dev 5.10.1+dfsg-2.1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkWidgetSet.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkWidgetSet - Synchronize a collection on vtkWidgets drawn on different renderwindows using the Callback - Dispatch Action mechanism.
// 
// .SECTION Description
// The class synchronizes a set of vtkAbstractWidget(s). Widgets typically
// invoke "Actions" that drive the geometry/behaviour of their representations
// in response to interactor events. Interactor interactions on a render window
// are mapped into "Callbacks" by the widget, from which "Actions" are 
// dispatched to the entire set. This architecture allows us to tie widgets
// existing in different render windows together. For instance a HandleWidget
// might exist on the sagittal view. Moving it around should update the 
// representations of the corresponding handle widget that lies on the axial 
// and coronal and volume views as well. 
//
// .SECTION User API
// A user would use this class as follows.
// \code
// vtkWidgetSet *set = vtkWidgetSet::New();
// vtkParallelopipedWidget *w1 = vtkParallelopipedWidget::New();
// set->AddWidget(w1);
// w1->SetInteractor(axialRenderWindow->GetInteractor());
// vtkParallelopipedWidget *w2 = vtkParallelopipedWidget::New();
// set->AddWidget(w2);
// w2->SetInteractor(coronalRenderWindow->GetInteractor());
// vtkParallelopipedWidget *w3 = vtkParallelopipedWidget::New();
// set->AddWidget(w3);
// w3->SetInteractor(sagittalRenderWindow->GetInteractor());
// set->SetEnabled(1);
// \endcode
//
// .SECTION Motivation
// The motivation for this class is really to provide a usable API to tie 
// together multiple widgets of the same kind. To enable this, subclasses
// of vtkAbstractWidget, must be written as follows:
//   They will generally have callback methods mapped to some user 
// interaction such as:
// \code
// this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonPressEvent,
//                         vtkEvent::NoModifier, 0, 0, NULL, 
//                         vtkPaintbrushWidget::BeginDrawStrokeEvent,
//                         this, vtkPaintbrushWidget::BeginDrawCallback);
// \endcode
//   The callback invoked when the left button is pressed looks like: 
// \code
// void vtkPaintbrushWidget::BeginDrawCallback(vtkAbstractWidget *w)
// {
//   vtkPaintbrushWidget *self = vtkPaintbrushWidget::SafeDownCast(w);
//   self->WidgetSet->DispatchAction(self, &vtkPaintbrushWidget::BeginDrawAction);
// }
// \endcode
//   The actual code for handling the drawing is written in the BeginDrawAction 
// method.
// \code
// void vtkPaintbrushWidget::BeginDrawAction( vtkPaintbrushWidget *dispatcher)
// {
// // Do stuff to draw... 
// // Here dispatcher is the widget that was interacted with, the one that
// // dispatched an action to all the other widgets in its group. You may, if
// // necessary find it helpful to get parameters from it.
// //   For instance for a ResizeAction:
// //     if (this != dispatcher)
// //       {
// //       double *newsize = dispatcher->GetRepresentation()->GetSize();
// //       this->WidgetRep->SetSize(newsize);
// //       }
// //     else
// //       {
// //       this->WidgetRep->IncrementSizeByDelta();
// //       }
// }
// \endcode
// 
// .SECTION Caveats
// Actions are always dispatched first to the activeWidget, the one calling
// the set, and then to the other widgets in the set.
// 
#ifndef __vtkWidgetSet_h
#define __vtkWidgetSet_h

#include "vtkObject.h"
#include <vector> // Required for vector

class vtkAbstractWidget;

//BTX
// Pointer to a member function that takes a vtkAbstractWidget (the active
// child) and another vtkAbstractWidget (the widget to dispatch an action)
// to. All "Action" functions in a widget must conform to this signature.
template< class TWidget > struct ActionFunction
{
  typedef void (TWidget::*TActionFunctionPointer)(TWidget *dispatcher);
};
//ETX

class VTK_WIDGETS_EXPORT vtkWidgetSet : public vtkObject
{
public:
  // Description:
  // Instantiate this class.
  static vtkWidgetSet *New();

  // Description:
  // Standard methods for a VTK class.
  vtkTypeMacro(vtkWidgetSet,vtkObject);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Method for activating and deactivating all widgets in the group.
  virtual void SetEnabled(int);
  vtkBooleanMacro(Enabled, int);

  // Description:
  // Add a widget to the set.
  void AddWidget(vtkAbstractWidget *);

  // Description:
  // Remove a widget from the set
  void RemoveWidget(vtkAbstractWidget *);

  // Description:
  // Get number of widgets in the set.
  unsigned int GetNumberOfWidgets();

  // Description:
  // Get the Nth widget in the set.
  vtkAbstractWidget *GetNthWidget( unsigned int );

  //BTX
  // TODO: Move this to the protected section. The class vtkAbstractWidget 
  //       should be a friend of this class. 
  typedef std::vector< vtkAbstractWidget * >   WidgetContainerType;
  typedef WidgetContainerType::iterator           WidgetIteratorType;
  typedef WidgetContainerType::const_iterator     WidgetConstIteratorType;
  WidgetContainerType                             Widget;
 
  // Description:
  // Dispatch an "Action" to every widget in this set. This is meant to be 
  // invoked from a "Callback" in a widget.
  template < class TWidget >
  void DispatchAction(TWidget *caller, 
                      typename ActionFunction< TWidget >::TActionFunctionPointer action)
    {
    // Dispatch action to the caller first.
    for (WidgetIteratorType it  = this->Widget.begin(); 
                            it != this->Widget.end()  ; ++it)
      {
      TWidget *w = static_cast<TWidget *>(*it);
      if (caller == w)
        {
        ((*w).*(action))(caller); 
        break;
        }
      }
    
    // Dispatch action to all other widgets
    for (WidgetIteratorType it  = this->Widget.begin(); 
                            it != this->Widget.end()  ; ++it)
      {
      TWidget *w = static_cast<TWidget *>(*it);
      if (caller != w) ((*w).*(action))(caller);
      }
    }
  //ETX

protected:
  vtkWidgetSet();
  ~vtkWidgetSet();

private:
  vtkWidgetSet(const vtkWidgetSet&);  //Not implemented
  void operator=(const vtkWidgetSet&);  //Not implemented
};

#endif