ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/include/ndk/window.hh
Revision: 1.1
Committed: Sun Oct 24 20:31:44 2010 UTC (16 years ago) by sf-pippijn
Branch: MAIN
CVS Tags: HEAD
Log Message:
use EV and plain sockets instead of asio

File Contents

# User Rev Content
1 sf-pippijn 1.1 /* window.hh
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     #pragma once
9    
10     #include <ndk/support.hh>
11    
12     #include <curses.h>
13    
14     #include <memory>
15    
16     namespace ndk
17     {
18    
19     /**
20     * Generic interface to NCurses window, it's only a container with general
21     * functions, more powerful interface with subwindows and moving will be
22     * provided by panel note: derived windows (and subwindows) are unusable,
23     * because their separate single buffer with window, so I use only general
24     * windows ().
25     */
26     struct window
27     {
28     explicit window ();
29     virtual ~window ();
30    
31     virtual void resize (int w, int h);
32    
33     int width () const;
34     int height () const;
35     int x () const;
36     int y () const;
37     int right_x () const { return x () + width (); }
38     int bottom_y () const { return y () + height (); }
39    
40     /**
41     * mark line of the window as needed to update
42     * @param num number of the line
43     * @param count number of the lines to touch
44     */
45     void touch_line (int num, int count = 1);
46     void commit (); /**< commit window changes to virtual screen */
47    
48     void set_scroll (bool res = false); /**< scroll window content or not */
49    
50     void update () { wrefresh (win ()); }
51    
52     WINDOW *win () const { return win_.get (); }
53    
54     private:
55     std::unique_ptr<WINDOW, int (*)(WINDOW *)> win_;
56     };
57    
58     /**
59     * copy window content from source to destination
60     */
61     void copy (window &source, window &destination);
62     }