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>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "view_pointer_ryzom.h"
22 #include "group_map.h"
23 #include "nel/gui/group_html.h"
24 #include "interface_3d_scene.h"
25 #include "../r2/editor.h"
26 #include "nel/gui/ctrl_col_pick.h"
27 #include "nel/gui/widget_manager.h"
28 #include "nel/gui/view_renderer.h"
29 #include "nel/gui/group_paragraph.h"
30 #include "nel/misc/xml_auto_ptr.h"
31 #include "nel/gui/group_container.h"
34 NLMISC_REGISTER_OBJECT( CViewBase
, CViewPointerRyzom
, std::string
, "pointer");
36 CViewPointerRyzom::CViewPointerRyzom( const TCtorParam
¶m
) :
41 CViewPointerRyzom::~CViewPointerRyzom()
45 void CViewPointerRyzom::forceLinking()
49 // --------------------------------------------------------------------------------------------------------------------
50 bool CViewPointerRyzom::drawResizer(CCtrlBase
* pCB
, CRGBA col
)
52 CCtrlResizer
*pCR
= dynamic_cast<CCtrlResizer
*>(pCB
);
55 CGroupContainer
*parent
= dynamic_cast<CGroupContainer
*>(pCR
->getParent());
56 if (parent
&& !parent
->isLocked())
59 switch(pCR
->getRealResizerPos())
63 texID
= _TxIdResizeBRTL
;
67 texID
= _TxIdResizeBLTR
;
71 texID
= _TxIdResizeLR
;
75 texID
= _TxIdResizeTB
;
81 drawCursor(texID
, col
, false);
88 // --------------------------------------------------------------------------------------------------------------------
89 bool CViewPointerRyzom::drawRotate (CCtrlBase
* pCB
, CRGBA col
)
91 CInterface3DScene
*pI3DS
= dynamic_cast<CInterface3DScene
*>(pCB
);
94 drawCursor(_TxIdRotate
, col
, 0);
100 // --------------------------------------------------------------------------------------------------------------------
101 bool CViewPointerRyzom::drawScale (CCtrlBase
* pCB
, CRGBA col
)
103 CInterface3DScene
*pI3DS
= dynamic_cast<CInterface3DScene
*>(pCB
);
106 drawCursor(_TxIdScale
, col
, 0);
112 // --------------------------------------------------------------------------------------------------------------------
113 bool CViewPointerRyzom::drawColorPicker (CCtrlBase
* pCB
, CRGBA col
)
115 CCtrlColPick
*pCCP
= dynamic_cast<CCtrlColPick
*>(pCB
);
118 drawCursor(_TxIdColPick
, col
, 0);
124 // --------------------------------------------------------------------------------------------------------------------
125 bool CViewPointerRyzom::drawLink (CCtrlBase
* pCB
, CRGBA col
)
127 CCtrlLink
*pCCP
= dynamic_cast<CCtrlLink
*>(pCB
);
130 drawCursor(_TxIdColPick
, col
, 0);
136 // --------------------------------------------------------------------------------------------------------------------
137 bool CViewPointerRyzom::drawBrowse (CCtrlBase
* pCB
, CRGBA col
)
139 CGroupHTML
*pCGH
= dynamic_cast<CGroupHTML
*>(pCB
);
142 if (pCGH
->isBrowsing())
145 drawCursor(_TxIdRotate
, col
, rot
>>3);
146 rot
= (rot
+1) & 0x1f;
153 // --------------------------------------------------------------------------------------------------------------------
154 bool CViewPointerRyzom::drawPan(CCtrlBase
* pCB
, NLMISC::CRGBA col
)
156 CGroupMap
*gm
= dynamic_cast<CGroupMap
*>(pCB
);
160 if (ClientCfg
.R2EDEnabled
&& R2::getEditor().getCurrentTool())
162 /** If cursor is set to anything other than the default cursor, use that cursor (because action can be performed on the map
163 * by the current tool
165 if (_TxDefault
== "curs_default.tga")
167 texId
= gm
->isPanning() ? _TxIdPanR2
: _TxIdCanPanR2
;
173 texId
= gm
->isPanning() ? _TxIdPan
: _TxIdCanPan
;
175 drawCursor(texId
, col
, 0);