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.

32 lines
572B

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