47a7778f4accb6d272435a7d6a79232c84ba66ab
[mussa.git] / qui / ThresholdWidget.hpp
1 #ifndef _THRESHOLD_WIDGET_H_ 
2 #define _THRESHOLD_WIDGET_H_
3
4 #include <QHBoxLayout>
5 #include <QLabel>
6 #include <QSpinBox>
7 #include <QWidget>
8
9 class ThresholdWidget : public QWidget
10 {
11   Q_OBJECT 
12
13 public: 
14   ThresholdWidget(QWidget *parent = 0, int min=20, int max=30);
15   
16   //! is the widget in read only mode
17   bool isReadOnly() const;
18   //! set the widget to specified read only state
19   void setReadOnly(bool);
20
21   //! return min_threshold/max_threshold
22   double min_ratio() const;
23   //! return current_threshold/maximum_threshold
24   double ratio() const;
25   //! return our current threshold
26   int threshold() const;
27   //! update percent threshold
28   void updatePercentThreshold();
29
30 public slots:
31   void setBasepairThreshold(int threshold);
32   //void setPercentThreshold(int percent_threshold);
33   //! set the min and max base pair range
34   void setRange(int min, int max);
35
36 signals:
37   //! the current number of base pairs needed for a window of conservation
38   void thresholdChanged(int new_threshold);
39
40 protected:
41   void setupWidgets();
42   QHBoxLayout *layout;
43   QSpinBox *basepair_spinner;
44   QLabel *window_size_label;
45   QLabel *percent_label;
46
47   int cur_bp_threshold;
48   int cur_percent_threshold;
49 };
50 const int threshold_max_display_digits = 2;
51
52 #endif