summaryrefslogtreecommitdiffstats
path: root/yakuake/src/title_bar.h
blob: 7b74d63776f231b3e87ba03ad4d547559e7451b2 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
    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.
*/

/*
  Copyright (C) 2005 Francois Chazal <neptune3k@free.fr>
  Copyright (C) 2006-2007 Eike Hein <hein@kde.org>
*/


#ifndef TITLE_BAR_H
# define TITLE_BAR_H

#include "image_button.h"

#include <qurl.h>
#include <qcolor.h>
#include <qpoint.h>
#include <qbitmap.h>
#include <qpixmap.h>
#include <qwidget.h>
#include <qpainter.h>
#include <qpushbutton.h>


#include <kconfig.h>
#include <kpopupmenu.h>
#include <kapplication.h>
#include <kstandarddirs.h>


class TitleBar : public QWidget
{
    Q_OBJECT

    public:
        explicit TitleBar(QWidget * parent = 0, const char * name = 0, const QString & skin = "default");
        ~TitleBar();

        QRegion& getWidgetMask();

        void setTitleText(const QString& title);

        void setFocusButtonEnabled(bool enable);

        void setConfigurationMenu(KPopupMenu* menu);

        void reloadSkin(const QString& skin);


    protected:
        virtual void paintEvent(QPaintEvent*);
        virtual void resizeEvent(QResizeEvent*);


    private:
        void setPixmaps(const QString& skin);
        void loadSkin(const QString& skin);
        void updateWidgetMask();

        /* Widget's mask */
        QRegion mask;

        /* Text properties */
        QString title_text;
        QString skin_text;
        QColor text_color;
        QPoint text_position;

        /* Widget's pixmaps */
        QPixmap back_image;
        QPixmap left_corner;
        QPixmap right_corner;

        /* Quit button */
        QPoint quit_position;
        ImageButton* quit_button;

        /* Focus button */
        QPoint focus_position;
        ImageButton* focus_button;

        /* Configure button */
        QPoint config_position;
        ImageButton* config_button;
};

#endif /* TITLE_BAR_H */