Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
textedit.hpp
1 //////////////////////////////
2 //
3 // File: lxs/windowing/textedit.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Feb 12 2013
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __LXS_TEXT_EDIT_WINDOW__
15 #define __LXS_TEXT_EDIT_WINDOW__
16 #include "lxs/windowing/button.hpp"
17 namespace LxS
18 {
19  class Font;
20  namespace Windowing
21  {
22  class VirtualKeypad;
23  //! editable text - creates onscreen keabord upon clicking
24  class TextEdit: public Button
25  {
26  public:
27  enum limitation_t
28  {
29  NORMAL,
30  NUMERIC,
31  PASSWORD,
32  IPADDRESS
33  };
34  protected:
35  limitation_t limitation;
36 
37  //! virtual keypad
39  //! real parent window (to which we will revert after entering text)
41  //! state of text
42  std::string base_text;
43  public:
44  void SetLimitation(limitation_t lim);
45  //! constructor
46  TextEdit(const std::string & _text, const std::string & _background);
47  //! constructor
48  TextEdit() ;
49  void Initialize();
50  //! set initial text
51  void SetBaseText(const std::string & t)
52  {
53  base_text.assign(t);
55  }
56  void Clicked(float x, float y);
57  void UnloadResources();
58  //! behavior function when text is inserted
59  virtual void OnText() {}
60  };
61  }
62 }
63 #endif