1 /* 2 * Strawberry Music Player 3 * This file was part of Clementine. 4 * Copyright 2010, David Sansome <me@davidsansome.com> 5 * Copyright 2020-2021, Jonas Kvinge <jonas@jkvinge.net> 6 * 7 * Strawberry is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * Strawberry is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with Strawberry. If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 22 #ifndef WINDOWS7THUMBBAR_H 23 #define WINDOWS7THUMBBAR_H 24 25 #include <windows.h> 26 #include <shobjidl.h> 27 28 #include <QObject> 29 #include <QWidget> 30 #include <QList> 31 32 class QTimer; 33 class QAction; 34 35 class Windows7ThumbBar : public QObject { 36 Q_OBJECT 37 38 public: 39 // Creates a list of buttons in the taskbar icon for this window. 40 explicit Windows7ThumbBar(QWidget *widget = nullptr); 41 42 static const int kIconSize; 43 static const int kMaxButtonCount; 44 45 // You must call this in the parent widget's constructor before returning to the event loop. If an action is nullptr it becomes a spacer. 46 void SetActions(const QList<QAction*> &actions); 47 48 // Call this from the parent's winEvent() function. 49 void HandleWinEvent(MSG *msg); 50 51 private: 52 ITaskbarList3 *CreateTaskbarList(); 53 void SetupButton(const QAction *action, THUMBBUTTON *button); 54 55 private slots: 56 void ActionChangedTriggered(); 57 void ActionChanged(); 58 59 private: 60 QWidget *widget_; 61 QTimer *timer_; 62 QList<QAction*> actions_; 63 64 unsigned int button_created_message_id_; 65 }; 66 67 #endif // WINDOWS7THUMBBAR_H 68