##

VariablePillContainer.hh
Go to the documentation of this file.
/*
* Copyright (C) 2016 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_GUI_PLOT_VARIABLE_PILL_CONTAINER_HH_
#define GAZEBO_GUI_PLOT_VARIABLE_PILL_CONTAINER_HH_
#include <memory>
#include <string>
#include "gazebo/gui/qt.h"
#include "gazebo/gui/plot/VariablePill.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace gui
{
// Forward declare private data class
class VariablePillContainerPrivate;
class VariablePill;
class GZ_GUI_VISIBLE VariablePillContainer : public QWidget
{
Q_OBJECT
public: explicit VariablePillContainer(QWidget *_parent = nullptr);
public: virtual ~VariablePillContainer();
public: void SetText(const std::string &_text);
public: std::string Text() const;
public: void SetMaxSize(const int _max);
public: int MaxSize() const;
public: void SetVariablePillLabel(const unsigned int _id,
const std::string &_text);
public: unsigned int AddVariablePill(const std::string &_name,
const unsigned int _targetId = VariablePill::EmptyVariable);
public: void AddVariablePill(VariablePill *_variable,
const unsigned int _targetId = VariablePill::EmptyVariable);
public: void RemoveVariablePill(VariablePill *_variable);
public: void RemoveVariablePill(const unsigned int _id);
public: unsigned int VariablePillCount() const;
public: VariablePill *GetVariablePill(const unsigned int _id) const;
public: void SetSelected(VariablePill *_variable);
protected: void dragEnterEvent(QDragEnterEvent *_evt);
protected: void dropEvent(QDropEvent *_evt);
protected: virtual void keyPressEvent(QKeyEvent *_event);
protected: void mouseReleaseEvent(QMouseEvent *_event);
private: bool IsDragValid(QDropEvent *_evt) const;
Q_SIGNALS: void VariableAdded(const unsigned int _id,
const std::string &_name, const unsigned int _targetId);
Q_SIGNALS: void VariableRemoved(const unsigned int _id,
const unsigned int _targetId);
Q_SIGNALS: void VariableMoved(const unsigned int _id,
const unsigned int _targetId);
Q_SIGNALS: void VariableLabelChanged(const unsigned int _id,
const std::string &_label);
private slots: void OnAddVariable(const unsigned int _id,
const std::string &_label);
private slots: void OnRemoveVariable(const unsigned int _id);
private slots: void OnMoveVariable(const unsigned int _id);
private slots: void OnSetVariableLabel(const std::string &_label);
private: std::unique_ptr<VariablePillContainerPrivate> dataPtr;
};
}
}
#endif
gazebo::gui::VariablePillContainer::VariableAdded
void VariableAdded(const unsigned int _id, const std::string &_name, const unsigned int _targetId)
Qt signal emitted when a variable is added to the container.
gazebo::gui::VariablePillContainer::SetVariablePillLabel
void SetVariablePillLabel(const unsigned int _id, const std::string &_text)
Set the label text for a variable pill in this container.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
gazebo::gui::VariablePillContainer
A container for holding variable pills.
Definition: VariablePillContainer.hh:37
gazebo::gui::VariablePillContainer::Text
std::string Text() const
Get the variable pill container's label text.
system.hh
gazebo::gui::VariablePillContainer::SetText
void SetText(const std::string &_text)
Set the label text for this variable pill container.
gazebo::gui::VariablePillContainer::~VariablePillContainer
virtual ~VariablePillContainer()
Destructor.
gazebo::gui::VariablePillContainer::SetSelected
void SetSelected(VariablePill *_variable)
Set the selected state of a variable pill.
gazebo::gui::VariablePillContainer::GetVariablePill
VariablePill * GetVariablePill(const unsigned int _id) const
Get a variable pill by id.
gazebo::gui::VariablePill::EmptyVariable
static const unsigned int EmptyVariable
Empty variable id used to indicate non-existent variable.
Definition: VariablePill.hh:169
gazebo::gui::VariablePillContainer::VariableMoved
void VariableMoved(const unsigned int _id, const unsigned int _targetId)
Qt signal emitted when a variable is moved into the container.
gazebo::gui::VariablePillContainer::AddVariablePill
unsigned int AddVariablePill(const std::string &_name, const unsigned int _targetId=VariablePill::EmptyVariable)
Add a new variable pill to a multi-variable pill in the container.
gazebo::gui::VariablePillContainer::VariablePillContainer
VariablePillContainer(QWidget *_parent=nullptr)
Constructor.
gazebo::gui::VariablePillContainer::MaxSize
int MaxSize() const
Get the maximum number of variable pills this container can hold.
gazebo::gui::VariablePillContainer::VariableLabelChanged
void VariableLabelChanged(const unsigned int _id, const std::string &_label)
Qt signal emitted when a variable label has changed.
gazebo::gui::VariablePill
A variable pill.
Definition: VariablePill.hh:40
gazebo::gui::VariablePillContainer::dropEvent
void dropEvent(QDropEvent *_evt)
Used to accept drop events.
gazebo::gui::VariablePillContainer::keyPressEvent
virtual void keyPressEvent(QKeyEvent *_event)
Qt callback when a key is pressed.
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::VariablePillContainer::SetMaxSize
void SetMaxSize(const int _max)
Set the maximum number of variable pills this container can hold.
gazebo::gui::VariablePillContainer::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *_event)
Qt callback when the mouse is released.
gazebo::gui::VariablePillContainer::VariableRemoved
void VariableRemoved(const unsigned int _id, const unsigned int _targetId)
Qt signal emitted when a variable is removed from the container.
gazebo::gui::VariablePillContainer::RemoveVariablePill
void RemoveVariablePill(VariablePill *_variable)
Remove a variable pill from the container.
gazebo::gui::VariablePillContainer::VariablePillCount
unsigned int VariablePillCount() const
Get the number of child variable pills.
VariablePill.hh
gazebo::gui::VariablePillContainer::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *_evt)
Used to accept drag enter events.