X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fselectableitem.cpp;h=6921f19a71c27b02d2ecaaa5dc2abaf39fea3a87;hb=650e2e5fd465119615b9b969d15cc9fb11f18aa4;hp=31c45ef3b166fa9ff4f85894edc304d761b1ad72;hpb=9b6378f147671e62f57887d51d01864d20e01475;p=pulseview.git diff --git a/pv/view/selectableitem.cpp b/pv/view/selectableitem.cpp index 31c45ef3..6921f19a 100644 --- a/pv/view/selectableitem.cpp +++ b/pv/view/selectableitem.cpp @@ -18,7 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "selectableitem.h" +#include "selectableitem.hpp" + +#include #include #include @@ -30,27 +32,52 @@ namespace view { const int SelectableItem::HighlightRadius = 6; SelectableItem::SelectableItem() : - _context_parent(NULL), - _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; + context_parent_ = parent; return new QMenu(parent); } +void SelectableItem::delete_pressed() +{ +} + QPen SelectableItem::highlight_pen() { return QPen(QApplication::palette().brush( @@ -58,5 +85,10 @@ QPen SelectableItem::highlight_pen() Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } +QColor SelectableItem::select_text_colour(QColor background) +{ + return (background.lightness() > 64) ? Qt::black : Qt::white; +} + } // namespace view } // namespace pv