1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
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.
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.
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
23
// --------------------------------------------------------------------------
24
// $Maintainer: Timo Sachsenberg$
25
// $Authors: Marc Sturm $
26
// --------------------------------------------------------------------------
28
#ifndef OPENMS_VISUAL_MULTIGRADIENTSELECTOR_H
29
#define OPENMS_VISUAL_MULTIGRADIENTSELECTOR_H
32
#include <OpenMS/CONCEPT/Types.h>
33
#include <OpenMS/VISUAL/MultiGradient.h>
36
#include <QtGui/QWidget>
40
class QContextMenuEvent;
49
@brief A widget witch allows constructing gradients of multiple colors.
51
@image html MultiGradientSelector.png
53
The above example image shows a MultiGradientSelector.
57
class OPENMS_GUI_DLLAPI MultiGradientSelector
63
MultiGradientSelector( QWidget* parent = 0);
65
~MultiGradientSelector();
67
///returns a const reference to the gradient
68
const MultiGradient& gradient() const;
69
///returns a mutable reference to the gradient
70
MultiGradient& gradient();
72
/// sets the interploation mode
73
void setInterpolationMode(MultiGradient::InterpolationMode mode);
74
/// returns the interpolaion mode
75
MultiGradient::InterpolationMode getInterpolationMode() const;
78
/// sets what interpolation mode is used
79
void stairsInterpolation(bool state);
82
///@name Reimpelented Qt events
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);
93
// the actual gradient
94
MultiGradient gradient_;
98
// height of the gradient area
99
Int gradient_area_width_;
100
// heigth of the lever area
101
Int lever_area_height_;
103
//position (0-100) in the vector of the selected lever
105
//color of the selected lever
106
QColor selected_color_;
108
//stores if the left button is pressed
109
bool left_button_pressed_;
113
#endif // OPENMS_VISUAL_MULTIGRADIENTSELECTOR_H