ODIN
odinplot_range.h
1 /***************************************************************************
2  odinplot_range.h - description
3  -------------------
4  begin : Wed Oct 12 2005
5  copyright : (C) 2000-2021 by Thies H. Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef ODINPLOT_RANGE_H
19 #define ODINPLOT_RANGE_H
20 
21 #include <qwidget.h>
22 
23 #include <odinqt/floatedit.h>
24 
25 class QScrollBar; // forward declaration
26 
27 
28 class RangeWidget : public QWidget {
29 
30  Q_OBJECT
31 
32  public:
33  RangeWidget(double total_min, double total_max, double start_min, double start_max, QWidget *parent);
34  ~RangeWidget();
35 
36  double get_min() {return min_x->get_value();}
37  double get_max() {return max_x->get_value();}
38 
39 // public slots:
40  void set_range(double min, double max, bool discard_scrollbar=false);
41 
42  signals:
43  void new_range();
44 
45 
46 
47  private slots:
48  void new_scroll_val(int v);
49 
50  void new_minmax_val(float);
51 
52  private:
53  friend class QScrollBar;
54  friend class floatLineEdit;
55 
56  void check_and_set_range(double min, double max);
57  void update_scrollbar();
58 
59  GuiGridLayout* grid;
60  GuiScrollBar* scrollbar;
61  floatLineEdit *min_x, *max_x;
62 
63  double total_min_cache, total_max_cache;
64 
65  bool react_on_scrollbar_change;
66 };
67 
68 
69 
70 #endif