Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / r2 / tool_select_rotate.h
blob00831ecddde7b37745e3220919b9188c7d28047f
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_ROTATE_H
18 #define R2_TOOL_SELECT_ROTATE_H
20 #include "tool_maintained_action.h"
22 namespace R2
25 /**
26 * Tool to select an element in the scene
27 * If the left button is maintained down, then the selected element is moved
29 class CToolSelectRotate : public CToolMaintainedAction
31 public:
32 NLMISC_DECLARE_CLASS(R2::CToolSelectRotate);
34 CToolSelectRotate();
35 // from CTool
36 virtual const char *getToolUIName() const { return "selectRotate"; }
37 virtual bool isCreationTool() const { return false; }
38 virtual bool isActionPossibleOn(const CInstance &instance) const;
39 protected:
40 // from CToolMaintainedAction
41 virtual bool onMouseLeftButtonDown();
42 virtual void beginAction(CInstance &instance);
43 virtual void cancelAction(CInstance &instance);
44 virtual void commitAction(CInstance &instance);
45 virtual void updateAction(CInstance &instance);
46 virtual const char *getCursorForPossibleAction() const { return "r2ed_tool_can_rotate.tga"; }
47 private:
48 float _StartAngle;
49 sint32 _MouseStartX;
50 private:
51 void setRotateInProgress(bool rotateInProgress, CInstance &instance);
52 // get orientation of an entity (in radians)
53 static float getEntityAngle(CEntityCL &entity);
54 // set orientation of an entity (in radians)
55 static void setEntityAngle(CEntityCL &entity, CInstance &instance, float angle);
62 } // R2
64 #endif