File indexing completed on 2024-05-12 08:00:33

0001 /*
0002  * Copyright (C) 2008-2009 Stephan Kulow <coolo@kde.org>
0003  * Copyright (C) 2008-2009 Parker Coates <coates@kde.org>
0004  *
0005  * This program is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU General Public License as
0007  * published by the Free Software Foundation; either version 2 of
0008  * the License, or (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #ifndef GAMESELECTIONSCENE_H
0020 #define GAMESELECTIONSCENE_H
0021 
0022 // Qt
0023 #include <QGraphicsScene>
0024 
0025 class GameSelectionScene : public QGraphicsScene
0026 {
0027     Q_OBJECT
0028 
0029     class GameSelectionBox;
0030 
0031 public:
0032     explicit GameSelectionScene(QObject *parent);
0033     ~GameSelectionScene();
0034 
0035     void resizeScene(const QSize &size);
0036 
0037 Q_SIGNALS:
0038     void gameSelected(int i);
0039 
0040 protected:
0041     void keyReleaseEvent(QKeyEvent *event) override;
0042     void keyPressEvent(QKeyEvent *event) override;
0043 
0044 private Q_SLOTS:
0045     void boxHoverChanged(GameSelectionBox *box, bool hovered);
0046 
0047 private:
0048     int m_columns;
0049     int m_selectionIndex;
0050     QList<GameSelectionBox *> m_boxes;
0051 };
0052 
0053 #endif