Chris@424: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@424: Chris@424: /* Chris@424: Sonic Visualiser Chris@424: An audio file viewer and annotation editor. Chris@424: Centre for Digital Music, Queen Mary, University of London. Chris@424: This file copyright 2008 QMUL. Chris@424: Chris@424: This program is free software; you can redistribute it and/or Chris@424: modify it under the terms of the GNU General Public License as Chris@424: published by the Free Software Foundation; either version 2 of the Chris@424: License, or (at your option) any later version. See the file Chris@424: COPYING included with this distribution for more information. Chris@424: */ Chris@424: Chris@424: #ifndef _SELECTABLE_LABEL_H_ Chris@424: #define _SELECTABLE_LABEL_H_ Chris@424: Chris@424: #include Chris@424: Chris@424: class SelectableLabel : public QLabel Chris@424: { Chris@424: Q_OBJECT Chris@424: Chris@424: public: Chris@424: SelectableLabel(QWidget *parent = 0); Chris@424: virtual ~SelectableLabel(); Chris@424: Chris@424: void setSelectedText(QString); Chris@424: void setUnselectedText(QString); Chris@424: Chris@424: bool isSelected() const { return m_selected; } Chris@424: Chris@424: signals: Chris@424: void selectionChanged(); Chris@424: void doubleClicked(); Chris@424: Chris@424: public slots: Chris@424: void setSelected(bool); Chris@424: void toggle(); Chris@424: Chris@424: protected: Chris@424: virtual void mousePressEvent(QMouseEvent *e); Chris@424: virtual void mouseDoubleClickEvent(QMouseEvent *e); Chris@424: virtual void enterEvent(QEvent *); Chris@424: virtual void leaveEvent(QEvent *); Chris@424: void setupStyle(); Chris@424: QString m_selectedText; Chris@424: QString m_unselectedText; Chris@424: bool m_selected; Chris@424: }; Chris@424: Chris@424: #endif