~ubuntu-branches/ubuntu/precise/openwalnut/precise

« back to all changes in this revision

Viewing changes to src/qt4gui/qt4/WQtNavGLWidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Eichelbaum
  • Date: 2011-06-21 10:26:54 UTC
  • Revision ID: james.westby@ubuntu.com-20110621102654-rq0zf436q949biih
Tags: upstream-1.2.5
ImportĀ upstreamĀ versionĀ 1.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//---------------------------------------------------------------------------
 
2
//
 
3
// Project: OpenWalnut ( http://www.openwalnut.org )
 
4
//
 
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
 
6
// For more information see http://www.openwalnut.org/copying
 
7
//
 
8
// This file is part of OpenWalnut.
 
9
//
 
10
// OpenWalnut is free software: you can redistribute it and/or modify
 
11
// it under the terms of the GNU Lesser General Public License as published by
 
12
// the Free Software Foundation, either version 3 of the License, or
 
13
// (at your option) any later version.
 
14
//
 
15
// OpenWalnut is distributed in the hope that it will be useful,
 
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
// GNU Lesser General Public License for more details.
 
19
//
 
20
// You should have received a copy of the GNU Lesser General Public License
 
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
 
22
//
 
23
//---------------------------------------------------------------------------
 
24
 
 
25
#ifndef WQTNAVGLWIDGET_H
 
26
#define WQTNAVGLWIDGET_H
 
27
 
 
28
#include <map>
 
29
#include <string>
 
30
 
 
31
#include <QtGui/QDockWidget>
 
32
#include <QtGui/QSlider>
 
33
 
 
34
#include "core/common/WPropertyVariable.h"
 
35
#include "core/graphicsEngine/WGEGroupNode.h"
 
36
#include "controlPanel/WPropertyDoubleWidget.h"
 
37
 
 
38
#include "WQtGLDockWidget.h"
 
39
 
 
40
/**
 
41
 * container widget to hold as GL widget and a slider
 
42
 */
 
43
class WQtNavGLWidget : public WQtGLDockWidget
 
44
{
 
45
    Q_OBJECT
 
46
 
 
47
public:
 
48
    /**
 
49
     * default constructor
 
50
     *
 
51
     * \param viewTitle Title will be used as view title
 
52
     * \param dockTitle The title of the dock widget.
 
53
     * \param parent The widget that manages this widget
 
54
     * \param sliderTitle Name of the slider corresponding to the property it manipulates
 
55
     * \param shareWidget this widget will share OpenGL display lists and texture objects with shareWidget
 
56
     */
 
57
    WQtNavGLWidget( QString viewTitle, QString dockTitle, QWidget* parent, std::string sliderTitle="pos", const QWidget * shareWidget = 0 );
 
58
 
 
59
    /**
 
60
     * destructor.
 
61
     */
 
62
    virtual ~WQtNavGLWidget();
 
63
 
 
64
    /**
 
65
     * Set the title of the slider used in this nav widget
 
66
     *
 
67
     * \param title the title
 
68
     */
 
69
    void setSliderTitle( std::string title );
 
70
 
 
71
    /**
 
72
     * Sets the property to control by the slider.
 
73
     *
 
74
     * \param prop the property
 
75
     */
 
76
    void setSliderProperty( boost::shared_ptr< WPropertyBase > prop );
 
77
 
 
78
    /**
 
79
     * Remove the property to control by the slider.
 
80
     *
 
81
     * \param prop the property
 
82
     */
 
83
    void removeSliderProperty( boost::shared_ptr< WPropertyBase > prop );
 
84
 
 
85
protected:
 
86
 
 
87
private:
 
88
 
 
89
    /**
 
90
     * The slider's title.
 
91
     */
 
92
    QString m_sliderTitle;
 
93
 
 
94
    /**
 
95
     * the scene which is displayed by the GL widget
 
96
     */
 
97
    osg::ref_ptr< WGEGroupNode > m_scene;
 
98
 
 
99
    /**
 
100
     * Update slider if property changed.
 
101
     */
 
102
    void handleChangedPropertyValue();
 
103
 
 
104
    /**
 
105
     * Map holding the widgets for module properties added automatically. So they can be removed again automatically
 
106
     * if the module is removed.
 
107
     */
 
108
    std::map< boost::shared_ptr< WPropertyBase >, WPropertyDoubleWidget* > propertyWidgetMap;
 
109
};
 
110
 
 
111
#endif  // WQTNAVGLWIDGET_H