ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/dclient/src/backend/ndk/edit.cpp
(Generate patch)

Comparing deliantra/dclient/src/backend/ndk/edit.cpp (file contents):
Revision 1.1 by sf-pippijn, Sun Oct 17 08:15:08 2010 UTC vs.
Revision 1.4 by sf-pippijn, Mon Oct 18 16:38:03 2010 UTC

15#include <cctype> 15#include <cctype>
16 16
17 17
18using ndk::edit; 18using ndk::edit;
19 19
20edit::edit (const std::string &str, panel *parent, bool accept) 20edit::edit (std::string const &str, panel *parent, bool accept)
21 : button (str, parent, accept) 21 : button (str, parent, accept)
22 , current_ (0) 22 , current_ (0)
23 , begin_ (0) 23 , begin_ (0)
24 , mode_ (normal) 24 , mode_ (normal)
25{ 25{
32{ 32{
33 button::resize (size, 1); 33 button::resize (size, 1);
34} 34}
35 35
36void 36void
37edit::set_text (const std::string &str) 37edit::set_text (std::string const &str)
38{ 38{
39 label::set_text (str); 39 label::set_text (str);
40 current_ = text_.length (); 40 current_ = text_.length ();
41 draw (); 41 draw ();
42} 42}
83 set_cursor (); /* and finally update cursor position */ 83 set_cursor (); /* and finally update cursor position */
84 ncurses::pen (*this).commit (); /* commit changes to the screen */ 84 ncurses::pen (*this).commit (); /* commit changes to the screen */
85} 85}
86 86
87ndk::event::result 87ndk::event::result
88edit::at_system (const event &ev) 88edit::at_system (event const &ev)
89{ 89{
90 event::result res = event::ignored; 90 event::result res = event::ignored;
91 91
92 if (!ev.sender_) 92 if (!ev.sender_)
93 { 93 {
105 } 105 }
106 return res; 106 return res;
107} 107}
108 108
109ndk::event::result 109ndk::event::result
110edit::at_keyboard (const keyboard &ev) 110edit::at_keyboard (keyboard const &ev)
111{ 111{
112 event::result res = event::ignored; 112 event::result res = event::ignored;
113 unsigned int pos = current_; 113 unsigned int pos = current_;
114 114
115 switch (ev.code ()) 115 switch (ev.code ())
214 214
215void 215void
216edit::set_cursor () 216edit::set_cursor ()
217{ 217{
218 /* always move to zero position in no_echo mode */ 218 /* always move to zero position in no_echo mode */
219 ncurses::pen (*this).move (mode_ != no_echo ? current_ - begin_ : 0, 0); 219 return_unless (ncurses::pen (*this).move (mode_ != no_echo ? current_ - begin_ : 0, 0));
220 ncurses::pen (*this).commit (); 220 ncurses::pen (*this).commit ();
221} 221}
222 222
223void 223void
224edit::insert (int pos, char sym) 224edit::insert (int pos, char sym)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines