ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/dclient/src/backend/ndk/pad.cpp
Revision: 1.4
Committed: Sun Oct 24 20:31:51 2010 UTC (13 years, 8 months ago) by sf-pippijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +3 -3 lines
Log Message:
use EV and plain sockets instead of asio

File Contents

# Content
1 /* pad.cc
2 * This file is part of ncursesxx library
3 * Copyright (c) 2003,2004 by Stanislav Ievlev
4 *
5 * This file is covered by the GNU Library General Public License,
6 * which should be included with libncursesxx as the file COPYING.
7 */
8 #include <ndk/pad.hh>
9
10 #include <ndk/application.hh>
11 #include <ndk/window.hh>
12
13 #include <stdexcept>
14
15 using ndk::pad;
16
17 pad::pad ()
18 : pad_ (newpad (1, 1), delwin)
19 {
20 if (!pad_)
21 throw std::runtime_error ("newpad failed");
22 app->enable_keypad (win ());
23 }
24
25 pad::~pad ()
26 {
27 }
28
29 void
30 pad::resize (int w, int h)
31 {
32 return_unless (wresize (win (), h, w) == OK);
33 }
34
35 int
36 pad::width () const
37 {
38 int x, y;
39
40 getmaxyx (win (), y, x);
41 return x;
42 }
43
44 int
45 pad::height () const
46 {
47 int x, y;
48
49 getmaxyx (win (), y, x);
50 return y;
51 }
52
53 void
54 pad::draw (window &viewport, int x, int y)
55 {
56 return_unless (copywin (win (), viewport.win (), y + 1, x, 1, 1,
57 viewport.height () - 2, viewport.width () - 2, FALSE) == OK);
58 }