File indexing completed on 2024-04-21 04:47:53

0001 /****************************************************************************************
0002  * Copyright (c) 2008 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016  
0017 #ifndef POPUPDROPPERFACTORY_H
0018 #define POPUPDROPPERFACTORY_H
0019 
0020 #include "amarok_export.h"
0021 #include "context/popupdropper/libpud/PopupDropper.h"
0022 
0023 /**
0024 A central place for creating a Pud that matches system colors
0025 
0026     @author Nikolaj Hald Nielsen <nhn@kde.org>
0027 */
0028 class PopupDropperFactory;
0029 class PopupDropperItem;
0030 
0031 namespace The {
0032     AMAROK_EXPORT PopupDropperFactory* popupDropperFactory();
0033 }
0034 
0035 class AMAROK_EXPORT PopupDropperFactory : public QObject
0036 {
0037     Q_OBJECT
0038 
0039     friend PopupDropperFactory* The::popupDropperFactory();
0040 
0041     public:
0042         /**
0043          * Creates a new PopupDropper with correct system colors. This function creates it on top of the context view
0044          * Function for creating a new PopupDropper with a custom parent
0045          * @param parent The widget to act as the parent
0046          * @param ignoreEmptyParent Whether to ignore if the parent is null - use this when creating submenus where the parent is 0
0047          * @return The newly created PopupDropper
0048          */
0049         PopupDropper * createPopupDropper( QWidget * parent, bool ignoreEmptyParent = false );
0050 
0051         PopupDropperItem* createItem( QAction * action );
0052         void adjustItems( PopupDropper *pud );
0053         void adjustItem( PopupDropperItem *item );
0054         static void adjustItemCallback( void *pdi );
0055 
0056     private:
0057         explicit PopupDropperFactory( QObject* parent );
0058         ~PopupDropperFactory() override;
0059  };
0060 
0061 
0062 #endif