~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to include/OpenMS/VISUAL/MultiGradientSelector.h

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-vr15wtg9b50cuesg
Tags: upstream-1.9.0
ImportĀ upstreamĀ versionĀ 1.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: C++; tab-width: 2; -*-
 
2
// vi: set ts=2:
 
3
//
 
4
// --------------------------------------------------------------------------
 
5
//                   OpenMS Mass Spectrometry Framework
 
6
// --------------------------------------------------------------------------
 
7
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
 
8
//
 
9
//  This library is free software; you can redistribute it and/or
 
10
//  modify it under the terms of the GNU Lesser General Public
 
11
//  License as published by the Free Software Foundation; either
 
12
//  version 2.1 of the License, or (at your option) any later version.
 
13
//
 
14
//  This library is distributed in the hope that it will be useful,
 
15
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
//  Lesser General Public License for more details.
 
18
//
 
19
//  You should have received a copy of the GNU Lesser General Public
 
20
//  License along with this library; if not, write to the Free Software
 
21
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
//
 
23
// --------------------------------------------------------------------------
 
24
// $Maintainer: Timo Sachsenberg$
 
25
// $Authors: Marc Sturm $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#ifndef OPENMS_VISUAL_MULTIGRADIENTSELECTOR_H
 
29
#define OPENMS_VISUAL_MULTIGRADIENTSELECTOR_H
 
30
 
 
31
//OpenMS
 
32
#include <OpenMS/CONCEPT/Types.h>
 
33
#include <OpenMS/VISUAL/MultiGradient.h>
 
34
 
 
35
//QT
 
36
#include <QtGui/QWidget>
 
37
class QPaintEvent;
 
38
class QMouseEvent;
 
39
class QKeyEvent;
 
40
class QContextMenuEvent;
 
41
 
 
42
//std lib
 
43
#include <vector>
 
44
 
 
45
namespace OpenMS 
 
46
{
 
47
 
 
48
        /**
 
49
                @brief A widget witch allows constructing gradients of multiple colors.
 
50
                
 
51
                @image html MultiGradientSelector.png
 
52
                
 
53
                The above example image shows a MultiGradientSelector.
 
54
                
 
55
                @ingroup Visual
 
56
        */
 
57
        class OPENMS_GUI_DLLAPI MultiGradientSelector
 
58
                : public QWidget
 
59
        {
 
60
                Q_OBJECT
 
61
                public:
 
62
                        ///Constructor
 
63
                        MultiGradientSelector( QWidget* parent = 0);
 
64
                        ///Desctructor
 
65
                        ~MultiGradientSelector();
 
66
                        
 
67
                        ///returns a const reference to the gradient
 
68
                        const MultiGradient& gradient() const;
 
69
                        ///returns a mutable reference to the gradient
 
70
                        MultiGradient& gradient();
 
71
                
 
72
                        /// sets the interploation mode
 
73
                        void setInterpolationMode(MultiGradient::InterpolationMode mode);
 
74
                        /// returns the interpolaion mode
 
75
                        MultiGradient::InterpolationMode getInterpolationMode() const;
 
76
                
 
77
                        public slots:
 
78
                        /// sets what interpolation mode is used
 
79
                        void stairsInterpolation(bool state);
 
80
        
 
81
                protected:
 
82
                        ///@name Reimpelented Qt events
 
83
                        //@{
 
84
                        void paintEvent(QPaintEvent* e);
 
85
                        void mousePressEvent(QMouseEvent* e);
 
86
                        void mouseMoveEvent(QMouseEvent* e);            
 
87
                        void mouseReleaseEvent(QMouseEvent* e);
 
88
                        void mouseDoubleClickEvent (QMouseEvent* e);
 
89
                        void keyPressEvent(QKeyEvent* e);
 
90
                        void contextMenuEvent(QContextMenuEvent* e);
 
91
                        //@}
 
92
                        
 
93
                        // the actual gradient
 
94
                        MultiGradient gradient_;
 
95
                        
 
96
                        // border margin
 
97
                        Int margin_;
 
98
                        // height of the gradient area
 
99
                        Int gradient_area_width_;
 
100
                        // heigth of the lever area
 
101
                        Int lever_area_height_;
 
102
                        
 
103
                        //position (0-100) in the vector of the selected lever
 
104
                        Int selected_;
 
105
                        //color of the selected lever
 
106
                        QColor selected_color_;  
 
107
                        
 
108
                        //stores if the left button is pressed
 
109
                        bool left_button_pressed_;
 
110
        };
 
111
 
 
112
}
 
113
#endif // OPENMS_VISUAL_MULTIGRADIENTSELECTOR_H
 
114