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.

34 lines
495B

  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() {
  7. state = BND_HOVER;
  8. }
  9. void Button::onMouseLeave() {
  10. state = BND_DEFAULT;
  11. }
  12. void Button::onDragStart() {
  13. state = BND_ACTIVE;
  14. }
  15. void Button::onDragEnd() {
  16. state = BND_HOVER;
  17. }
  18. void Button::onDragDrop(Widget *origin) {
  19. if (origin == this) {
  20. onAction();
  21. }
  22. }
  23. } // namespace rack