Revert previous commit, was incorrect
[amarok.git] / src / prettypopupmenu.h
blob9e2fb2665404a3c2da7e6e71dc6d6f0044f00bfd
1 /***************************************************************************
2 * Copyright (C) 1996-2000 the kicker authors. *
3 * Copyright (C) 2005 Mark Kretschmann <markey@web.de> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef AMAROK_PRETTYPOPUPMENU_H
22 #define AMAROK_PRETTYPOPUPMENU_H
24 #include <KMenu>
26 #include <QColor>
27 #include <QImage>
28 #include <QRect>
30 class QPaintEvent;
31 class QSizeEvent;
32 class QSize;
34 /**
35 * @class PrettyPopup
36 * @short KMenu with a pixmap at the left side
37 * @author Mark Kretschmann <markey@web.de>
39 * This class behaves just like KMenu, but adds a decorative banner
40 * graphic at the left border of the menu.
42 * The idea and the code are based on the Kicker start menu from KDE.
44 class PrettyPopupMenu : public KMenu
46 Q_OBJECT
48 public:
49 PrettyPopupMenu( QWidget *parent = 0 );
51 int sidePixmapWidth() const { return s_sidePixmap.width(); }
53 private:
54 /** Loads and prepares the sidebar image */
55 void generateSidePixmap();
56 /** Returns the available size for the image */
57 QRect sideImageRect() const;
58 /** Calculates a color that matches the current colorscheme */
59 QColor calcPixmapColor();
61 void setMinimumSize( const QSize& s );
62 void setMaximumSize( const QSize& s );
63 void setMinimumSize( int w, int h );
64 void setMaximumSize( int w, int h );
66 void resizeEvent( QResizeEvent* e );
67 void resize( int width, int height );
69 void paintEvent( QPaintEvent* e );
71 static QImage s_sidePixmap;
72 static QColor s_sidePixmapColor;
76 #endif /*AMAROK_PRETTYPOPUPMENU_H*/