… | |
… | |
16 | #include <cctype> |
16 | #include <cctype> |
17 | |
17 | |
18 | |
18 | |
19 | using ndk::edit; |
19 | using ndk::edit; |
20 | |
20 | |
21 | edit::edit (const std::string &str, panel *parent, bool accept) |
21 | edit::edit (std::string const &str, panel *parent, bool accept) |
22 | : button (str, parent, accept) |
22 | : button (str, parent, accept) |
23 | , current_ (0) |
23 | , current_ (0) |
24 | , begin_ (0) |
24 | , begin_ (0) |
25 | , mode_ (normal) |
25 | , mode_ (normal) |
26 | { |
26 | { |
… | |
… | |
33 | { |
33 | { |
34 | button::resize (size, 1); |
34 | button::resize (size, 1); |
35 | } |
35 | } |
36 | |
36 | |
37 | void |
37 | void |
38 | edit::set_text (const std::string &str) |
38 | edit::set_text (std::string const &str) |
39 | { |
39 | { |
40 | label::set_text (str); |
40 | label::set_text (str); |
41 | current_ = text_.length (); |
41 | current_ = text_.length (); |
42 | draw (); |
42 | draw (); |
43 | } |
43 | } |
… | |
… | |
84 | set_cursor (); /* and finally update cursor position */ |
84 | set_cursor (); /* and finally update cursor position */ |
85 | ncurses::pen (*this).commit (); /* commit changes to the screen */ |
85 | ncurses::pen (*this).commit (); /* commit changes to the screen */ |
86 | } |
86 | } |
87 | |
87 | |
88 | ndk::event::result |
88 | ndk::event::result |
89 | edit::at_system (const event &ev) |
89 | edit::at_system (event const &ev) |
90 | { |
90 | { |
91 | event::result res = event::ignored; |
91 | event::result res = event::ignored; |
92 | |
92 | |
93 | if (!ev.sender_) |
93 | if (!ev.sender_) |
94 | { |
94 | { |
… | |
… | |
106 | } |
106 | } |
107 | return res; |
107 | return res; |
108 | } |
108 | } |
109 | |
109 | |
110 | ndk::event::result |
110 | ndk::event::result |
111 | edit::at_keyboard (const keyboard &ev) |
111 | edit::at_keyboard (keyboard const &ev) |
112 | { |
112 | { |
113 | event::result res = event::ignored; |
113 | event::result res = event::ignored; |
114 | unsigned int pos = current_; |
114 | unsigned int pos = current_; |
115 | |
115 | |
116 | switch (ev.code ()) |
116 | switch (ev.code ()) |