ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/dclient/src/backend/ndk/window.cpp
Revision: 1.2
Committed: Tue Oct 19 10:05:57 2010 UTC (13 years, 8 months ago) by sf-pippijn
Branch: MAIN
Changes since 1.1: +2 -2 lines
Log Message:
don't log waddnwstr errors

File Contents

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