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.2 by sf-pippijn, Mon Oct 18 14:11:48 2010 UTC vs.
Revision 1.4 by sf-pippijn, Mon Oct 18 16:38:03 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines