aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/skin/widgets/svolbar.cpp
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/skin/widgets/svolbar.cpp
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/skin/widgets/svolbar.cpp')
-rw-r--r--Src/Wasabi/api/skin/widgets/svolbar.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/Src/Wasabi/api/skin/widgets/svolbar.cpp b/Src/Wasabi/api/skin/widgets/svolbar.cpp
new file mode 100644
index 00000000..5152224a
--- /dev/null
+++ b/Src/Wasabi/api/skin/widgets/svolbar.cpp
@@ -0,0 +1,55 @@
+#include <precomp.h>
+#include "svolbar.h"
+#include <api/core/api_core.h>
+
+const wchar_t volBarXuiStr[] = L"VolBar"; // This is the xml tag
+char volBarXuiSvcName[] = "VolBar xui object"; // this is the name of the xuiservice
+
+
+#define SVOLBAR_NOTIFY_MSG NUM_NOTIFY_MESSAGES+0x1000
+
+SVolBar::SVolBar() {
+ setDrawOnBorders(TRUE);
+ setEnable(TRUE);
+ locked = 0;
+ setLimits(0,255);
+}
+
+SVolBar::~SVolBar() {
+ WASABI_API_MEDIACORE->core_delCallback(0, this);
+}
+
+int SVolBar::onInit() {
+ SVOLBAR_PARENT::onInit();
+
+ corecb_onVolumeChange(WASABI_API_MEDIACORE->core_getVolume(0));
+ WASABI_API_MEDIACORE->core_addCallback(0, this);
+
+ return 1;
+}
+
+int SVolBar::onSetPosition() {
+ SVOLBAR_PARENT::onSetPosition();
+ int pos = getSliderPosition(); // get slider pos
+ WASABI_API_MEDIACORE->core_setVolume(0,pos);
+ return 1;
+}
+
+int SVolBar::corecb_onVolumeChange(int newvol) {
+ if (getSeekStatus()) return 0;
+ setPosition(newvol, 0);
+ onPostedPosition(newvol);
+ return 0;
+}
+
+void SVolBar::lock() {
+ if (locked) return;
+ locked = 1;
+ WASABI_API_MEDIACORE->core_delCallback(0, this);
+}
+
+void SVolBar::unlock() {
+ if (!locked) return;
+ locked = 0;
+ WASABI_API_MEDIACORE->core_addCallback(0, this);
+} \ No newline at end of file