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"
25 /// A cursor implementation that can work on a pre-added dataset.
26 class GenericCursor
: public InterviewCursor
29 /// Selects quit-behavion
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;
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;
62 Item(const QString
&text
);
65 Vng::Acceptance m_acceptance
;
73 QString m_allowedOptions
;
74 QString m_helpMessage
;
75 AcceptanceMode m_mode
;