a0067a727660c1f4ab4aa98449ded3a4eecac0ad
[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):
16         m_surface(0,0,0,0),
17         m_compositor(compositor),
18         m_client(client),
19         m_name(name)
20 {
21         _SysDebug("CWindow::CWindow()");
22 }
23
24 CWindow::~CWindow()
25 {
26 }
27
28 void CWindow::Repaint(const CRect& rect)
29 {
30         if( m_is_shown )
31         {
32                 CRect   outrect(
33                         m_surface.m_rect.m_x + rect.m_x, 
34                         m_surface.m_rect.m_y + rect.m_y, 
35                         rect.m_w, rect.m_h
36                         );
37                 m_compositor.DamageArea(outrect);
38         }
39 }
40
41 void CWindow::Show(bool bShow)
42 {
43         if( m_is_shown == bShow )
44                 return;
45         
46         if( bShow )
47                 m_compositor.ShowWindow( this );
48         else
49                 m_compositor.HideWindow( this );
50         m_is_shown = bShow;
51 }
52
53 void CWindow::Move(int X, int Y)
54 {
55         m_surface.m_rect.Move(X, Y);
56 }
57 void CWindow::Resize(unsigned int W, unsigned int H)
58 {
59         m_surface.Resize(W, H);
60         IPC::SendMessage_NotifyDims(m_client, W, H);
61 }
62 void CWindow::SetFlags(uint32_t Flags)
63 {
64         // TODO: CWindow::SetFlags
65         _SysDebug("TOOD: CWindow::SetFlags");
66 }
67 uint64_t CWindow::ShareSurface()
68 {
69         assert(!"TODO: CWindow::ShareSurface");
70         return 0;
71 }
72
73 void CWindow::MouseButton(int ButtonID, int X, int Y, bool Down)
74 {
75 }
76
77 void CWindow::MouseMove(int NewX, int NewY)
78 {
79 }
80
81 void CWindow::KeyEvent(::uint32_t Scancode, const ::std::string &Translated, bool Down)
82 {
83 }
84
85
86 void CWindow::DrawScanline(unsigned int row, unsigned int x, unsigned int w, const uint8_t *data)
87 {
88         m_surface.DrawScanline(row, x, w, data);
89         CRect   damaged( m_surface.m_rect.m_x+x, m_surface.m_rect.m_y+row, w, 1 );
90         m_compositor.DamageArea(damaged);
91 }
92
93 };
94

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