[PATCH] multiple device *read* opens support
[linux-2.6/history.git] / scripts / kconfig / qconf.h
blobc548884b4bca12d22faea6ecef23a36b5028d709
1 /*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
6 #include <qlistview.h>
8 class ConfigList;
9 class ConfigItem;
10 class ConfigLineEdit;
11 class ConfigMainWindow;
13 class ConfigView : public QVBox {
14 Q_OBJECT
15 typedef class QVBox Parent;
16 public:
17 ConfigView(QWidget* parent, ConfigMainWindow* cview);
18 ~ConfigView(void);
19 static void updateList(ConfigItem* item);
20 static void updateListAll(void);
22 public:
23 ConfigList* list;
24 ConfigLineEdit* lineEdit;
26 static ConfigView* viewList;
27 ConfigView* nextView;
30 enum colIdx {
31 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
33 enum listMode {
34 singleMode, menuMode, symbolMode, fullMode
37 class ConfigList : public QListView {
38 Q_OBJECT
39 typedef class QListView Parent;
40 public:
41 ConfigList(ConfigView* p, ConfigMainWindow* cview);
42 void reinit(void);
43 ConfigView* parent(void) const
45 return (ConfigView*)Parent::parent();
48 protected:
49 ConfigMainWindow* cview;
51 void keyPressEvent(QKeyEvent *e);
52 void contentsMousePressEvent(QMouseEvent *e);
53 void contentsMouseReleaseEvent(QMouseEvent *e);
54 void contentsMouseMoveEvent(QMouseEvent *e);
55 void contentsMouseDoubleClickEvent(QMouseEvent *e);
56 void focusInEvent(QFocusEvent *e);
57 public slots:
58 void setRootMenu(struct menu *menu);
60 void updateList(ConfigItem *item);
61 void setValue(ConfigItem* item, tristate val);
62 void changeValue(ConfigItem* item);
63 void updateSelection(void);
64 signals:
65 void menuSelected(struct menu *menu);
66 void parentSelected(void);
67 void gotFocus(void);
69 public:
70 void updateListAll(void)
72 updateAll = true;
73 updateList(NULL);
74 updateAll = false;
76 ConfigList* listView()
78 return this;
80 ConfigItem* firstChild() const
82 return (ConfigItem *)Parent::firstChild();
84 int mapIdx(colIdx idx)
86 return colMap[idx];
88 void addColumn(colIdx idx, const QString& label)
90 colMap[idx] = Parent::addColumn(label);
91 colRevMap[colMap[idx]] = idx;
93 void removeColumn(colIdx idx)
95 int col = colMap[idx];
96 if (col >= 0) {
97 Parent::removeColumn(col);
98 colRevMap[col] = colMap[idx] = -1;
101 void setAllOpen(bool open);
102 void setParentMenu(void);
104 template <class P>
105 void ConfigList::updateMenuList(P*, struct menu*);
107 bool updateAll;
109 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
110 QPixmap choiceYesPix, choiceNoPix;
111 QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
113 bool showAll, showName, showRange, showData;
114 enum listMode mode;
115 struct menu *rootEntry;
116 QColorGroup disabledColorGroup;
117 QColorGroup inactivedColorGroup;
119 private:
120 int colMap[colNr];
121 int colRevMap[colNr];
124 class ConfigItem : public QListViewItem {
125 typedef class QListViewItem Parent;
126 public:
127 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v)
128 : Parent(parent, after), menu(m), visible(v), goParent(false)
130 init();
132 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
133 : Parent(parent, after), menu(m), visible(v), goParent(false)
135 init();
137 ConfigItem(QListView *parent, ConfigItem *after, bool v)
138 : Parent(parent, after), menu(0), visible(v), goParent(true)
140 init();
142 ~ConfigItem(void);
143 void init(void);
144 #if QT_VERSION >= 300
145 void okRename(int col);
146 #endif
147 void updateMenu(void);
148 void testUpdateMenu(bool v);
149 ConfigList* listView() const
151 return (ConfigList*)Parent::listView();
153 ConfigItem* firstChild() const
155 return (ConfigItem *)Parent::firstChild();
157 ConfigItem* nextSibling() const
159 return (ConfigItem *)Parent::nextSibling();
161 void setText(colIdx idx, const QString& text)
163 Parent::setText(listView()->mapIdx(idx), text);
165 QString text(colIdx idx) const
167 return Parent::text(listView()->mapIdx(idx));
169 void setPixmap(colIdx idx, const QPixmap& pm)
171 Parent::setPixmap(listView()->mapIdx(idx), pm);
173 const QPixmap* pixmap(colIdx idx) const
175 return Parent::pixmap(listView()->mapIdx(idx));
177 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
179 ConfigItem* nextItem;
180 struct menu *menu;
181 bool visible;
182 bool goParent;
185 class ConfigLineEdit : public QLineEdit {
186 Q_OBJECT
187 typedef class QLineEdit Parent;
188 public:
189 ConfigLineEdit(ConfigView* parent)
190 : Parent(parent)
192 ConfigView* parent(void) const
194 return (ConfigView*)Parent::parent();
196 void show(ConfigItem *i);
197 void keyPressEvent(QKeyEvent *e);
199 public:
200 ConfigItem *item;
203 class ConfigMainWindow : public QMainWindow {
204 Q_OBJECT
205 public:
206 ConfigMainWindow(void);
207 public slots:
208 void setHelp(QListViewItem* item);
209 void changeMenu(struct menu *);
210 void listFocusChanged(void);
211 void goBack(void);
212 void loadConfig(void);
213 void saveConfig(void);
214 void saveConfigAs(void);
215 void showSingleView(void);
216 void showSplitView(void);
217 void showFullView(void);
218 void setShowAll(bool);
219 void setShowDebug(bool);
220 void setShowRange(bool);
221 void setShowName(bool);
222 void setShowData(bool);
223 void showIntro(void);
224 void showAbout(void);
226 protected:
227 void closeEvent(QCloseEvent *e);
229 ConfigView *menuView;
230 ConfigList *menuList;
231 ConfigView *configView;
232 ConfigList *configList;
233 QTextView *helpText;
234 QToolBar *toolBar;
235 QAction *backAction;
237 bool showDebug;