summaryrefslogtreecommitdiffstats
path: root/parts/doxygen/input.h
blob: 15c3a2636bbdd01f1de93f9fd8d5b09db138979d (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/***************************************************************************
 *   Copyright (C) 1997-2000 by Dimitri van Heesch                         *
 *   dimitri@stack.nl                                                      *
 *   Copyright (C) 2001 by Bernd Gehrmann                                  *
 *   bernd@kdevelop.org                                                    *
 *                                                                         *
 *   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 _INPUT_H
#define _INPUT_H
 
#include <qcheckbox.h>
#include <qdict.h>

class QComboBox;
class QLabel;
class KLineEdit;
class QListBox;
class QPushButton;
class QSpinBox;
 
class IInput
{
  public:
    virtual void init() = 0;
    virtual void setEnabled(bool) = 0;
    virtual QObject *qobject() = 0;
};


class InputBool : public QWidget, public IInput
{
    Q_OBJECT

public:
    InputBool(const QCString &key, const QString &text, QWidget *parent, bool &flag);
    ~InputBool();
    
    void init();
    virtual void setEnabled(bool b);
    virtual QObject *qobject() { return this; }
    virtual bool getState() const { return state; }

signals:
    void changed();
    void toggle(const QString &, bool);

private slots:
    void valueChanged(bool);

private:
    bool &state;
    QCString key;
    QCheckBox *cb;
};


class InputInt : public QWidget, public IInput
{
    Q_OBJECT

public:
    InputInt(const QString &text, QWidget *parent,
             int &val, int minVal, int maxVal);
    ~InputInt();
    
    void init();
    virtual void setEnabled(bool);
    QObject *qobject() { return this; }

signals:
    void changed();

private slots:
    void valueChanged(int val); 

private:
    QLabel *lab;
    QSpinBox *sp;
    int &m_val;
    int m_minVal;
    int m_maxVal;
};


class InputString : public QWidget, public IInput
{
    Q_OBJECT

public:
    enum StringMode { StringFree=0, 
                      StringFile=1, 
                      StringDir=2, 
                      StringFixed=3
                    };

    InputString(const QString &text, QWidget *parent,
                QCString &s, StringMode m=StringFree);
    ~InputString();
    
    void init();
    void addValue(const char *s);
    void setEnabled(bool);
    QObject *qobject() { return this; }

signals:
    void changed();

private slots:
    void textChanged(const QString&);
    void browse();
    void clear();

private:
    QLabel *lab;
    KLineEdit *le;
    QPushButton *br;
    QComboBox *com;
    QCString &str;
    StringMode sm;
    QDict<int> *m_values;
    int m_index; 
};


class InputStrList : public QWidget, public IInput
{
    Q_OBJECT

public:
    enum ListMode { ListString=0, 
                    ListFile=1, 
                    ListDir=2, 
                    ListFileDir=ListFile|ListDir 
                  };
    
    InputStrList(const QString &text, QWidget *parent, 
                 QStrList &sl, ListMode v=ListString);
    ~InputStrList();

    void init();
    void setEnabled(bool);
    QObject *qobject() { return this; }

signals:
    void changed();

private slots:
    void addString(); 
    void delString(); 
    void updateString(); 
    void selectText(const QString &s);
    void browseFiles();
    void browseDir();

private:
    QLabel *lab;
    KLineEdit *le;
    QPushButton *add;
    QPushButton *del;
    QPushButton *upd;
    QPushButton *brFile;
    QPushButton *brDir;
    QListBox *lb;
    QStrList &strList;
};

#endif