HexOffsets/uientry.hpp

75 lines
1.8 KiB
C++

/*
Copyright (C) 2017 Grégory Soutadé
This file is part of Hex offsets.
Hex offsets 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.
Hex offsets 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 Hex offsets. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UIENTRY_HPP
#define UIENTRY_HPP
#include <QWidget>
#include <QPushButton>
#include <QCheckBox>
#include <QLineEdit>
#include <QHBoxLayout>
namespace Ui {
class UIEntry;
}
class MainWindow;
class UIEntry : public QWidget
{
Q_OBJECT
private slots:
void on_line_textChanged(const QString &arg1);
void on_buttonPlus_toggled(bool checked);
void on_buttonMinus_toggled(bool checked);
void on_buttonClear_clicked();
void on_checkEnable_toggled(bool checked);
public:
UIEntry(QWidget *parent = 0, MainWindow* ui = 0);
~UIEntry();
enum operation {OPERATION_PLUS, OPERATION_MINUS};
static const int MIN_ENTRIES_NUMBER = 4;
QHBoxLayout* getLayout(void) {return layout;}
QLineEdit* getLine(void) {return line;}
void clear(void) {line->clear();}
UIEntry::operation getOperation(void);
bool enabled(void) {return checkEnable->isChecked();}
private:
QWidget *parent;
MainWindow *ui;
QHBoxLayout* layout;
QPushButton* buttonClear;
QPushButton* buttonPlus;
QPushButton* buttonMinus;
QCheckBox* checkEnable;
QLineEdit* line;
};
#endif