RotateHandle.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _ROTATE_HANDLE_HH_
19 #define _ROTATE_HANDLE_HH_
20 
21 #include "gazebo/gui/qt.h"
22 #include "gazebo/util/system.hh"
23 
24 namespace gazebo
25 {
26  namespace gui
27  {
30 
33  class GZ_GUI_BUILDING_VISIBLE RotateHandle : public QGraphicsItem
34  {
37  public: RotateHandle(QGraphicsItem *_parent = 0);
38 
40  public: ~RotateHandle();
41 
43  public: void SetMouseState(int _state);
44 
46  public: int GetMouseState() const;
47 
50  public: double GetMouseDownX() const;
51 
54  public: double GetMouseDownY() const;
55 
58  public: void SetMouseDownX(double _x);
59 
62  public: void SetMouseDownY(double _y);
63 
66  protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *_event);
67 
70  protected: void hoverLeaveEvent(QGraphicsSceneHoverEvent *_event);
71 
74  protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *_event);
75 
78  protected: void mousePressEvent(QGraphicsSceneMouseEvent *_event);
79 
82  protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *_event);
83 
86  public: virtual QRectF boundingRect() const;
87 
92  private: void paint(QPainter *_painter,
93  const QStyleOptionGraphicsItem *_option, QWidget *_widget);
94 
96  private: int mouseButtonState;
97 
99  private: double mouseDownX;
100 
102  private: double mouseDownY;
103 
105  private: QColor borderColor;
106 
108  private: double handleSize;
109 
111  private: double handleOffsetHeight;
112 
114  private: QPointF origin;
115 
117  private: QPointF handleOffset;
118  };
120  }
121 }
122 
123 #endif
Handle for rotating an editor item.
Definition: RotateHandle.hh:33
#define GZ_GUI_BUILDING_VISIBLE
Definition: system.hh:393