timeline_ruler.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* timeline_ruler.h - timeline ruler
  2. * Copyright (C) 2017 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef STUDIO_WIDGETS_TIMELINE_RULER_H_B185C2D9_8188_5868_8357_1F76BAB68C4F
  18. #define STUDIO_WIDGETS_TIMELINE_RULER_H_B185C2D9_8188_5868_8357_1F76BAB68C4F
  19. #include <QWidget>
  20. #include <QPen>
  21. #include <generic/context_listener.h>
  22. namespace rainynite::studio {
  23. class TimelineRuler : public QWidget, public ContextListener {
  24. public:
  25. explicit TimelineRuler(QWidget* parent = nullptr);
  26. public:
  27. QSize sizeHint() const override;
  28. protected:
  29. void paintEvent(QPaintEvent* event) override;
  30. void mousePressEvent(QMouseEvent* event) override;
  31. void mouseMoveEvent(QMouseEvent* event) override;
  32. public:
  33. void set_scroll(int end_pos_);
  34. void set_zoom(double step_);
  35. private:
  36. QBrush brush;
  37. QPen pen;
  38. QPen bold_pen;
  39. private:
  40. double step = 1;
  41. int zero_pos = 0;
  42. };
  43. } // namespace rainynite::studio
  44. #endif