All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GrabberHandle.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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 "gazebo/gui/qt.h"
22 #include "gazebo/util/system.hh"
23 
24 namespace gazebo
25 {
26  namespace gui
27  {
28  class GAZEBO_VISIBLE GrabberHandle : public QGraphicsItem
29  {
33  public: GrabberHandle(QGraphicsItem *_parent = 0, int index = 0);
34 
37  public: int GetIndex() const;
38 
41  public: int GetMouseState() const;
42 
45  public: QPointF GetCenterPoint() const;
46 
49  public: double GetMouseDownX() const;
50 
53  public: double GetMouseDownY() const;
54 
57  public: double GetWidth() const;
58 
61  public: double GetHeight() const;
62 
65  public: QColor GetColor() const;
66 
69  public: void SetMouseState(int _state);
70 
73  public: void SetMouseDownX(double _x);
74 
77  public: void SetMouseDownY(double _y);
78 
81  public: void SetWidth(double _width);
82 
85  public: void SetHeight(double _height);
86 
89  public: void SetColor(const QColor &_color);
90 
93  public: void SetBorderColor(const QColor &_borderColor);
94 
97  public: virtual QRectF boundingRect() const;
98 
103  private: virtual void paint(QPainter *_painter,
104  const QStyleOptionGraphicsItem *_option, QWidget *_widget);
105 
108  protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *_event);
109 
112  protected: void hoverLeaveEvent(QGraphicsSceneHoverEvent *_event);
113 
116  protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *_event);
117 
120  protected: void mousePressEvent(QGraphicsSceneMouseEvent *_event);
121 
124  protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *_event);
125 
128  protected: void mousePressEvent(QGraphicsSceneDragDropEvent *_event);
129 
132  protected: void mouseMoveEvent(QGraphicsSceneDragDropEvent *_event);
133 
135  private: int index;
136 
138  private: double mouseDownX;
139 
141  private: double mouseDownY;
142 
144  private: QColor handleColor;
145 
147  private: QColor borderColor;
148 
150  private: double width;
151 
153  private: double height;
154 
156  private: double widthGrabBuffer;
157 
159  private: double heightGrabBuffer;
160 
162  private: int mouseButtonState;
163  };
165  }
166 }
167 
168 #endif
Definition: GrabberHandle.hh:28
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48