Usermode/AxWin4 - Screen dimensions acquisition, speedup, window render
[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 0
31         for( auto rgn : m_regions )
32         {
33                 if( rect.Contains(rgn->m_rect) )
34                 {
35                         CRect   rel_rect(rect, rgn->m_rect);
36                         rgn->Repaint(m_surface, rel_rect);
37                 } 
38         }
39         #endif
40 }
41
42 void CWindow::Show(bool bShow)
43 {
44         if( m_is_shown == bShow )
45                 return;
46         
47         if( bShow )
48                 m_compositor.ShowWindow( this );
49         else
50                 m_compositor.HideWindow( this );
51         m_is_shown = bShow;
52 }
53
54 void CWindow::Move(int X, int Y)
55 {
56         m_surface.m_rect.Move(X, Y);
57 }
58 void CWindow::Resize(unsigned int W, unsigned int H)
59 {
60         m_surface.Resize(W, H);
61         IPC::SendNotify_Dims(m_client, W, H);
62 }
63 uint64_t CWindow::ShareSurface()
64 {
65         assert(!"TODO: CWindow::ShareSurface");
66         return 0;
67 }
68
69 void CWindow::MouseButton(int ButtonID, int X, int Y, bool Down)
70 {
71 }
72
73 void CWindow::MouseMove(int NewX, int NewY)
74 {
75 }
76
77 void CWindow::KeyEvent(::uint32_t Scancode, const ::std::string &Translated, bool Down)
78 {
79 }
80
81
82 void CWindow::DrawScanline(unsigned int row, unsigned int x, unsigned int w, const uint8_t *data)
83 {
84         m_surface.DrawScanline(row, x, w, data);
85         CRect   damaged( m_surface.m_rect.m_x+x, m_surface.m_rect.m_y+row, w, 1 );
86         m_compositor.DamageArea(damaged);
87 }
88
89 };
90

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