Not crap after all...
[amarok.git] / src / prettypopupmenu.h
blobbc7f21dd7ddc4c2ab813d709029c297e6e69f4c9
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 Steet, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef AMAROK_PRETTYPOPUPMENU_H
22 #define AMAROK_PRETTYPOPUPMENU_H
24 #include <kmenu.h>
26 #include <qcolor.h>
27 #include <QImage>
28 #include <QRect>
29 //Added by qt3to4:
30 #include <QPaintEvent>
31 #include <QResizeEvent>
33 class QSize;
35 /**
36 * @class PrettyPopup
37 * @short KMenu with a pixmap at the left side
38 * @author Mark Kretschmann <markey@web.de>
40 * This class behaves just like KMenu, but adds a decorative banner
41 * graphic at the left border of the menu.
43 * The idea and the code are based on the Kicker start menu from KDE.
45 class PrettyPopupMenu : public KMenu
47 Q_OBJECT
49 public:
50 PrettyPopupMenu( QWidget *parent = 0 );
52 int sidePixmapWidth() const { return s_sidePixmap.width(); }
54 private:
55 /** Loads and prepares the sidebar image */
56 void generateSidePixmap();
57 /** Returns the available size for the image */
58 QRect sideImageRect() const;
59 /** Calculates a color that matches the current colorscheme */
60 QColor calcPixmapColor();
62 void setMinimumSize( const QSize& s );
63 void setMaximumSize( const QSize& s );
64 void setMinimumSize( int w, int h );
65 void setMaximumSize( int w, int h );
67 void resizeEvent( QResizeEvent* e );
68 void resize( int width, int height );
70 void paintEvent( QPaintEvent* e );
72 static QImage s_sidePixmap;
73 static QColor s_sidePixmapColor;
77 #endif /*AMAROK_PRETTYPOPUPMENU_H*/