QTfrontend/ui/widget/hatbutton.h
changeset 8374 3a1708759c4f
child 8434 4821897a0f10
equal deleted inserted replaced
8372:3c193ec03e09 8374:3a1708759c4f
       
     1 /*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17  */
       
    18 
       
    19 #ifndef HATBUTTON_H
       
    20 #define HATBUTTON_H
       
    21 
       
    22 #include <QPushButton>
       
    23 #include <QString>
       
    24 #include <QModelIndex>
       
    25 
       
    26 class HatModel;
       
    27 
       
    28 class HatButton : public QPushButton
       
    29 {
       
    30         Q_OBJECT
       
    31         Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
       
    32         Q_PROPERTY(QString currentHat READ currentHat WRITE setCurrentHat)
       
    33 
       
    34     public:
       
    35         HatButton(QWidget* parent);
       
    36         int currentIndex();
       
    37         QString currentHat() const;
       
    38 
       
    39     private:
       
    40     	QModelIndex m_hat;
       
    41     	HatModel * m_hatModel;
       
    42 
       
    43     signals:
       
    44     	void currentIndexChanged(int);
       
    45     	void currentHatChanged(const QString &);
       
    46 
       
    47     public slots:
       
    48     	void setCurrentIndex(int index);
       
    49     	void setCurrentHat(const QString & name);
       
    50 
       
    51     private slots:
       
    52         void showPrompt();
       
    53 };
       
    54 
       
    55 #endif // HATBUTTON_H