X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fviewwidget.hpp;h=02c842a84b8f592cdbb340b66e012df568468b85;hp=b6b1a5b48ec99a8166ba426c03f8425d43437578;hb=6f925ba9d6faf1077b73c5a5808259576081716a;hpb=c9743553584975b338890c16ef22943d7beaacdd diff --git a/pv/view/viewwidget.hpp b/pv/view/viewwidget.hpp index b6b1a5b..02c842a 100644 --- a/pv/view/viewwidget.hpp +++ b/pv/view/viewwidget.hpp @@ -14,21 +14,24 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ -#ifndef PULSEVIEW_PV_VIEWWIDGET_H -#define PULSEVIEW_PV_VIEWWIDGET_H +#ifndef PULSEVIEW_PV_VIEWWIDGET_HPP +#define PULSEVIEW_PV_VIEWWIDGET_HPP #include #include +using std::shared_ptr; +using std::vector; + class QTouchEvent; namespace pv { -namespace view { +namespace views { +namespace TraceView { class View; class ViewItem; @@ -40,13 +43,20 @@ 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 shared_ptr &item); + /** * Indicates the event an a view item has been clicked. * @param item the view item that has been clicked. * @remarks the default implementation does nothing. */ - virtual void item_clicked( - const std::shared_ptr &item); + virtual void item_clicked(const shared_ptr &item); /** * Returns true if the selection of row items allows dragging. @@ -65,10 +75,27 @@ 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. */ - virtual std::vector< std::shared_ptr > items() = 0; + virtual vector< shared_ptr > items() = 0; /** * Gets the first view item which has a hit-box that contains @c pt . @@ -76,8 +103,7 @@ protected: * @return the view item that has been found, or and empty * @c shared_ptr if no item was found. */ - virtual std::shared_ptr get_mouse_over_item( - const QPoint &pt) = 0; + virtual shared_ptr get_mouse_over_item(const QPoint &pt) = 0; /** * Handles left mouse button press events. @@ -95,12 +121,12 @@ protected: * Handles touch begin update and end events. * @param e the event that triggered this handler. */ - virtual bool touch_event(QTouchEvent *e); + virtual bool touch_event(QTouchEvent *event); protected: bool event(QEvent *event); - void mousePressEvent(QMouseEvent * event); + void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); @@ -113,14 +139,15 @@ Q_SIGNALS: void selection_changed(); protected: - pv::view::View &view_; + pv::views::TraceView::View &view_; QPoint mouse_point_; QPoint mouse_down_point_; - std::shared_ptr mouse_down_item_; + shared_ptr mouse_down_item_; bool item_dragging_; }; -} // namespace view +} // namespace TraceView +} // namespace views } // namespace pv -#endif // PULSEVIEW_PV_VIEWWIDGET_H +#endif // PULSEVIEW_PV_VIEWWIDGET_HPP