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.4 by sf-pippijn, Mon Oct 18 16:38:03 2010 UTC vs.
Revision 1.5 by sf-pippijn, Tue Oct 19 09:45:08 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/pen.hh> 13#include <ndk++/pen.hh>
14 14
15#include <cctype> 15#include <cctype>
16 16
17 17
18using ndk::edit; 18using ndk::edit;
48} 48}
49 49
50void 50void
51edit::change_color () 51edit::change_color ()
52{ 52{
53 ncurses::pen (*this).set_color (palette::instance () 53 pen (*this).set_color (palette::instance ().find (
54 [
55 state_ == engine::enter_focus 54 state_ == engine::enter_focus
56 ? colors::edit_active 55 ? colors::edit_active
57 : colors::edit_inactive 56 : colors::edit_inactive
58 ]); 57 )->second);
59} 58}
60 59
61void 60void
62edit::draw () 61edit::draw ()
63{ 62{
79 break; 78 break;
80 } 79 }
81 80
82 label::draw (out, begin_); /* and draw */ 81 label::draw (out, begin_); /* and draw */
83 set_cursor (); /* and finally update cursor position */ 82 set_cursor (); /* and finally update cursor position */
84 ncurses::pen (*this).commit (); /* commit changes to the screen */ 83 pen (*this).commit (); /* commit changes to the screen */
85} 84}
86 85
87ndk::event::result 86ndk::event::result
88edit::at_system (event const &ev) 87edit::at_system (event const &ev)
89{ 88{
91 90
92 if (!ev.sender_) 91 if (!ev.sender_)
93 { 92 {
94 if (engine::enter_focus == ev.type_) 93 if (engine::enter_focus == ev.type_)
95 { 94 {
96 app ().cursor_on (); 95 app->cursor_on ();
97 set_cursor (); /* only set cursor position, don't need full redraw */ 96 set_cursor (); /* only set cursor position, don't need full redraw */
98 res = event::accepted; 97 res = event::accepted;
99 } 98 }
100 else if (engine::leave_focus == ev.type_) 99 else if (engine::leave_focus == ev.type_)
101 { 100 {
102 app ().cursor_off (); 101 app->cursor_off ();
103 res = event::accepted; 102 res = event::accepted;
104 } 103 }
105 } 104 }
106 return res; 105 return res;
107} 106}
214 213
215void 214void
216edit::set_cursor () 215edit::set_cursor ()
217{ 216{
218 /* always move to zero position in no_echo mode */ 217 /* always move to zero position in no_echo mode */
219 return_unless (ncurses::pen (*this).move (mode_ != no_echo ? current_ - begin_ : 0, 0)); 218 return_unless (pen (*this).move (mode_ != no_echo ? current_ - begin_ : 0, 0));
220 ncurses::pen (*this).commit (); 219 pen (*this).commit ();
221} 220}
222 221
223void 222void
224edit::insert (int pos, char sym) 223edit::insert (int pos, char sym)
225{ 224{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines