X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fselectableitem.hpp;h=b61c54d6430bebd04c575a2ee3e101285e9ee34e;hb=7ddb8da6cae27c619644cd26cfbf8263d286f7a1;hp=36ff0dbcd48a95adf8626aefe751185adb1c39f7;hpb=2acdb232d6bb452cfdfaea3ef5218fb4da592329;p=pulseview.git diff --git a/pv/view/selectableitem.hpp b/pv/view/selectableitem.hpp index 36ff0dbc..b61c54d6 100644 --- a/pv/view/selectableitem.hpp +++ b/pv/view/selectableitem.hpp @@ -48,6 +48,11 @@ public: SelectableItem(); public: + /** + * Returns true if the item is visible and enabled. + */ + virtual bool enabled() const = 0; + /** * Returns true if the item has been selected by the user. */ @@ -83,6 +88,22 @@ public: */ virtual QPoint point() const = 0; + /** + * Computes the outline rectangle of a label. + * @param rect the rectangle of the header area. + * @return Returns the rectangle of the signal label. + */ + virtual QRectF label_rect(const QRectF &rect) const = 0; + +public: + /** + * Gets the text colour. + * @remarks This colour is computed by comparing the lightness + * of the trace colour against a threshold to determine whether + * white or black would be more visible. + */ + static QColor select_text_colour(QColor background); + public: virtual QMenu* create_context_menu(QWidget *parent);