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.

35 lines
597B

  1. #include "widgets.hpp"
  2. namespace rack {
  3. void Button::draw(NVGcontext *vg) {
  4. bndToolButton(vg, 0.0, 0.0, box.size.x, box.size.y, BND_CORNER_NONE, state, -1, text.c_str());
  5. }
  6. void Button::onMouseEnter(EventMouseEnter &e) {
  7. state = BND_HOVER;
  8. }
  9. void Button::onMouseLeave(EventMouseLeave &e) {
  10. state = BND_DEFAULT;
  11. }
  12. void Button::onDragStart(EventDragStart &e) {
  13. state = BND_ACTIVE;
  14. }
  15. void Button::onDragEnd(EventDragEnd &e) {
  16. state = BND_HOVER;
  17. }
  18. void Button::onDragDrop(EventDragDrop &e) {
  19. if (e.origin == this) {
  20. EventAction eAction;
  21. onAction(eAction);
  22. }
  23. }
  24. } // namespace rack