summaryrefslogtreecommitdiffstats
path: root/lib/kofficeui/KoTabChooser.h
blob: 7a49f49580d860dab8fe8b222081cc8f41a89ca7 (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
/* This file is part of the KDE project
   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef koTabChooser_h
#define koTabChooser_h

#include <qframe.h>
#include <koffice_export.h>
class QMouseEvent;
class QPainter;
class QPopupMenu;

/**
 *  class KoTabChooser
 */

class KoTabChooserPrivate;

class KOFFICEUI_EXPORT KoTabChooser : public QFrame
{
    Q_OBJECT

public:
    enum { TAB_LEFT = 1,
           TAB_CENTER = 2,
           TAB_RIGHT = 4,
           TAB_DEC_PNT = 8,
           TAB_ALL = TAB_LEFT | TAB_CENTER | TAB_RIGHT | TAB_DEC_PNT };

    KoTabChooser( QWidget *parent, int _flags );
    ~KoTabChooser();

    int getCurrTabType() { return currType; }
    
    /**
     * put m_bReadWrite to true as default
     * and used setReadWrite(false) to make in readOnly mode
     */
    void setReadWrite(bool _readWrite);

protected:
    void mousePressEvent( QMouseEvent *e );
    void drawContents( QPainter *painter );
    void setupMenu();

    int flags;
    int currType;
    QPopupMenu *rb_menu;
    int mLeft;
    int mRight;
    int mCenter;
    int mDecPoint;

    KoTabChooserPrivate *d;

protected slots:
    void rbLeft() { currType = TAB_LEFT; repaint( true ); }
    void rbCenter() { currType = TAB_CENTER; repaint( true ); }
    void rbRight() { currType = TAB_RIGHT; repaint( true ); }
    void rbDecPoint() { currType = TAB_DEC_PNT; repaint( true ); }

};

#endif