Make sure we don't ignore hidden files.
[vng.git] / src / GenericCursor.h
blob5f931a63c53e287d2fe8d5d39c786b42bd54ccf8
1 /*
2 * This file is part of the vng project
3 * Copyright (C) 2008 Thomas Zander <tzander@trolltech.com>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GENERICCURSOR_H
20 #define GENERICCURSOR_H
22 #include "InterviewCursor.h"
23 #include "Vng.h"
25 /// A cursor implementation that can work on a pre-added dataset.
26 class GenericCursor : public InterviewCursor
28 public:
29 /// Selects quit-behavion
30 enum AcceptanceMode {
31 ExitOnAccept,
32 ExitWhenDone
35 GenericCursor(AcceptanceMode mode = ExitOnAccept);
36 virtual ~GenericCursor();
38 /// returns the new index
39 virtual int forward(Scope scope = ItemScope, bool skipAnswered = true);
40 /// returns the new index
41 virtual int back(Scope scope = ItemScope);
42 virtual void setResponse(bool response, Scope scope = ItemScope);
44 void setAllowedOptions(QString &options);
45 virtual QString allowedOptions() const;
47 virtual int count();
48 virtual void forceCount();
50 virtual QString currentText() const;
51 void setHelpMessage(const QString &message);
52 virtual QString helpMessage() const;
53 virtual bool isValid() const;
55 int addDataItem(const QString &text);
57 QList<int> selectedItems() const;
59 private:
60 class Item {
61 public:
62 Item(const QString &text);
63 QString text() const;
65 Vng::Acceptance m_acceptance;
67 private:
68 QString m_text;
70 QList<Item*> m_items;
71 int m_curentIndex;
73 QString m_allowedOptions;
74 QString m_helpMessage;
75 AcceptanceMode m_mode;
76 bool m_oneAccepted;
79 #endif