diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/skin/widgets/spanbar.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Wasabi/api/skin/widgets/spanbar.cpp')
-rw-r--r-- | Src/Wasabi/api/skin/widgets/spanbar.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Src/Wasabi/api/skin/widgets/spanbar.cpp b/Src/Wasabi/api/skin/widgets/spanbar.cpp new file mode 100644 index 00000000..b377f88e --- /dev/null +++ b/Src/Wasabi/api/skin/widgets/spanbar.cpp @@ -0,0 +1,58 @@ +#include <precomp.h> +#include "spanbar.h" +#include <api/core/api_core.h> + +const wchar_t panBarXuiStr[] = L"PanBar"; // This is the xml tag +char panBarXuiSvcName[] = "PanBar xui object"; // this is the name of the xuiservice + + +#define SPANBAR_NOTIFY_MSG NUM_NOTIFY_MESSAGES+0x1000 + +SPanBar::SPanBar() { + setDrawOnBorders(TRUE); + setEnable(TRUE); + setHotPosition(127); + locked = 0; +} + +SPanBar::~SPanBar() { + WASABI_API_MEDIACORE->core_delCallback(0, this); +} + +int SPanBar::onInit() { + SPANBAR_PARENT::onInit(); + + corecb_onPanChange(WASABI_API_MEDIACORE->core_getPan(0)); + WASABI_API_MEDIACORE->core_addCallback(0, this); + + return 1; +} + +int SPanBar::onSetPosition() { + setHotPosition((Std::keyDown(VK_SHIFT) ? -1 : 127)); + SPANBAR_PARENT::onSetPosition(); + int pos = getSliderPosition(); // get slider pos + int p=pos-127; + WASABI_API_MEDIACORE->core_setPan(0,p); + return 1; +} + +int SPanBar::corecb_onPanChange(int newpan) { + if (getSeekStatus()) return 0; + int pos = newpan+127; + setPosition(pos,0); + onPostedPosition(pos); + return 0; +} + +void SPanBar::lock() { + if (locked) return; + locked = 1; + WASABI_API_MEDIACORE->core_delCallback(0, this); +} + +void SPanBar::unlock() { + if (!locked) return; + locked = 0; + WASABI_API_MEDIACORE->core_addCallback(0, this); +}
\ No newline at end of file |