Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef MARKSBAR_H
Toshihiro Shimizu 890ddd
#define MARKSBAR_H
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// Toonz includes
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// Qt includes
Toshihiro Shimizu 890ddd
#include <qframe></qframe>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// MarksBar
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  A MarksBar is a generalized slider with multiple values.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka d1f6c4
class DVAPI MarksBar final : public QFrame {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  int m_min, m_max, m_sortDist;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QVector<int> m_values;</int>
Shinya Kitaoka 120a6e
  QVector<qcolor> m_colors;</qcolor>
Shinya Kitaoka 120a6e
  int m_selectedMark;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool m_markUp;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  MarksBar(QWidget *parent = 0, bool markUp = true);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setRange(int min, int max, int sortDistance = -1);
Shinya Kitaoka 120a6e
  int minimum() const { return m_min; }
Shinya Kitaoka 120a6e
  int maximum() const { return m_max; }
Shinya Kitaoka 120a6e
  int sortDistance() const { return m_sortDist; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  const QVector<int> &values() const { return m_values; }</int>
Shinya Kitaoka 120a6e
  QVector<int> &values() { return m_values; }</int>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  const QVector<qcolor> &colors() const { return m_colors; }</qcolor>
Shinya Kitaoka 120a6e
  QVector<qcolor> &colors() { return m_colors; }</qcolor>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setMarkSide(bool up);
Shinya Kitaoka 120a6e
  bool markSide() const { return m_markUp; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void conformValues(bool preferRollDown = true);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  virtual void drawMark(QPainter &p, int pos, const QColor &color);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int valToPos(int val);
Shinya Kitaoka 120a6e
  int posToVal(int pos);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void paintEvent(QPaintEvent *pe) override;
Shinya Kitaoka 473e70
  void mousePressEvent(QMouseEvent *me) override;
Shinya Kitaoka 473e70
  void mouseMoveEvent(QMouseEvent *me) override;
Shinya Kitaoka 473e70
  void mouseReleaseEvent(QMouseEvent *me) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
signals:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void marksUpdated();
Shinya Kitaoka 120a6e
  void marksReleased();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // MARKSBAR_H