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

File Contents

# Content
1 /* window.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/window.hh>
9
10 #include <ndk/application.hh>
11
12 #include <stdexcept>
13
14 using ndk::window;
15
16 window::window ()
17 : win_ (newwin (1, 1, 0, 0), delwin)
18 {
19 if (!win_)
20 throw std::runtime_error ("newwin call failed");
21 app->enable_keypad (win ());
22 }
23
24 window::~window ()
25 {
26 }
27
28 void
29 window::set_scroll (bool res)
30 {
31 scrollok (win (), res); /* don't use ::, because scrollok may be a macro */
32 }
33
34 void
35 window::resize (int w, int h)
36 {
37 return_unless (wresize (win (), h, w) == OK);
38 }
39
40 int
41 window::width () const
42 {
43 int y, x;
44
45 getmaxyx (win (), y, x);
46 return x;
47 }
48
49 int
50 window::height () const
51 {
52 int y, x;
53
54 getmaxyx (win (), y, x);
55 return y;
56 }
57
58 int
59 window::x () const
60 {
61 int y, x;
62
63 getbegyx (win (), y, x);
64 return x;
65 }
66
67 int
68 window::y () const
69 {
70 int y, x;
71
72 getbegyx (win (), y, x);
73 return y;
74 }
75
76 void
77 window::touch_line (int num, int count)
78 {
79 touchline (win (), num, count);
80 }
81
82 void
83 ndk::copy (window &source, window &destination)
84 {
85 return_unless (copywin (source.win (), destination.win (), 0, 0, 0, 0,
86 source.height () - 1, source.width () - 1, FALSE) == OK);
87 }