TrackLabelButton.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * TrackLabelButton.h - class trackLabelButton
  3. *
  4. * Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef TRACK_LABEL_BUTTON_H
  25. #define TRACK_LABEL_BUTTON_H
  26. #include <QToolButton>
  27. #include <QLineEdit>
  28. class TrackView;
  29. class TrackRenameLineEdit;
  30. class TrackLabelButton : public QToolButton
  31. {
  32. Q_OBJECT
  33. public:
  34. TrackLabelButton( TrackView * _tv, QWidget * _parent );
  35. virtual ~TrackLabelButton();
  36. public slots:
  37. void rename();
  38. void renameFinished();
  39. void nameChanged();
  40. protected:
  41. void dragEnterEvent( QDragEnterEvent * _dee ) override;
  42. void dropEvent( QDropEvent * _de ) override;
  43. void mousePressEvent( QMouseEvent * _me ) override;
  44. void mouseDoubleClickEvent( QMouseEvent * _me ) override;
  45. void mouseReleaseEvent( QMouseEvent * _me ) override;
  46. void paintEvent( QPaintEvent * _pe ) override;
  47. void resizeEvent( QResizeEvent * _re ) override;
  48. private:
  49. TrackView * m_trackView;
  50. QString m_iconName;
  51. TrackRenameLineEdit * m_renameLineEdit;
  52. QRect m_buttonRect;
  53. QString elideName( const QString &name );
  54. } ;
  55. #endif