1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
6 // Copyright (C) 2014 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as
10 // published by the Free Software Foundation, either version 3 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "nel/gui/view_pointer_base.h"
32 CViewPointerBase::CViewPointerBase( const CViewBase::TCtorParam
¶m
) :
34 _Buttons( NLMISC::noButton
)
36 _PointerX
= _PointerY
= _PointerOldX
= _PointerOldY
= _PointerDownX
= _PointerDownY
= InvalidCoord
;
38 _PointerVisible
= true;
41 CViewPointerBase::~CViewPointerBase()
45 // --------------------------------------------------------------------------------------------------------------------
46 void CViewPointerBase::setPointerPos (sint32 x
, sint32 y
)
52 if (((_PointerX
- _PointerDownX
) != 0) ||
53 ((_PointerY
- _PointerDownY
) != 0))
60 _PointerOldX
= getX();
61 _PointerOldY
= getY();
67 // --------------------------------------------------------------------------------------------------------------------
68 void CViewPointerBase::setPointerDispPos (sint32 x
, sint32 y
)
75 // --------------------------------------------------------------------------------------------------------------------
76 void CViewPointerBase::resetPointerPos ()
78 _PointerOldX
= _PointerX
;
79 _PointerOldY
= _PointerY
;
82 // --------------------------------------------------------------------------------------------------------------------
83 void CViewPointerBase::setPointerDown (bool pd
)
89 _PointerDownX
= _PointerX
;
90 _PointerDownY
= _PointerY
;
96 // --------------------------------------------------------------------------------------------------------------------
97 void CViewPointerBase::setPointerMiddleDown (bool pd
)
99 _PointerMiddleDown
= pd
;
101 if (_PointerMiddleDown
)
103 _PointerMiddleDownX
= _PointerX
;
104 _PointerMiddleDownY
= _PointerY
;
108 // --------------------------------------------------------------------------------------------------------------------
109 void CViewPointerBase::setPointerRightDown (bool pd
)
111 _PointerRightDown
= pd
;
113 if (_PointerRightDown
)
115 _PointerRightDownX
= _PointerX
;
116 _PointerRightDownY
= _PointerY
;
120 // --------------------------------------------------------------------------------------------------------------------
121 void CViewPointerBase::setPointerDownString (const std::string
&s
)
123 _PointerDownString
= s
;
128 // --------------------------------------------------------------------------------------------------------------------
129 void CViewPointerBase::getPointerPos (sint32
&x
, sint32
&y
)
135 // --------------------------------------------------------------------------------------------------------------------
136 void CViewPointerBase::getPointerDispPos (sint32
&x
, sint32
&y
)
142 // --------------------------------------------------------------------------------------------------------------------
143 void CViewPointerBase::getPointerOldPos (sint32
&x
, sint32
&y
)
149 // --------------------------------------------------------------------------------------------------------------------
150 bool CViewPointerBase::getPointerDown (sint32
&x
, sint32
&y
)
158 // --------------------------------------------------------------------------------------------------------------------
159 bool CViewPointerBase::getPointerMiddleDown (sint32
&x
, sint32
&y
)
161 x
= _PointerMiddleDownX
;
162 y
= _PointerMiddleDownY
;
164 return _PointerMiddleDown
;
167 // --------------------------------------------------------------------------------------------------------------------
168 bool CViewPointerBase::getPointerRightDown (sint32
&x
, sint32
&y
)
170 x
= _PointerRightDownX
;
171 y
= _PointerRightDownY
;
173 return _PointerRightDown
;
176 // --------------------------------------------------------------------------------------------------------------------
177 bool CViewPointerBase::getPointerDrag ()
182 // --------------------------------------------------------------------------------------------------------------------
183 std::string
CViewPointerBase::getPointerDownString ()
185 return _PointerDownString
;