X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fselectableitem.cpp;h=b699005f4374a1e2bce16ecd872f033ae691c9ee;hb=f69678269730c1e0ee8319fba774a98043fec0e8;hp=517b6879120c2b71f34670df4a23b1caa154cae0;hpb=f1283456ae0859990ccd914f8c147064345df13f;p=pulseview.git diff --git a/pv/view/selectableitem.cpp b/pv/view/selectableitem.cpp index 517b6879..b699005f 100644 --- a/pv/view/selectableitem.cpp +++ b/pv/view/selectableitem.cpp @@ -18,24 +18,71 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "selectableitem.h" +#include "selectableitem.hpp" + +#include + +#include +#include +#include namespace pv { namespace view { +const int SelectableItem::HighlightRadius = 6; + SelectableItem::SelectableItem() : - _selected(false) + context_parent_(NULL), + selected_(false), + drag_point_(INT_MIN, INT_MIN) { } bool SelectableItem::selected() const { - return _selected; + return selected_; } void SelectableItem::select(bool select) { - _selected = select; + selected_ = select; +} + +bool SelectableItem::dragging() const +{ + return drag_point_.x() != INT_MIN && drag_point_.y() != INT_MIN; +} + +QPoint SelectableItem::drag_point() const +{ + return drag_point_; +} + +void SelectableItem::drag() +{ + drag_point_ = point(); +} + +void SelectableItem::drag_release() +{ + drag_point_ = QPoint(INT_MIN, INT_MIN); +} + +QMenu* SelectableItem::create_context_menu(QWidget *parent) +{ + context_parent_ = parent; + return new QMenu(parent); +} + +void SelectableItem::delete_pressed() +{ +} + +QPen SelectableItem::highlight_pen() +{ + return QPen(QApplication::palette().brush( + QPalette::Highlight), HighlightRadius, + Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } } // namespace view