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.

33 lines
730B

  1. #pragma once
  2. #include <widget/OpaqueWidget.hpp>
  3. #include <ui/common.hpp>
  4. #include <Quantity.hpp>
  5. namespace rack {
  6. namespace ui {
  7. /** A clickable button with text.
  8. Dispatches Action event when clicked.
  9. If quantity is set, its value is set to 1.0 when pressed, 0.0 when released.
  10. If text is not set, the quantity label is used.
  11. */
  12. struct Button : widget::OpaqueWidget {
  13. std::string text;
  14. /** Not owned. Tracks the pressed state of the button.*/
  15. Quantity* quantity = NULL;
  16. Button();
  17. void draw(const DrawArgs& args) override;
  18. void onDragStart(const DragStartEvent& e) override;
  19. void onDragEnd(const DragEndEvent& e) override;
  20. void onDragDrop(const DragDropEvent& e) override;
  21. };
  22. } // namespace ui
  23. } // namespace rack