]> git.tdb.fi Git - libs/gltk.git/blob - source/entry.h
c880bb4f8f639324e880cdce656a9c517173ad1f
[libs/gltk.git] / source / entry.h
1 /* $Id$
2
3 This file is part of libmspgltk
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GLTK_ENTRY_H_
9 #define MSP_GLTK_ENTRY_H_
10
11 #include "widget.h"
12
13 namespace Msp {
14 namespace GLtk {
15
16 /**
17 Text entry field.
18
19 Special parts:
20
21   text    The current text of the widget.  Graphics are ignored.
22   cursor  Indicates the current input position.  Fill_x is ignored.
23 */
24 class Entry: public Widget
25 {
26 public:
27         class Loader: public Widget::Loader
28         {
29         public:
30                 Loader(Entry &);
31         };
32
33 private:
34         std::string text;
35         unsigned edit_pos;
36
37 public:
38         Entry(const Resources &, const std::string & =std::string());
39
40         void set_text(const std::string &);
41         const std::string &get_text() const { return text; }
42
43         virtual void key_press(unsigned, unsigned, wchar_t);
44         virtual void focus_in();
45         virtual void focus_out();
46 private:
47         virtual const char *get_class() const { return "entry"; }
48         virtual void render_special(const Part &) const;
49 };
50
51 } // namespace GLtk
52 } // namespace Msp
53
54 #endif
55