summaryrefslogtreecommitdiffhomepage
path: root/Tobii-EyeX/include/eyex-cpp/Bounds.inl
blob: 495e779d4f7451e9e4e1d8c95d42c6e1bd553083 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*********************************************************************************************************************
 * Copyright 2013-2014 Tobii Technology AB. All rights reserved.
 * Bounds.inl
 *********************************************************************************************************************/

#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Bounds__INL__)
#define __TOBII_TX_CLIENT_CPPBINDINGS_Bounds__INL__

/*********************************************************************************************************************/

TX_NAMESPACE_BEGIN

/*********************************************************************************************************************/

inline Bounds::Bounds(const std::shared_ptr<const Context>& spContext, TX_HANDLE hBounds)
: InteractionObject(spContext, hBounds)
{}

/*********************************************************************************************************************/

inline TX_BOUNDSTYPE Bounds::GetType() const
{
	TX_BOUNDSTYPE boundsType;
	TX_VALIDATE(txGetBoundsType(_hObject, &boundsType));
	return boundsType;
}

/*********************************************************************************************************************/


inline bool Bounds::TryGetRectangularData(TX_REAL* pX, TX_REAL* pY, TX_REAL* pWidth, TX_REAL* pHeight) const
{
	return txGetRectangularBoundsData(_hObject, pX, pY, pWidth, pHeight) == TX_RESULT_OK;
}

/*********************************************************************************************************************/

inline void Bounds::SetRectangularData(TX_REAL x, TX_REAL y, TX_REAL width, TX_REAL height)
{	
	txSetRectangularBoundsData(_hObject, x, y, width, height);
}

/*********************************************************************************************************************/

inline bool Bounds::TryGetRectangularData(TX_RECT* pData) const
{
	return TryGetRectangularData(&pData->X, &pData->Y, &pData->Width, &pData->Height);
}

/*********************************************************************************************************************/

inline void Bounds::SetRectangularData(const TX_RECT& data)
{
	SetRectangularData(data.X, data.Y, data.Width, data.Height);
}

/*********************************************************************************************************************/

inline std::shared_ptr<InteractionObject> Bounds::GetData() const
{		
	auto spProperty = GetProperty(TX_LITERAL_DATA);

	std::shared_ptr<InteractionObject> spData;
	if(spProperty->TryGetValue(&spData))
		return spData;

	return nullptr;
}

/*********************************************************************************************************************/

inline void Bounds::SetData(const std::shared_ptr<InteractionObject>& spData)
{
	auto spProperty = GetProperty(TX_LITERAL_DATA);
	spProperty->SetValue(spData);
}

/*********************************************************************************************************************/

TX_NAMESPACE_END

/*********************************************************************************************************************/

#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Bounds__INL__)

/*********************************************************************************************************************/