SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ViewScene.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 INTERFACE_MODULES_VIEW_SCENE_H
30 #define INTERFACE_MODULES_VIEW_SCENE_H
31 
32 /// \todo Make this definition specific to windows.
33 #define NOMINMAX
34 
35 #include "Interface/Modules/Render/ui_ViewScene.h"
36 
37 #include <boost/shared_ptr.hpp>
38 
41 
42 #include <spire/Interface.h>
44 
48 
50 
52 
53 //TODO: needs to inherit from ModuleWidget somehow
54 class QToolBar;
55 class QStandardItemModel;
56 class QStandardItem;
57 
58 namespace SCIRun {
59 namespace Gui {
60 
62  public Ui::ViewScene
63 {
64  Q_OBJECT
65 
66 public:
67  ViewSceneDialog(const std::string& name,
69  QWidget* parent = 0);
70  ~ViewSceneDialog();
71  virtual void pull() {}
72 
73 Q_SIGNALS:
74  void newGeometryValueForwarder();
75 
76 protected Q_SLOTS:
77  void menuMouseControlChanged(int index);
78  void autoViewClicked();
79  void newGeometryValue();
80 
81 protected:
82  virtual void closeEvent(QCloseEvent *evt) override;
83  virtual void showEvent(QShowEvent* event) override;
84 private:
85  void addToolBar();
86  void addMouseMenu();
87  void addAutoViewButton();
88  void addObjectToggleMenu();
89 
90  GLWidget* mGLWidget; ///< GL widget containing context.
91  std::weak_ptr<SRInterface> mSpire; ///< Instance of Spire.
92  QToolBar* mToolBar; ///< Tool bar.
93  bool shown_;
94  std::shared_ptr<class ViewSceneItemManager> itemManager_;
95 };
96 
97 class ViewSceneItemManager : public QObject
98 {
99  Q_OBJECT
100 public:
102  QStandardItemModel* model() { return model_; }
103 public Q_SLOTS:
104  void addItem(const QString& name);
105  void removeItem(const QString& name);
106  void removeAll();
107 Q_SIGNALS:
108  void itemSelected(const QString& name);
109  void itemUnselected(const QString& name);
110 private Q_SLOTS:
111  void slotChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
112 private:
113  QStandardItemModel* model_;
114  std::vector<QStandardItem*> items_;
115 };
116 
117 }
118 }
119 
120 #endif
void itemUnselected(const QString &name)
QStandardItemModel * model()
Definition: ViewScene.h:102
boost::shared_ptr< ModuleStateInterface > ModuleStateHandle
Definition: NetworkFwd.h:75
#define SCISHARE
Definition: share.h:39
void addItem(const QString &name)
Definition: ViewScene.cc:254
void itemSelected(const QString &name)
void removeAll()
Definition: ViewScene.cc:275
const char * name[]
Definition: BoostGraphExampleTests.cc:87
Definition: ModuleDialogGeneric.h:45
Definition: GLWidget.h:56
Definition: ViewScene.h:61
Definition: ViewScene.h:97
ViewSceneItemManager()
Definition: ViewScene.cc:234
void removeItem(const QString &name)
Definition: ViewScene.cc:265
virtual void pull()
Definition: ViewScene.h:71