ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/backend/ncxx/window.cpp
Revision: 1.1
Committed: Sun Oct 17 08:15:07 2010 UTC (15 years, 11 months ago) by sf-pippijn
Branch: MAIN
Log Message:
initial import

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