Oxygine  1
2g game engine
InputText.h
1 #pragma once
2 #include "oxygine-include.h"
3 #include "EventDispatcher.h"
4 #include "Event.h"
5 #include <string>
6 
7 #ifndef __S3E__
8 #include "SDL.h"
9 #endif
10 
11 namespace oxygine
12 {
13  DECLARE_SMART(InputText, spInputText);
14 
15  class InputText: public EventDispatcher
16  {
17  public:
18  enum {EVENT_TEXT_CHANGED = sysEventID('I', 'T', 'C') };
19  enum {EVENT_COMPLETE = Event::COMPLETE};
20 
21  InputText();
22  ~InputText();
23 
25  void start(spTextField textActor);
26  void stop();
27 
28  void setAllowedSymbols(const std::string& utf8str);
29  void setAllowedSymbols(const std::wstring& str);
30  void setDisallowedSymbols(const std::string& utf8str);
31  void setDisallowedSymbols(const std::wstring& str);
32  void setMaxTextLength(int);
33  void showCursor(bool show);
34 
35  static void stopAnyInput();
36 
37  private:
38  spTextField _textActor;
39 
40  std::string _allowed;
41  std::string _disallowed;
42  std::string _txt;
43 
44  spColorRectSprite _cursor;
45 
46  int _maxLength;
47  void updateText();
48  static InputText* _active;
49 
50  void _onSysEvent(Event* event);
51 
52 #ifndef __S3E__
53  int _onSDLEvent(SDL_Event* event);
54 #endif
55  };
56 }
Definition: InputText.h:15
Definition: Event.h:10
void start(spTextField textActor)
–oxgl-end–!
Definition: Actor.h:14
Definition: EventDispatcher.h:27