ModelRightMenu.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#ifndef _MODELRIGHTMENU_HH_
18#define _MODELRIGHTMENU_HH_
19
20#include <map>
21#include <vector>
22#include <string>
23#include <ignition/transport/Node.hh>
24
26#include "gazebo/gui/qt.h"
28#include "gazebo/msgs/msgs.hh"
30#include "gazebo/util/system.hh"
31
32namespace gazebo
33{
34 namespace gui
35 {
36 class ViewState;
37
40 class GZ_GUI_VISIBLE ModelRightMenu : public QObject
41 {
42 Q_OBJECT
43
47 public: enum EntityTypes {
53 LINK
54 };
55
57 public: ModelRightMenu();
58
60 public: virtual ~ModelRightMenu();
61
64 public: bool Init();
65
71 public: void Run(const std::string &_entityName, const QPoint &_pt,
72 EntityTypes _type = MODEL);
73
75 private slots: void OnMoveTo();
76
78 private slots: void OnFollow();
79
81 private slots: void OnEdit();
82
84 private slots: void OnApplyWrench();
85
88 private slots: void OnDelete(const std::string &_name="");
89
91 // private slots: void OnSnapBelow();
92
96 private: bool OnKeyRelease(const common::KeyEvent &_event);
97
100 private: void OnRequest(ConstRequestPtr &_msg);
101
104 private: void OnWindowMode(const std::string &_mode);
105
107 private: transport::NodePtr node;
108
110 private: transport::SubscriberPtr requestSub;
111
113 private: std::string entityName;
114
116 private: QAction *moveToAct;
117
119 private: QAction *followAct;
120
122 private: QAction *editAct;
123
125 private: QAction *applyWrenchAct;
126
128 private: std::vector<event::ConnectionPtr> connections;
129
131 private: std::string windowMode;
132
135 // private: QAction *snapBelowAct;
136
138 private: std::vector<ViewState*> viewStates;
139
140 // The view state class is a friend for convenience
141 private: friend class ViewState;
142 };
143
147 class GZ_GUI_VISIBLE ViewState : public QObject
148 {
149 Q_OBJECT
150
155 public: ViewState(ModelRightMenu *_parent,
156 const std::string &_checkRequest,
157 const std::string &_uncheckRequest);
158
160 public: std::map<std::string, bool> modelStates;
161
163 public: QAction *action;
164
166 public: bool globalEnable;
167
170
172 public: std::string checkRequest;
173
175 public: std::string uncheckRequest;
176
178 public slots: void Callback();
179
180 // Place ignition::transport objects at the end of this file to
181 // guarantee they are destructed first.
182
184 private: ignition::transport::Node nodeIgn;
185 };
186 }
187}
188#endif
gui
Definition KeyEventHandler.hh:29
Forward declarations for transport.
Generic description of a keyboard event.
Definition KeyEvent.hh:33
Displays a menu when the right mouse button has been pressed.
Definition ModelRightMenu.hh:41
virtual ~ModelRightMenu()
Destructor.
EntityTypes
Unique identifiers for the type of entity this menu is attached to.
Definition ModelRightMenu.hh:47
@ MODEL
Model.
Definition ModelRightMenu.hh:49
@ LINK
Link.
Definition ModelRightMenu.hh:53
@ LIGHT
Light.
Definition ModelRightMenu.hh:51
bool Init()
Initialize the right menu.
void Run(const std::string &_entityName, const QPoint &_pt, EntityTypes _type=MODEL)
Show the right menu.
A class for managing view visualization states.
Definition ModelRightMenu.hh:148
void Callback()
QT callback for the QAction.
QAction * action
Action for this view.
Definition ModelRightMenu.hh:163
std::map< std::string, bool > modelStates
State of all the models for this view.
Definition ModelRightMenu.hh:160
std::string checkRequest
Name of the request to send when checked.
Definition ModelRightMenu.hh:172
bool globalEnable
True if the view visualization is enabled globally.
Definition ModelRightMenu.hh:166
ModelRightMenu * parent
Pointer to the ModelRightMenu.
Definition ModelRightMenu.hh:169
std::string uncheckRequest
Name of the request to send when unchecked.
Definition ModelRightMenu.hh:175
ViewState(ModelRightMenu *_parent, const std::string &_checkRequest, const std::string &_uncheckRequest)
Constructor.
boost::shared_ptr< Subscriber > SubscriberPtr
Definition TransportTypes.hh:53
boost::shared_ptr< Node > NodePtr
Definition TransportTypes.hh:57
Forward declarations for the common classes.
Definition Animation.hh:27