55c24823c7dad6553b0cf12c97f9677bcdd6ec27
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / CWindow.cpp
1 /*
2  * Acess2 GUI v4
3  * - By John Hodge (thePowersGang)
4  *
5  * CWindow.cpp
6  * - Window
7  */
8 #include <CWindow.hpp>
9 #include <CCompositor.hpp>
10 #include <assert.h>
11 #include <ipc.hpp>
12
13 namespace AxWin {
14
15 CWindow::CWindow(CCompositor& compositor, CClient& client, const ::std::string& name, unsigned int id):
16         m_surface(0,0,0,0),
17         m_compositor(compositor),
18         m_client(client),
19         m_id(id),
20         m_name(name),
21         m_is_shown(false)
22 {
23         _SysDebug("CWindow::CWindow()");
24 }
25
26 CWindow::~CWindow()
27 {
28 }
29
30 void CWindow::Repaint(const CRect& rect)
31 {
32         if( m_is_shown )
33         {
34                 CRect   outrect(
35                         m_surface.m_rect.m_x + rect.m_x, 
36                         m_surface.m_rect.m_y + rect.m_y, 
37                         rect.m_w, rect.m_h
38                         );
39                 m_compositor.DamageArea(outrect);
40         }
41 }
42
43 void CWindow::Show(bool bShow)
44 {
45         if( m_is_shown == bShow )
46                 return;
47         
48         if( bShow )
49                 m_compositor.ShowWindow( this );
50         else
51                 m_compositor.HideWindow( this );
52         m_is_shown = bShow;
53 }
54
55 void CWindow::Move(int X, int Y)
56 {
57         m_surface.m_rect.Move(X, Y);
58 }
59 void CWindow::Resize(unsigned int W, unsigned int H)
60 {
61         m_surface.Resize(W, H);
62         IPC::SendMessage_NotifyDims(m_client, W, H);
63 }
64 void CWindow::SetFlags(uint32_t Flags)
65 {
66         // TODO: CWindow::SetFlags
67         _SysDebug("TOOD: CWindow::SetFlags");
68 }
69 uint64_t CWindow::ShareSurface()
70 {
71         assert(!"TODO: CWindow::ShareSurface");
72         return 0;
73 }
74
75 void CWindow::MouseButton(int ButtonID, int X, int Y, bool Down)
76 {
77 }
78
79 void CWindow::MouseMove(int NewX, int NewY)
80 {
81 }
82
83 void CWindow::KeyEvent(::uint32_t Scancode, const ::std::string &Translated, bool Down)
84 {
85 }
86
87
88 void CWindow::DrawScanline(unsigned int row, unsigned int x, unsigned int w, const uint8_t *data)
89 {
90         m_surface.DrawScanline(row, x, w, data);
91         CRect   damaged( m_surface.m_rect.m_x+x, m_surface.m_rect.m_y+row, w, 1 );
92         m_compositor.DamageArea(damaged);
93 }
94
95 };
96

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