1
0

spanbar.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include <precomp.h>
  2. #include "spanbar.h"
  3. #include <api/core/api_core.h>
  4. const wchar_t panBarXuiStr[] = L"PanBar"; // This is the xml tag
  5. char panBarXuiSvcName[] = "PanBar xui object"; // this is the name of the xuiservice
  6. #define SPANBAR_NOTIFY_MSG NUM_NOTIFY_MESSAGES+0x1000
  7. SPanBar::SPanBar() {
  8. setDrawOnBorders(TRUE);
  9. setEnable(TRUE);
  10. setHotPosition(127);
  11. locked = 0;
  12. }
  13. SPanBar::~SPanBar() {
  14. WASABI_API_MEDIACORE->core_delCallback(0, this);
  15. }
  16. int SPanBar::onInit() {
  17. SPANBAR_PARENT::onInit();
  18. corecb_onPanChange(WASABI_API_MEDIACORE->core_getPan(0));
  19. WASABI_API_MEDIACORE->core_addCallback(0, this);
  20. return 1;
  21. }
  22. int SPanBar::onSetPosition() {
  23. setHotPosition((Std::keyDown(VK_SHIFT) ? -1 : 127));
  24. SPANBAR_PARENT::onSetPosition();
  25. int pos = getSliderPosition(); // get slider pos
  26. int p=pos-127;
  27. WASABI_API_MEDIACORE->core_setPan(0,p);
  28. return 1;
  29. }
  30. int SPanBar::corecb_onPanChange(int newpan) {
  31. if (getSeekStatus()) return 0;
  32. int pos = newpan+127;
  33. setPosition(pos,0);
  34. onPostedPosition(pos);
  35. return 0;
  36. }
  37. void SPanBar::lock() {
  38. if (locked) return;
  39. locked = 1;
  40. WASABI_API_MEDIACORE->core_delCallback(0, this);
  41. }
  42. void SPanBar::unlock() {
  43. if (!locked) return;
  44. locked = 0;
  45. WASABI_API_MEDIACORE->core_addCallback(0, this);
  46. }