X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fheader.hpp;h=f12d23ca5852f40a1707301e38b2d4de22910fec;hp=662e19f2ed5027d773d55a1badc9ff7a81a0c48e;hb=2f7982367e8382e05c862de7afc71075ded5f606;hpb=2acdb232d6bb452cfdfaea3ef5218fb4da592329 diff --git a/pv/view/header.hpp b/pv/view/header.hpp index 662e19f2..f12d23ca 100644 --- a/pv/view/header.hpp +++ b/pv/view/header.hpp @@ -32,6 +32,7 @@ namespace view { class RowItem; class View; +class ViewItem; class Header : public MarginWidget { @@ -45,6 +46,13 @@ public: QSize sizeHint() const; + /** + * The extended area that the header widget would like to be sized to. + * @remarks This area is the area specified by sizeHint, extended by + * the area to overlap the viewport. + */ + QSize extended_size_hint() const; + /** * The horizontal offset, relative to the left edge of the widget, * where the arrows of the trace labels end. @@ -52,27 +60,36 @@ public: static const int BaselineOffset; private: - std::shared_ptr get_mouse_over_row_item( + /** + * Gets the row items. + */ + std::vector< std::shared_ptr > items(); + + /** + * Gets the first view item which has a label that contains @c pt . + * @param pt the point to search with. + * @return the view item that has been found, or and empty + * @c shared_ptr if no item was found. + */ + std::shared_ptr get_mouse_over_item( const QPoint &pt); - void clear_selection(); + /** + * Returns true if the selection of row items allows dragging. + * @return Returns true if the drag is acceptable. + */ + bool accept_drag() const; - void show_popup(const std::shared_ptr &item); + /** + * Drag the dragging items by the delta offset. + * @param delta the drag offset in pixels. + */ + void drag_items(const QPoint &delta); private: void paintEvent(QPaintEvent *event); private: - void mouseLeftPressEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent * event); - - void mouseLeftReleaseEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - - void mouseMoveEvent(QMouseEvent *event); - - void leaveEvent(QEvent *event); - void contextMenuEvent(QContextMenuEvent *event); void keyPressEvent(QKeyEvent *e); @@ -86,12 +103,6 @@ private Q_SLOTS: Q_SIGNALS: void signals_moved(); - -private: - QPoint mouse_point_; - QPoint mouse_down_point_; - std::shared_ptr mouse_down_item_; - bool dragging_; }; } // namespace view