1
/****************************************************************************************
2
 * Copyright (c) 2008 Nikolaj Hald Nielsen <nhn@kde.org>                                *
3
 *                                                                                      *
4
 * This program is free software; you can redistribute it and/or modify it under        *
5
 * the terms of the GNU General Public License as published by the Free Software        *
6
 * Foundation; either version 2 of the License, or (at your option) any later           *
7
 * version.                                                                             *
8
 *                                                                                      *
9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
10
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
11
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
12
 *                                                                                      *
13
 * You should have received a copy of the GNU General Public License along with         *
14
 * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
15
 ****************************************************************************************/
16
 
17
#ifndef POPUPDROPPERFACTORY_H
18
#define POPUPDROPPERFACTORY_H
19
20
#include "amarok_export.h"
21
#include "context/popupdropper/libpud/PopupDropper.h"
22
23
/**
24
A central place for creating a Pud that matches system colors
25
26
	@author Nikolaj Hald Nielsen <nhn@kde.org>
27
*/
28
class PopupDropperFactory;
29
30
namespace The {
31
    AMAROK_EXPORT PopupDropperFactory* popupDropperFactory();
32
}
33
34
class AMAROK_EXPORT PopupDropperFactory : public QObject
35
{
36
    Q_OBJECT
37
38
    friend PopupDropperFactory* The::popupDropperFactory();
39
40
    public:
41
        /**
42
         * Create a new PopupDropper with correct system colors. This function creates it on top of the context viev
43
         * @return The newly created PopupDropper
44
         */
45
        PopupDropper * createPopupDropper();
46
        
47
        /**
48
         * Overloaded function for creating a new PopupDropper with a custom parent
49
         * @param parent The widget to act as the parent
50
         * @param ignoreEmptyParent Whether to ignore if the parent is null - use this when creating submenus where the parent is 0
51
         * @return The newly created PopupDropper
52
         */
53
        PopupDropper * createPopupDropper( QWidget * parent, bool ignoreEmptyParent = false );
54
55
        PopupDropperItem* createItem( QAction * action );
56
        void adjustItems( PopupDropper *pud );
57
        void adjustItem( PopupDropperItem *item );
58
        static void adjustItemCallback( void *pdi );
59
60
    private:
61
        PopupDropperFactory( QObject* parent );
62
        ~PopupDropperFactory();
63
 };
64
65
66
#endif