1 /***************************************************************************
2 * Copyright (C) 1996-2000 the kicker authors. *
3 * Copyright (C) 2005 Mark Kretschmann <markey@web.de> *
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. *
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. *
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
30 #include <QPaintEvent>
31 #include <QResizeEvent>
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
50 PrettyPopupMenu( QWidget
*parent
= 0 );
52 int sidePixmapWidth() const { return s_sidePixmap
.width(); }
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*/