GrabberHandle.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 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 GAZEBO_GUI_BUILDING_GRABBERHANDLE_HH_
19#define GAZEBO_GUI_BUILDING_GRABBERHANDLE_HH_
20
21#include <vector>
22#include <memory>
23
24#include <ignition/math/Color.hh>
25#include <ignition/math/Vector2.hh>
26
27#include "gazebo/gui/qt.h"
28
29#include "gazebo/util/system.hh"
30
31namespace gazebo
32{
33 namespace gui
34 {
35 // Forward declare private data class.
36 class GrabberHandlePrivate;
37
38 class GZ_GUI_VISIBLE GrabberHandle : public QGraphicsItem
39 {
43 public: GrabberHandle(QGraphicsItem *_parent = 0, int index = 0);
44
46 public: virtual ~GrabberHandle();
47
50 public: int Index() const;
51
54 public: int MouseState() const;
55
58 public: ignition::math::Vector2d CenterPoint() const;
59
62 public: double MouseDownX() const;
63
66 public: double MouseDownY() const;
69 public: double Width() const;
70
73 public: double Height() const;
74
77 public: ignition::math::Color Color() const;
78
81 public: void SetMouseState(int _state);
82
85 public: void SetMouseDownX(double _x);
86
89 public: void SetMouseDownY(double _y);
90
93 public: void SetWidth(double _width);
94
97 public: void SetHeight(double _height);
98
101 public: void SetColor(const ignition::math::Color &_color);
102
105 public: void SetBorderColor(const ignition::math::Color &_borderColor);
106
109 public: virtual QRectF boundingRect() const;
110
113 public: std::vector<GrabberHandle *> LinkedGrabbers() const;
114
117 public: void PushLinkedGrabber(GrabberHandle *_grabber);
118
121 public: void EraseLinkedGrabber(GrabberHandle *_grabber);
122
127 private: virtual void paint(QPainter *_painter,
128 const QStyleOptionGraphicsItem *_option, QWidget *_widget);
129
132 protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *_event);
133
136 protected: void hoverLeaveEvent(QGraphicsSceneHoverEvent *_event);
137
140 protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *_event);
141
144 protected: void mousePressEvent(QGraphicsSceneMouseEvent *_event);
145
148 protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *_event);
149
152 protected: void mousePressEvent(QGraphicsSceneDragDropEvent *_event);
153
156 protected: void mouseMoveEvent(QGraphicsSceneDragDropEvent *_event);
157
160 private: std::unique_ptr<GrabberHandlePrivate> dataPtr;
161 };
163 }
164}
165
166#endif
gui
Definition KeyEventHandler.hh:29
Definition GrabberHandle.hh:39
void SetBorderColor(const ignition::math::Color &_borderColor)
Set the border color of the grabber handle.
double Height() const
Get the height of the grabber handle.
ignition::math::Color Color() const
Get the fill color of the grabber handle.
GrabberHandle(QGraphicsItem *_parent=0, int index=0)
Constructor.
void SetHeight(double _height)
Set the height of the grabber handle.
virtual QRectF boundingRect() const
Get the bounding box of the grabber handle.
ignition::math::Vector2d CenterPoint() const
Get the center point of the grabber handle.
int MouseState() const
Get the current mouse state.
std::vector< GrabberHandle * > LinkedGrabbers() const
Get the vector of grabbers linked to this.
void mouseMoveEvent(QGraphicsSceneDragDropEvent *_event)
Qt mouse move event during drag and drop.
virtual ~GrabberHandle()
Destructor.
void SetMouseDownX(double _x)
Set the X position of the mouse press.
int Index() const
Get the index of the grabber handle.
void SetColor(const ignition::math::Color &_color)
Set the fill color of the grabber handle.
void PushLinkedGrabber(GrabberHandle *_grabber)
Push a grabber to the list of grabbers linked to this.
void mousePressEvent(QGraphicsSceneDragDropEvent *_event)
Qt mouse press event during drag and drop.
void hoverEnterEvent(QGraphicsSceneHoverEvent *_event)
Qt mouse hover enter event.
double MouseDownY() const
Get the Y position of the mouse press.
void EraseLinkedGrabber(GrabberHandle *_grabber)
Erase a grabber from the list of grabbers linked to this.
void hoverLeaveEvent(QGraphicsSceneHoverEvent *_event)
Qt mouse hover leave event.
void mouseMoveEvent(QGraphicsSceneMouseEvent *_event)
Qt mouse move event.
void SetMouseDownY(double _y)
Set the Y position of the mouse press.
double Width() const
Get the width of the grabber handle.
void mouseReleaseEvent(QGraphicsSceneMouseEvent *_event)
Qt mouse release event.
void mousePressEvent(QGraphicsSceneMouseEvent *_event)
Qt mouse press event.
void SetWidth(double _width)
Set the width of the grabber handle.
void SetMouseState(int _state)
Set the current mouse state.
double MouseDownX() const
Get the X position of the mouse press.
Forward declarations for the common classes.
Definition Animation.hh:27