The Pedigree Project  0.1
tui.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef TUI_TUI_H
21 #define TUI_TUI_H
22 
23 #include <sys/types.h>
24 
25 class Widget;
26 class DirtyRectangle;
27 
29 {
30  public:
31  virtual ~TuiRedrawer() = default;
32 
33  virtual void redraw(size_t x, size_t y, size_t w, size_t h) = 0;
34 };
35 
36 class Tui
37 {
38  public:
40  Tui(TuiRedrawer *pRedrawer);
41 
43  Tui(Widget *widget);
44 
45  virtual ~Tui();
46 
48  bool initialise(size_t width, size_t height);
49 
51  void setCursorStyle(bool filled);
52 
54  void recreateSurfaces(void *fb);
55 
57  void resize(size_t newWidth, size_t newHeight);
58 
60  void run();
61 
63  void stop();
64 
66  void keyInput(uint64_t key);
67 
69  void redraw(DirtyRectangle &rect);
70 
71  private:
72  struct TuiLocal *m_LocalData;
73 
74  Widget *m_pWidget;
75  TuiRedrawer *m_pRedrawer;
76 };
77 
78 #endif
Definition: tui.h:36
Definition: tui.cc:31
Definition: Widget.h:63