summaryrefslogtreecommitdiffstats
path: root/ksquirrel/sidebar/sq_multibar.h
blob: 22fabee1c244687ef160bc380e66c1bafb779c7f (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
110
111
/***************************************************************************
                          sq_multibar.h  -  description
                             -------------------
    begin                : ??? Nov 28 2005
    copyright            : (C) 2005 by Baryshev Dmitry
    email                : ksquirrel.iv@gmail.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef SQ_MULTIBAR_H
#define SQ_MULTIBAR_H

#include <tqhbox.h>

class KMultiTabBar;

class TQWidgetStack;
class TQSignalMapper;

/*
 *  Konqueror-like sidebar.
 *
 *    +----------------------------------> KMultiTabBar, only contains buttons
 *    |           +-----------------+
 *    |           |                 |
 *    |           |                 |
 *  +------------------------+      |
 *  | 1 |                    |      +----> TQWidgetStack, contains all widgets
 *  |---|                    |
 *  | 2 |                    |
 *  |---|                    |
 *  | 3 |                    |
 *  |---|                    |
 *  |   |    visible page    |
 *  |   |                    |
 *  | 4 |        N4          |
 *  |   |                    |
 *  |   |                    |
 *  |---|                    |
 *  |   |                    |
 *  |   |                    |
 *  |   |                    |
 *  |   |                    |
 *  +------------------------+
 *
 */

class SQ_MultiBar : public TQHBox
{
    Q_OBJECT
  TQ_OBJECT

    public: 
        SQ_MultiBar(TQWidget *tqparent = 0, const char *name = 0);
	 ~SQ_MultiBar();

        /*
         *  Add new widget with text label 'text' and icon 'icon'. SQ_MultiBar
         *  will use SQ_IconLoader to load given icon.
         */
        void addWidget(TQWidget *new_w, const TQString &text, const TQString &icon);

        /*
         *  Current page index. 0 means first page.
         */
        int currentPage();

        void updateLayout();

        KMultiTabBar* multiBar() const;

        static SQ_MultiBar* instance() { return m_inst; }

    public slots:

        /*
         *  Hide current widget and show a widget with
         *  id 'id'.
         */
        void raiseWidget(int id);

    private:
        KMultiTabBar *mt;
        TQWidgetStack *stack;
        int m_id, m_selected, m_width;
        TQSignalMapper *mapper;

        static SQ_MultiBar *m_inst;
};

inline
int SQ_MultiBar::currentPage()
{
    return m_selected;
}

inline
KMultiTabBar* SQ_MultiBar::multiBar() const
{
    return mt;
}

#endif