GrabberHandle.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 _GRABBER_HANDLE_HH_
19 #define _GRABBER_HANDLE_HH_
20 
21 #include <vector>
22 #include "gazebo/gui/qt.h"
23 #include "gazebo/util/system.hh"
24 
25 namespace gazebo
26 {
27  namespace gui
28  {
29  class GZ_GUI_BUILDING_VISIBLE GrabberHandle : public QGraphicsItem
30  {
34  public: GrabberHandle(QGraphicsItem *_parent = 0, int index = 0);
35 
38  public: int GetIndex() const;
39 
42  public: int GetMouseState() const;
43 
46  public: QPointF GetCenterPoint() const;
47 
50  public: double GetMouseDownX() const;
51 
54  public: double GetMouseDownY() const;
55 
58  public: double GetWidth() const;
59 
62  public: double GetHeight() const;
63 
66  public: QColor GetColor() const;
67 
70  public: void SetMouseState(int _state);
71 
74  public: void SetMouseDownX(double _x);
75 
78  public: void SetMouseDownY(double _y);
79 
82  public: void SetWidth(double _width);
83 
86  public: void SetHeight(double _height);
87 
90  public: void SetColor(const QColor &_color);
91 
94  public: void SetBorderColor(const QColor &_borderColor);
95 
98  public: virtual QRectF boundingRect() const;
99 
104  private: virtual void paint(QPainter *_painter,
105  const QStyleOptionGraphicsItem *_option, QWidget *_widget);
106 
109  protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *_event);
110 
113  protected: void hoverLeaveEvent(QGraphicsSceneHoverEvent *_event);
114 
117  protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *_event);
118 
121  protected: void mousePressEvent(QGraphicsSceneMouseEvent *_event);
122 
125  protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *_event);
126 
129  protected: void mousePressEvent(QGraphicsSceneDragDropEvent *_event);
130 
133  protected: void mouseMoveEvent(QGraphicsSceneDragDropEvent *_event);
134 
136  public: std::vector<GrabberHandle*> linkedGrabbers;
137 
139  private: int index;
140 
142  private: double mouseDownX;
143 
145  private: double mouseDownY;
146 
148  private: QColor handleColor;
149 
151  private: QColor borderColor;
152 
154  private: double width;
155 
157  private: double height;
158 
160  private: double widthGrabBuffer;
161 
163  private: double heightGrabBuffer;
164 
166  private: int mouseButtonState;
167  };
169  }
170 }
171 
172 #endif
std::vector< GrabberHandle * > linkedGrabbers
A list of grabbers linked to this grabber.
Definition: GrabberHandle.hh:136
Definition: GrabberHandle.hh:29
#define GZ_GUI_BUILDING_VISIBLE
Definition: system.hh:393