Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / r2 / tool_select_move.h
blobd91157011c404894c89550362bfa9bd033184c92
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef R2_TOOL_SELECT_MOVE_H
18 #define R2_TOOL_SELECT_MOVE_H
20 #include "tool_maintained_action.h"
21 #include "auto_group.h"
22 #include "nel/misc/vectord.h"
24 class CEntity;
26 namespace R2
29 /**
30 * Tool to select an element in the scene
31 * If the left button is maintained down, then the selected element is moved
33 class CToolSelectMove : public CToolMaintainedAction
35 public:
36 NLMISC_DECLARE_CLASS(R2::CToolSelectMove);
38 CToolSelectMove();
39 virtual ~CToolSelectMove() {}
40 // fram CTool
41 virtual void updateBeforeRender();
42 protected:
43 // from CTool
44 virtual void onActivate();
45 virtual const char *getToolUIName() const { return "selectMove"; }
46 virtual bool isCreationTool() const { return false; }
47 virtual bool isActionPossibleOn(const CInstance &instance) const;
48 // from CToolMaintainedAction
49 virtual void beginAction(CInstance &instance);
50 virtual void cancelAction(CInstance &instance);
51 virtual void commitAction(CInstance &instance);
52 virtual void updateAction(CInstance &instance);
53 virtual const char *getCursorForPossibleAction() const;
54 virtual const char *getDefaultCursor() const;
55 virtual const char *getPickCursor() const;
56 private:
58 sint32 _MouseX;
59 sint32 _MouseY;
60 NLMISC::CVectorD _StartPos;
61 NLMISC::CVectorD _LastValidPos;
62 NLMISC::CVectorD _FinalPos;
63 NLMISC::CVectorD _DeltaAnchor; // delta pos in world between the point being move and the pos being updated
64 bool _ValidPos;
65 bool _Moved;
66 bool _Duplicating;
67 bool _InitiallyAccessible;
68 bool _InitiallyValidShape;
69 sint32 _DeltaX;
70 sint32 _DeltaY;
71 // tmp tmp
72 sint32 _RefX;
73 sint32 _RefY;
74 sint32 _PosRefX;
75 sint32 _PosRefY;
76 sint32 _MouseRefX;
77 sint32 _MouseRefY;
78 sint64 _StartTime;
79 CInstance::TRefPtr _GhostInstance;
80 CAutoGroup _AutoGroup;
81 private:
82 bool checkAdditionnalRoomLeftFor(CInstance &instance);
83 void setInstancePos(const NLMISC::CVectorD &pos, CInstance &instance);
84 CInstance *createGhost(CInstance &instance);
90 } // R2
92 #endif