summaryrefslogtreecommitdiffstats
path: root/yakuake/src/tab_bar.h
blob: 16afe3c42a00e88ed35345b18fcffed9aadd8ad0 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
    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 TAB_BAR_H
#define TAB_BAR_H


#include "image_button.h"
#include "tabbed_widget.h"
#include "translucent_widget.h"

#include <tqurl.h>
#include <tqcolor.h>
#include <tqpoint.h>
#include <tqpixmap.h>
#include <tqpainter.h>

#include <tdeconfig.h>
#include <krootpixmap.h>
#include <kstandarddirs.h>


class TabBar : public TranslucentWidget
{
    Q_OBJECT
  

    public:
        explicit TabBar(TQWidget* parent = 0, const char* name = 0,
                        bool translucency = false, const TQString& skin = "default");
        ~TabBar();

        void setSessionMenu(TDEPopupMenu* menu);

        int pressedPosition();
        void resetPressedPosition();

        void addItem(int session_id);
        int removeItem(int session_id);

        const TQString itemName(int session_id);
        void renameItem(int session_id, const TQString& name);
        void interactiveRename();

        int tabPositionForSessionId(int session_id);
        int sessionIdForTabPosition(int position);

        void selectItem(int session_id);
        void selectPosition(int position);

        void reloadSkin(const TQString& skin);


    public slots:
        void slotSelectNextItem();
        void slotSelectPreviousItem();

        void slotMoveItemLeft();
        void slotMoveItemRight();


    signals:
        void addItem();
        void removeItem();
        void itemSelected(int session_id);
        void updateBackground();


    protected:
        virtual void paintEvent(TQPaintEvent*);
        virtual void resizeEvent(TQResizeEvent*);


    private:
        void setPixmaps(const TQString& skin);
        void loadSkin(const TQString& skin);

        /* Text properties */
        TQColor text_color;

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

        /* Plus button */
        TQPoint plus_position;
        ImageButton* plus_button;

        /* Minus button */
        TQPoint minus_position;
        ImageButton* minus_button;

        /* Tabbed widget */
        TQPoint tabs_position;
        TabbedWidget* tabs_widget;
};

#endif /* TAB_BAR_H */