X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fviewitem.hpp;h=77c8665e17522a3d08c3e07f631b866078f21ed6;hb=20c99cfc69d3c7430817abd9a1f810698deb4a18;hp=e1cc20040bd8ab33f3cded664454ebce23835136;hpb=1573bf16ba50d1c023ad3a9ce596f0ab6eaeacff;p=pulseview.git
diff --git a/pv/views/trace/viewitem.hpp b/pv/views/trace/viewitem.hpp
index e1cc2004..77c8665e 100644
--- a/pv/views/trace/viewitem.hpp
+++ b/pv/views/trace/viewitem.hpp
@@ -17,12 +17,14 @@
* along with this program; if not, see .
*/
-#ifndef PULSEVIEW_PV_VIEWITEM_HPP
-#define PULSEVIEW_PV_VIEWITEM_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACE_VIEWITEM_HPP
+#define PULSEVIEW_PV_VIEWS_TRACE_VIEWITEM_HPP
#include
+#include
#include
+#include
#include "viewitempaintparams.hpp"
@@ -52,12 +54,16 @@ public:
public:
ViewItem();
-public:
/**
* Returns true if the item is visible and enabled.
*/
virtual bool enabled() const = 0;
+ /**
+ * Returns true if the item may be selected.
+ */
+ virtual bool is_selectable(QPoint pos) const;
+
/**
* Returns true if the item has been selected by the user.
*/
@@ -71,7 +77,7 @@ public:
/**
* Returns true if the item may be dragged/moved.
*/
- virtual bool is_draggable() const;
+ virtual bool is_draggable(QPoint pos) const;
/**
* Returns true if the item is being dragged.
@@ -98,7 +104,7 @@ public:
* Get the drag point.
* @param rect the rectangle of the widget area.
*/
- virtual QPoint point(const QRect &rect) const = 0;
+ virtual QPoint drag_point(const QRect &rect) const = 0;
/**
* Computes the outline rectangle of a label.
@@ -145,22 +151,31 @@ public:
*/
virtual void paint_fore(QPainter &p, ViewItemPaintParams &pp);
-public:
/**
- * Gets the text colour.
- * @remarks This colour is computed by comparing the lightness
- * of the trace colour against a threshold to determine whether
+ * Gets the text color.
+ * @remarks This color is computed by comparing the lightness
+ * of the trace color against a threshold to determine whether
* white or black would be more visible.
*/
- static QColor select_text_colour(QColor background);
+ static QColor select_text_color(QColor background);
public:
- virtual QMenu* create_context_menu(QWidget *parent);
+ virtual QMenu* create_header_context_menu(QWidget *parent);
+
+ virtual QMenu* create_view_context_menu(QWidget *parent, QPoint &click_pos);
virtual pv::widgets::Popup* create_popup(QWidget *parent);
virtual void delete_pressed();
+ virtual void hover_point_changed(const QPoint &hp);
+
+ /**
+ * Handles left mouse button press events.
+ * @param event the mouse event that triggered this handler.
+ */
+ virtual void mouse_left_press_event(const QMouseEvent* event);
+
protected:
static QPen highlight_pen();
@@ -176,4 +191,4 @@ private:
} // namespace views
} // namespace pv
-#endif // PULSEVIEW_PV_VIEWITEM_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACE_VIEWITEM_HPP