1 /*
2  * Copyright (C) 2014-2018 Christopho, Solarus - http://www.solarus-games.org
3  *
4  * Solarus Quest Editor is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Solarus Quest Editor 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 along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef SOLARUSEDITOR_PATTERN_CHOOSER_H
18 #define SOLARUSEDITOR_PATTERN_CHOOSER_H
19 
20 #include <QPushButton>
21 
22 namespace SolarusEditor {
23 
24 class TilesetModel;
25 
26 /**
27  * @brief Widget to choose a pattern in a tileset.
28  */
29 class PatternChooser : public QPushButton {
30   Q_OBJECT
31 
32 public:
33 
34   explicit PatternChooser(QWidget* parent = nullptr);
35 
36   void set_tileset(TilesetModel* tileset);
37 
38   QString get_pattern_id() const;
39   void set_pattern_id(const QString& pattern_id);
40 
41 public slots:
42 
43   void pick_pattern_requested();
44 
45 signals:
46 
47   void pattern_id_changed(const QString& pattern_id);
48 
49 private:
50 
51   void update_icon();
52   void update_style_sheet();
53 
54   TilesetModel* tileset;    /**< Tileset where to pick patterns from. */
55 
56 };
57 
58 }
59 
60 #endif
61