summaryrefslogtreecommitdiffstats
path: root/amarok/src/prettypopupmenu.h
blob: 3485aaea98c8734e352d4f3b0fb1853f5fb9ee6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/***************************************************************************
 *   Copyright (C) 1996-2000 the kicker authors.                           *
 *   Copyright (C) 2005 Mark Kretschmann <markey@web.de>                   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02110-1301, USA.          *
 ***************************************************************************/

#ifndef AMAROK_PRETTYPOPUPMENU_H
#define AMAROK_PRETTYPOPUPMENU_H

#include <tdepopupmenu.h>

#include <tqcolor.h>
#include <tqimage.h>
#include <tqrect.h>

class TQSize;

/**
 * @class PrettyPopup
 * @short TDEPopupMenu with a pixmap at the left side
 * @author Mark Kretschmann <markey@web.de>
 *
 * This class behaves just like TDEPopupMenu, but adds a decorative banner
 * graphic at the left border of the menu.
 *
 * The idea and the code are based on the Kicker start menu from KDE.
 */
class PrettyPopupMenu : public TDEPopupMenu
{
        Q_OBJECT
  

    public:
        PrettyPopupMenu( TQWidget *parent = 0, const char *name = 0 );

        int sidePixmapWidth() const { return s_sidePixmap.width(); }

    private:
        /** Loads and prepares the sidebar image */
        void generateSidePixmap();
        /** Returns the available size for the image */
        TQRect sideImageRect() const;
        /** Calculates a color that matches the current colorscheme */
        TQColor calcPixmapColor();

        void setMinimumSize( const TQSize& s );
        void setMaximumSize( const TQSize& s );
        void setMinimumSize( int w, int h );
        void setMaximumSize( int w, int h );

        void resizeEvent( TQResizeEvent* e );
        void resize( int width, int height );

        void paintEvent( TQPaintEvent* e );

        static TQImage s_sidePixmap;
        static TQColor s_sidePixmapColor;
};


#endif /*AMAROK_PRETTYPOPUPMENU_H*/