-
Notifications
You must be signed in to change notification settings - Fork 50
/
uiviewbase.cpp
55 lines (45 loc) · 852 Bytes
/
uiviewbase.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// uiviewbase.cpp
//
// Copyright (c) 2019-2021 Kristofer Berggren
// All rights reserved.
//
// nchat is distributed under the MIT license, see LICENSE for details.
#include "uiviewbase.h"
UiViewBase::UiViewBase(const UiViewParams& p_Params)
: m_X(p_Params.x)
, m_Y(p_Params.y)
, m_W(p_Params.w)
, m_H(p_Params.h)
, m_Enabled(p_Params.enabled)
, m_Model(p_Params.model)
, m_Dirty(true)
{
if (!m_Enabled) return;
m_Win = newwin(m_H, m_W, m_Y, m_X);
}
UiViewBase::~UiViewBase()
{
if (!m_Enabled) return;
delwin(m_Win);
m_Win = nullptr;
}
int UiViewBase::W()
{
return m_Enabled ? m_W : 0;
}
int UiViewBase::H()
{
return m_Enabled ? m_H : 0;
}
int UiViewBase::X()
{
return m_Enabled ? m_X : 0;
}
int UiViewBase::Y()
{
return m_Enabled ? m_Y : 0;
}
void UiViewBase::SetDirty(bool p_Dirty)
{
m_Dirty = p_Dirty;
}