You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2KB

  1. #pragma once
  2. #include <app/common.hpp>
  3. #include <ui/ScrollWidget.hpp>
  4. #include <widget/ZoomWidget.hpp>
  5. #include <app/RackWidget.hpp>
  6. namespace rack {
  7. namespace app {
  8. struct RackScrollWidget : ui::ScrollWidget {
  9. struct Internal;
  10. Internal* internal;
  11. widget::ZoomWidget* zoomWidget;
  12. RackWidget* rackWidget;
  13. PRIVATE RackScrollWidget();
  14. PRIVATE ~RackScrollWidget();
  15. void reset();
  16. /** Gets the top-left scroll offset in grid coordinates.
  17. */
  18. math::Vec getGridOffset();
  19. void setGridOffset(math::Vec gridOffset);
  20. float getZoom();
  21. /** Sets the zoom level, with a pivot at the center of the scroll viewport.
  22. */
  23. void setZoom(float zoom);
  24. void setZoom(float zoom, math::Vec pivot);
  25. /** Sets offset and zoom to fit module bounding box to view. */
  26. void zoomToModules();
  27. /** Sets offset and zoom to fit given bound (in module coordinates) to view. */
  28. void zoomToBound(math::Rect bound);
  29. void step() override;
  30. void draw(const DrawArgs& args) override;
  31. void onHoverKey(const HoverKeyEvent& e) override;
  32. void onHoverScroll(const HoverScrollEvent& e) override;
  33. void onHover(const HoverEvent& e) override;
  34. void onButton(const ButtonEvent& e) override;
  35. };
  36. } // namespace app
  37. } // namespace rack