1 /*
2  *  Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
3  *
4  *  This program 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 2 of the License, or
7  *  (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef KIS_PRESET_SELECTOR_STRIP_H
20 #define KIS_PRESET_SELECTOR_STRIP_H
21 
22 #include <QWidget>
23 #include "ui_wdgpresetselectorstrip.h"
24 
25 class KoResourceItemView;
26 
27 /**
28 *
29 * KisPresetSelectorStrip is a composite widget around KisPresetChooser. It provides
30 * a strip of icons with two scroll buttons at the sides and a small delete button
31 * that appears when a user selects a preset icon.
32 *
33 * KisPresetSelectorStrip makes it possible to quickly select and modify presets.
34 *
35 * Note that KisPresetSelectorStrip uses the QObject tree to access properties of the contained
36 * classes, and uses heuristics to approximate pixel offsets, times, and other
37 * properties that cannot be accessed through the QObject tree.
38 *
39 */
40 class KisPresetSelectorStrip : public QWidget, public Ui::WdgPresetSelectorStrip
41 {
42     Q_OBJECT
43 
44 public:
45     KisPresetSelectorStrip(QWidget *parent);
46     ~KisPresetSelectorStrip() override;
47 
48     void setPresetFilter(const QString& paintOpId);
49 
50     int iconSize();
51     void setIconSize(int size);
52 
53 public Q_SLOTS:
54 
55     /// saving the icon base size. This affects all preset selectors
56     /// outside UI elements adjusting icon size
57     void slotSetIconSize(int size);
58 
59     /// saves the icon size to the config file
60     /// when UI element is released, it is ok to save icon size to config
61     void slotSaveIconSize();
62 
63 private Q_SLOTS:
64     /// Scrolls the strip's item view to the left
65     void on_leftScrollBtn_pressed();
66 
67     /// Scrolls the strip's item view to the right
68     void on_rightScrollBtn_pressed();
69 
70     /// Changes the preset list view type
71     void slotThumbnailMode();
72     void slotDetailMode();
73 
74 private:
75     /**
76     * This is a workaround to access members of KisPresetChooser using the QObject tree
77     * instead of class methods
78     */
79     KoResourceItemView* m_resourceItemView;
80     QString m_currentPaintopID;
81 };
82 
83 
84 #endif // KIS_PRESET_SELECTOR_STRIP_H
85