Select.js 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. class Select extends UIObject
  2. {
  3. constructor(name)
  4. {
  5. super(name);
  6. this.P5Element = createSelect();
  7. this.setPosition(0, 0);
  8. this.setSize(100, 20);
  9. this.setStyle(DEFAULT_STYLE);
  10. this.connectCallbacks();
  11. this.P5Element.changed(this.onChanged);
  12. }
  13. // Setters
  14. setSelected(value)
  15. {
  16. this.P5Element.selected(value);
  17. }
  18. // Getters
  19. getSelected()
  20. {
  21. return this.P5Element.selected();
  22. }
  23. // Methods
  24. addOption(value)
  25. {
  26. this.P5Element.option(value);
  27. }
  28. // TODO confirm if disable methods really dont exist or if
  29. // something is fucky wooky.
  30. // disableAll()
  31. // {
  32. // this.P5Element.disable();
  33. // }
  34. // disableOption(value)
  35. // {
  36. // this.P5Element.disable(value);
  37. // }
  38. // Callbacks
  39. _onChanged()
  40. {
  41. }
  42. onChanged()
  43. {
  44. this.pandoraObject._onChanged();
  45. }
  46. }