Usermode/libc #6 Fix string.h functions, add some more unit tests
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / include / CCompositor.hpp
1 /*
2  * Acess2 GUI v4
3  * - By John Hodge (thePowersGang) 
4  *
5  * CCompositor.hpp
6  * - Window Compositor
7  */
8 #ifndef _CCOMPOSITOR_H_
9 #define _CCOMPOSITOR_H_
10
11 #include <string>
12 #include <list>
13 #include <vector>
14 #include "CRect.hpp"
15 #include "CWindow.hpp"
16
17 namespace AxWin {
18
19 class CClient;
20 class CVideo;
21
22
23 enum eMouseButton
24 {
25         MOUSEBTN_MAIN,  // Left
26         MOUSEBTN_SECONDARY,     // Right
27         MOUSEBTN_MIDDLE,        // Scroll wheel
28         MOUSEBTN_BTN4,
29         MOUSEBTN_BTN5,
30 };
31
32 class CWindowIDBuffer
33 {
34         struct TWindowID
35         {
36                 uint16_t        Client;
37                 uint16_t        Window;
38         };
39         unsigned int    m_w;
40         ::std::vector<TWindowID>        m_buf;
41 public:
42         CWindowIDBuffer(unsigned int W, unsigned int H);
43         
44         void set(unsigned int X, unsigned int Y, unsigned int W, unsigned int H, CWindow* win);
45         CWindow* get(unsigned int X, unsigned int Y);
46 };
47
48 class CCompositor
49 {
50         CVideo& m_video;
51         ::std::list<CRect>      m_damageRects;
52         ::std::list<CWindow*>   m_windows;
53
54         CWindowIDBuffer m_windowIDBuffer;       // One 32-bit value per pixel
55         
56 public:
57         CCompositor(CVideo& video);
58
59         CWindow* CreateWindow(CClient& client, const ::std::string& name);
60
61         void    ShowWindow(CWindow* window);
62         void    HideWindow(CWindow* window);
63
64         bool    GetScreenDims(unsigned int ScrenID, unsigned int *Width, unsigned int *Height);
65
66         void    Redraw();
67         void    DamageArea(const CRect& rect);
68         void    BlitFromSurface(const CSurface& dest, const CRect& src_rect);
69         
70         void    MouseMove(unsigned int Cursor, unsigned int X, unsigned int Y, int dX, int dY);
71         void    MouseButton(unsigned int Cursor, unsigned int X, unsigned int Y, eMouseButton Button, bool Press);
72         
73         void    KeyState(unsigned int KeyboardID, uint32_t KeySym, bool Press, uint32_t Codepoint);
74 public:
75         CWindow*        getWindowForCoord(unsigned int X, unsigned int Y);
76 };
77
78
79 };
80
81 #endif
82

UCC git Repository :: git.ucc.asn.au