Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / interface_v3 / view_pointer_ryzom.cpp
blob653e2351e7ca916edb64559906312905b14b22c5
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 //
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/>.
20 #include "stdpch.h"
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 &param ) :
37 CViewPointer( param )
41 CViewPointerRyzom::~CViewPointerRyzom()
45 void CViewPointerRyzom::forceLinking()
49 // --------------------------------------------------------------------------------------------------------------------
50 bool CViewPointerRyzom::drawResizer(CCtrlBase* pCB, CRGBA col)
52 CCtrlResizer *pCR = dynamic_cast<CCtrlResizer*>(pCB);
53 if (pCR != NULL)
55 CGroupContainer *parent = dynamic_cast<CGroupContainer *>(pCR->getParent());
56 if (parent && !parent->isLocked())
58 sint32 texID= -1;
59 switch(pCR->getRealResizerPos())
61 case Hotspot_BR:
62 case Hotspot_TL:
63 texID = _TxIdResizeBRTL;
64 break;
65 case Hotspot_BL:
66 case Hotspot_TR:
67 texID = _TxIdResizeBLTR;
68 break;
69 case Hotspot_MR:
70 case Hotspot_ML:
71 texID = _TxIdResizeLR;
72 break;
73 case Hotspot_TM:
74 case Hotspot_BM:
75 texID = _TxIdResizeTB;
76 break;
77 default:
78 return false;
79 break;
81 drawCursor(texID, col, false);
82 return true;
85 return false;
88 // --------------------------------------------------------------------------------------------------------------------
89 bool CViewPointerRyzom::drawRotate (CCtrlBase* pCB, CRGBA col)
91 CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene *>(pCB);
92 if (pI3DS != NULL)
94 drawCursor(_TxIdRotate, col, 0);
95 return true;
97 return false;
100 // --------------------------------------------------------------------------------------------------------------------
101 bool CViewPointerRyzom::drawScale (CCtrlBase* pCB, CRGBA col)
103 CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene *>(pCB);
104 if (pI3DS != NULL)
106 drawCursor(_TxIdScale, col, 0);
107 return true;
109 return false;
112 // --------------------------------------------------------------------------------------------------------------------
113 bool CViewPointerRyzom::drawColorPicker (CCtrlBase* pCB, CRGBA col)
115 CCtrlColPick *pCCP = dynamic_cast<CCtrlColPick*>(pCB);
116 if (pCCP != NULL)
118 drawCursor(_TxIdColPick, col, 0);
119 return true;
121 return false;
124 // --------------------------------------------------------------------------------------------------------------------
125 bool CViewPointerRyzom::drawLink (CCtrlBase* pCB, CRGBA col)
127 CCtrlLink *pCCP = dynamic_cast<CCtrlLink*>(pCB);
128 if (pCCP != NULL)
130 drawCursor(_TxIdColPick, col, 0);
131 return true;
133 return false;
136 // --------------------------------------------------------------------------------------------------------------------
137 bool CViewPointerRyzom::drawBrowse (CCtrlBase* pCB, CRGBA col)
139 CGroupHTML *pCGH = dynamic_cast<CGroupHTML *>(pCB);
140 if (pCGH != NULL)
142 if (pCGH->isBrowsing())
144 static uint8 rot =0;
145 drawCursor(_TxIdRotate, col, rot>>3);
146 rot = (rot+1) & 0x1f;
147 return true;
150 return false;
153 // --------------------------------------------------------------------------------------------------------------------
154 bool CViewPointerRyzom::drawPan(CCtrlBase* pCB, NLMISC::CRGBA col)
156 CGroupMap *gm = dynamic_cast<CGroupMap *>(pCB);
157 if (gm)
159 sint32 texId;
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;
169 else return false;
171 else
173 texId = gm->isPanning() ? _TxIdPan : _TxIdCanPan;
175 drawCursor(texId, col, 0);
176 return true;
178 return false;