summaryrefslogtreecommitdiffstats
path: root/parts/doxygen/input.h
blob: 2ce85a3de3b3473f41c5edf8699f29cfaf664bde (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
174
175
176
177
/***************************************************************************
 *   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 <tqcheckbox.h>
#include <tqdict.h>

class TQComboBox;
class TQLabel;
class KLineEdit;
class TQListBox;
class TQPushButton;
class TQSpinBox;
 
class IInput
{
  public:
    virtual void init() = 0;
    virtual void setEnabled(bool) = 0;
    virtual TQObject *qobject() = 0;
};


class InputBool : public TQWidget, public IInput
{
    Q_OBJECT
  TQ_OBJECT

public:
    InputBool(const TQCString &key, const TQString &text, TQWidget *parent, bool &flag);
    ~InputBool();
    
    void init();
    virtual void setEnabled(bool b);
    virtual TQObject *qobject() { return TQT_TQOBJECT(this); }
    virtual bool getState() const { return state; }

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

private slots:
    void valueChanged(bool);

private:
    bool &state;
    TQCString key;
    TQCheckBox *cb;
};


class InputInt : public TQWidget, public IInput
{
    Q_OBJECT
  TQ_OBJECT

public:
    InputInt(const TQString &text, TQWidget *parent,
             int &val, int minVal, int maxVal);
    ~InputInt();
    
    void init();
    virtual void setEnabled(bool);
    TQObject *qobject() { return TQT_TQOBJECT(this); }

signals:
    void changed();

private slots:
    void valueChanged(int val); 

private:
    TQLabel *lab;
    TQSpinBox *sp;
    int &m_val;
    int m_minVal;
    int m_maxVal;
};


class InputString : public TQWidget, public IInput
{
    Q_OBJECT
  TQ_OBJECT

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

    InputString(const TQString &text, TQWidget *parent,
                TQCString &s, StringMode m=StringFree);
    ~InputString();
    
    void init();
    void addValue(const char *s);
    void setEnabled(bool);
    TQObject *qobject() { return TQT_TQOBJECT(this); }

signals:
    void changed();

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

private:
    TQLabel *lab;
    KLineEdit *le;
    TQPushButton *br;
    TQComboBox *com;
    TQCString &str;
    StringMode sm;
    TQDict<int> *m_values;
    int m_index; 
};


class InputStrList : public TQWidget, public IInput
{
    Q_OBJECT
  TQ_OBJECT

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

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

signals:
    void changed();

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

private:
    TQLabel *lab;
    KLineEdit *le;
    TQPushButton *add;
    TQPushButton *del;
    TQPushButton *upd;
    TQPushButton *brFile;
    TQPushButton *brDir;
    TQListBox *lb;
    TQStrList &strList;
};

#endif