]> git.tdb.fi Git - libs/gltk.git/blob - source/entry.h
Add Text class with multiline support
[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 "text.h"
12 #include "widget.h"
13
14 namespace Msp {
15 namespace GLtk {
16
17 /**
18 Text entry field.
19
20 Special parts:
21
22   text    The current text of the widget.  Graphics are ignored.
23   cursor  Indicates the current input position.  Fill_x is ignored.
24 */
25 class Entry: public Widget
26 {
27 public:
28         class Loader: public Widget::Loader
29         {
30         public:
31                 Loader(Entry &);
32         };
33
34 private:
35         Text text;
36         unsigned edit_pos;
37
38 public:
39         sigc::signal<void> signal_enter;
40
41         Entry(const Resources &, const std::string & =std::string());
42
43         void set_text(const std::string &);
44         const std::string &get_text() const { return text.get(); }
45
46         virtual void key_press(unsigned, unsigned, wchar_t);
47 private:
48         virtual const char *get_class() const { return "entry"; }
49         virtual void render_special(const Part &) const;
50 };
51
52 } // namespace GLtk
53 } // namespace Msp
54
55 #endif
56