summaryrefslogtreecommitdiffstats
path: root/pokemodr/FractionWidget.h
blob: 38990c72956e97f73bdc47af9e9c1ab9db876f66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Copyright 2008 Ben Boeckel <MathStuf@gmail.com>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __FRACTIONWIDGET__
#define __FRACTIONWIDGET__

// Pokemod includes
#include "../pokemod/Fraction.h"

// Qt includes
#include <QWidget>

// Form include
#include "ui_fraction.h"

class FractionWidget : public QWidget, private Ui::formFraction
{
    Q_OBJECT
    
    public:
        FractionWidget(QWidget* parent, const Fraction& value = Fraction(1, 1));
        
        int behavior() const;
        Fraction value() const;
    signals:
        void valueChanged(const Fraction&);
    public slots:
        void setBehavior(const int behavior);
        void setValue(const Fraction& value);
        
        void updateValue();
    protected slots:
        void on_varNumerator_valueChanged(const int numerator);
        void on_varDenominator_valueChanged(const int denominator);
    private:
        int m_behavior;
        Fraction m_value;
};

#endif