… | |
… | |
5 | * This file is covered by the GNU Library General Public License, |
5 | * This file is covered by the GNU Library General Public License, |
6 | * which should be included with libncursesxx as the file COPYING. |
6 | * which should be included with libncursesxx as the file COPYING. |
7 | */ |
7 | */ |
8 | #include <ndk++/pad.hh> |
8 | #include <ndk++/pad.hh> |
9 | |
9 | |
|
|
10 | #include <ndk++/application.hh> |
10 | #include <ndk++/window.hh> |
11 | #include <ndk++/window.hh> |
11 | |
12 | |
12 | #include <stdexcept> |
13 | #include <stdexcept> |
13 | |
14 | |
14 | using ndk::pad; |
15 | using ndk::pad; |
… | |
… | |
16 | pad::pad () |
17 | pad::pad () |
17 | : pad_ (newpad (1, 1), delwin) |
18 | : pad_ (newpad (1, 1), delwin) |
18 | { |
19 | { |
19 | if (!pad_) |
20 | if (!pad_) |
20 | throw std::runtime_error ("newpad failed"); |
21 | throw std::runtime_error ("newpad failed"); |
21 | keypad (win (), TRUE); /* initialize advanced keycodes for this window */ |
22 | app->enable_keypad (win ()); |
22 | } |
23 | } |
23 | |
24 | |
24 | pad::~pad () |
25 | pad::~pad () |
25 | { |
26 | { |
26 | } |
27 | } |
… | |
… | |
50 | } |
51 | } |
51 | |
52 | |
52 | void |
53 | void |
53 | pad::draw (window &viewport, int x, int y) |
54 | pad::draw (window &viewport, int x, int y) |
54 | { |
55 | { |
55 | return_unless (copywin (win (), viewport.win (), y, x, 1, 1, |
56 | return_unless (copywin (win (), viewport.win (), y + 1, x, 1, 1, |
56 | viewport.height () - 2, viewport.width () - 2, FALSE) == OK); |
57 | viewport.height () - 2, viewport.width () - 2, FALSE) == OK); |
57 | } |
58 | } |