X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fviewwidget.hpp;h=e6d2aa60125db71cba6fcb07b79403d4af90d4a7;hp=65434f65e1720913ab2589f3cfd932fe1c873b46;hb=219b3ab99786d31cfbf010b931293c57daedacc9;hpb=1f1edc092680e9182be07a760ad03d00b8c5ca06 diff --git a/pv/view/viewwidget.hpp b/pv/view/viewwidget.hpp index 65434f65..e6d2aa60 100644 --- a/pv/view/viewwidget.hpp +++ b/pv/view/viewwidget.hpp @@ -18,16 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PULSEVIEW_PV_VIEWWIDGET_H -#define PULSEVIEW_PV_VIEWWIDGET_H +#ifndef PULSEVIEW_PV_VIEWWIDGET_HPP +#define PULSEVIEW_PV_VIEWWIDGET_HPP #include #include +class QTouchEvent; + namespace pv { namespace view { +enum ViewType { + TraceView, + TabularDecodeView +}; + class View; class ViewItem; @@ -38,6 +45,15 @@ class ViewWidget : public QWidget protected: ViewWidget(View &parent); + /** + * Indicates when a view item is being hovered over. + * @param item The item that is being hovered over, or @c nullptr + * if no view item is being hovered over. + * @remarks the default implementation does nothing. + */ + virtual void item_hover( + const std::shared_ptr &item); + /** * Indicates the event an a view item has been clicked. * @param item the view item that has been clicked. @@ -63,6 +79,23 @@ protected: */ void drag_items(const QPoint &delta); + /** + * Sets this item into the dragged state. + */ + virtual void drag(); + + /** + * Drag the background by the delta offset. + * @param delta the drag offset in pixels. + * @remarks The default implementation does nothing. + */ + virtual void drag_by(const QPoint &delta); + + /** + * Sets this item into the un-dragged state. + */ + virtual void drag_release(); + /** * Gets the items in the view widget. */ @@ -89,8 +122,16 @@ protected: */ void mouse_left_release_event(QMouseEvent *event); + /** + * Handles touch begin update and end events. + * @param e the event that triggered this handler. + */ + virtual bool touch_event(QTouchEvent *event); + protected: - void mousePressEvent(QMouseEvent * event); + bool event(QEvent *event); + + void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); @@ -113,4 +154,4 @@ protected: } // namespace view } // namespace pv -#endif // PULSEVIEW_PV_VIEWWIDGET_H +#endif // PULSEVIEW_PV_VIEWWIDGET_HPP