UBActionableWidget.h 1.49 KB
Newer Older
1 2 3
/*
 * 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
Claudio Valerio's avatar
Claudio Valerio committed
4
 * the Free Software Foundation, either version 2 of the License, or
5 6 7 8 9 10 11 12 13 14 15
 * (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/>.
 */

16 17 18 19 20
#ifndef UBACTIONABLEWIDGET_H
#define UBACTIONABLEWIDGET_H

#include <QWidget>
#include <QPaintEvent>
21 22
#include <QToolButton>
#include <QPushButton>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

#define ACTIONSIZE  16

typedef enum{
    eAction_Close,
    eAction_MoveUp,
    eAction_MoveDown
}eAction;

class UBActionableWidget : public QWidget
{
    Q_OBJECT
public:
    UBActionableWidget(QWidget* parent=0, const char* name="UBActionableWidget");
    ~UBActionableWidget();
    void addAction(eAction act);
    void removeAction(eAction act);
    void removeAllActions();
    void setActionsVisible(bool bVisible);

43 44 45
signals:
    void close(QWidget* w);

46
protected:
47 48
    void setActionsParent(QWidget* parent);
    void unsetActionsParent();
49
    QVector<eAction> mActions;
50 51 52 53
    QPushButton mCloseButtons;

private slots:
    void onCloseClicked();
54 55 56

private:
    bool mShowActions;
57

58 59 60
};

#endif // UBACTIONABLEWIDGET_H