ScummVM API documentation
read_string_controller.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA4_CONTROLLERS_READ_STRING_CONTROLLER_H
23 #define ULTIMA4_CONTROLLERS_READ_STRING_CONTROLLER_H
24 
25 #include "ultima/ultima4/controllers/controller.h"
26 #include "ultima/ultima4/events/event_handler.h"
27 #include "ultima/ultima4/views/textview.h"
28 
29 namespace Ultima {
30 namespace Ultima4 {
31 
35 class ReadStringController : public WaitableController<Common::String> {
36 public:
43  ReadStringController(int maxlen, int screenX, int screenY, const Common::String &accepted_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 \n\r\010");
44  ReadStringController(int maxlen, TextView *view, const Common::String &accepted_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 \n\r\010");
45  bool keyPressed(int key) override;
46 
47  static Common::String get(int maxlen, int screenX, int screenY, EventHandler *eh = nullptr);
48  static Common::String get(int maxlen, TextView *view, EventHandler *eh = nullptr);
49 #ifdef IOS_ULTIMA4
50  void setValue(const Common::String &utf8StringValue) {
51  value = utf8StringValue;
52  }
53 #endif
54 
55 protected:
56  int _maxLen, _screenX, _screenY;
57  TextView *_view;
58  Common::String _accepted;
59 };
60 
61 } // End of namespace Ultima4
62 } // End of namespace Ultima
63 
64 #endif
Definition: str.h:59
Definition: textview.h:41
Definition: detection.h:27
Definition: read_string_controller.h:35
Definition: controller.h:118
Definition: event_handler.h:87
ReadStringController(int maxlen, int screenX, int screenY, const Common::String &accepted_chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 \\0")
bool keyPressed(int key) override