Change Encyclo button name and macros icon
[ryzomcore.git] / nel / src / gui / view_pointer_base.cpp
blob064609713354c68c63f9ca7230790dddfc326fc9
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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>
7 //
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/>.
22 #include "stdpch.h"
23 #include "nel/gui/view_pointer_base.h"
25 #ifdef DEBUG_NEW
26 #define new DEBUG_NEW
27 #endif
29 namespace NLGUI
32 CViewPointerBase::CViewPointerBase( const CViewBase::TCtorParam &param ) :
33 CViewBase( param ),
34 _Buttons( NLMISC::noButton )
36 _PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = InvalidCoord;
37 _PointerDown = false;
38 _PointerVisible = true;
41 CViewPointerBase::~CViewPointerBase()
45 // --------------------------------------------------------------------------------------------------------------------
46 void CViewPointerBase::setPointerPos (sint32 x, sint32 y)
48 if (_PointerDown)
50 if (!_PointerDrag)
52 if (((_PointerX - _PointerDownX) != 0) ||
53 ((_PointerY - _PointerDownY) != 0))
55 _PointerDrag = true;
60 _PointerOldX = getX();
61 _PointerOldY = getY();
63 _PointerX = x;
64 _PointerY = y;
67 // --------------------------------------------------------------------------------------------------------------------
68 void CViewPointerBase::setPointerDispPos (sint32 x, sint32 y)
70 setX (x);
71 setY (y);
72 updateCoords ();
75 // --------------------------------------------------------------------------------------------------------------------
76 void CViewPointerBase::resetPointerPos ()
78 _PointerOldX = _PointerX;
79 _PointerOldY = _PointerY;
82 // --------------------------------------------------------------------------------------------------------------------
83 void CViewPointerBase::setPointerDown (bool pd)
85 _PointerDown = pd;
87 if (_PointerDown)
89 _PointerDownX = _PointerX;
90 _PointerDownY = _PointerY;
92 else
93 _PointerDrag = false;
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;
126 // +++ GET +++
128 // --------------------------------------------------------------------------------------------------------------------
129 void CViewPointerBase::getPointerPos (sint32 &x, sint32 &y)
131 x = _PointerX;
132 y = _PointerY;
135 // --------------------------------------------------------------------------------------------------------------------
136 void CViewPointerBase::getPointerDispPos (sint32 &x, sint32 &y)
138 x = getX();
139 y = getY();
142 // --------------------------------------------------------------------------------------------------------------------
143 void CViewPointerBase::getPointerOldPos (sint32 &x, sint32 &y)
145 x = _PointerOldX;
146 y = _PointerOldY;
149 // --------------------------------------------------------------------------------------------------------------------
150 bool CViewPointerBase::getPointerDown (sint32 &x, sint32 &y)
152 x = _PointerDownX;
153 y = _PointerDownY;
155 return _PointerDown;
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 ()
179 return _PointerDrag;
182 // --------------------------------------------------------------------------------------------------------------------
183 std::string CViewPointerBase::getPointerDownString ()
185 return _PointerDownString;