1 /* This file is part of Clementine.
2    Copyright 2010, David Sansome <me@davidsansome.com>
3 
4    Clementine 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    Clementine 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 Clementine.  If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef WINDOWS7THUMBBAR_H
19 #define WINDOWS7THUMBBAR_H
20 
21 #include <QMainWindow>
22 #include <QWidget>
23 
24 #ifndef Q_OS_WIN32
25 typedef void MSG;
26 #endif  // Q_OS_WIN32
27 
28 class Windows7ThumbBar : public QObject {
29   Q_OBJECT
30 
31  public:
32   // Creates a list of buttons in the taskbar icon for this window.  Does
33   // nothing and is safe to use on other operating systems too.
34   Windows7ThumbBar(QWidget* widget = 0);
35 
36   static const int kIconSize;
37   static const int kMaxButtonCount;
38 
39   // You must call this in the parent widget's constructor before returning
40   // to the event loop.  If an action is nullptr it becomes a spacer.
41   void SetActions(const QList<QAction*>& actions);
42 
43   // Call this from the parent's winEvent() function.
44   void HandleWinEvent(MSG* msg);
45 
46  private slots:
47   void ActionChanged();
48 
49  private:
50   QWidget* widget_;
51   QList<QAction*> actions_;
52 
53   unsigned int button_created_message_id_;
54 
55   // Really an ITaskbarList3* but I don't want to have to include windows.h here
56   void* taskbar_list_;
57 };
58 
59 #endif  // WINDOWS7THUMBBAR_H
60