SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PositionProvider.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 #ifndef POSITION_PROVIDER_H
30 #define POSITION_PROVIDER_H
31 
32 #include <boost/shared_ptr.hpp>
33 #include <QPointF>
34 
35 class QGraphicsProxyWidget;
36 
37 namespace SCIRun {
38 namespace Gui {
39 
41 {
42 public:
43  virtual ~PositionProvider() {}
44  virtual QPointF currentPosition() const = 0;
45 };
46 
47 typedef boost::shared_ptr<PositionProvider> PositionProviderPtr;
48 
50 {
51 public:
54  {
55  positionProvider_ = provider;
56  }
58 protected:
60 };
61 
63 {
64 public:
65  explicit ProxyWidgetPosition(QGraphicsProxyWidget* widget, const QPointF& offset = QPointF());
66  virtual QPointF currentPosition() const override;
67 private:
68  QGraphicsProxyWidget* widget_;
69  QPointF offset_;
70 };
71 
73 {
74 public:
76  virtual QPointF currentPosition() const override;
77 private:
78  PositionProviderPtr p1_, p2_;
79 };
80 
82 {
83 public:
84  explicit PassThroughPositioner(const QGraphicsProxyWidget* widget);
85  virtual QPointF currentPosition() const override;
86 private:
87  const QGraphicsProxyWidget* widget_;
88 };
89 
90 }
91 }
92 
93 #endif
virtual ~PositionProvider()
Definition: PositionProvider.h:43
virtual QPointF currentPosition() const =0
Definition: PositionProvider.h:49
PositionProviderPtr getPositionObject() const
Definition: PositionProvider.h:57
Definition: PositionProvider.h:81
virtual QPointF currentPosition() const override
Definition: ModuleWidget.cc:60
Definition: PositionProvider.h:72
ProxyWidgetPosition(QGraphicsProxyWidget *widget, const QPointF &offset=QPointF())
Definition: ModuleWidget.cc:56
boost::shared_ptr< PositionProvider > PositionProviderPtr
Definition: PositionProvider.h:47
PositionProviderPtr positionProvider_
Definition: PositionProvider.h:59
virtual QPointF currentPosition() const override
Definition: ModuleProxyWidget.cc:258
virtual ~NeedsScenePositionProvider()
Definition: PositionProvider.h:52
Definition: PositionProvider.h:62
MidpointPositioner(PositionProviderPtr p1, PositionProviderPtr p2)
Definition: Connection.cc:348
PassThroughPositioner(const QGraphicsProxyWidget *widget)
Definition: ModuleProxyWidget.cc:256
virtual QPointF currentPosition() const override
Definition: Connection.cc:354
Definition: PositionProvider.h:40
void setPositionObject(PositionProviderPtr provider)
Definition: PositionProvider.h:53