diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/wnd/wndclass/tooltip.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/wnd/wndclass/tooltip.cpp')
-rw-r--r-- | Src/Wasabi/api/wnd/wndclass/tooltip.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Src/Wasabi/api/wnd/wndclass/tooltip.cpp b/Src/Wasabi/api/wnd/wndclass/tooltip.cpp new file mode 100644 index 00000000..a619ab45 --- /dev/null +++ b/Src/Wasabi/api/wnd/wndclass/tooltip.cpp @@ -0,0 +1,47 @@ +//#include <precomp.h> +#include "./api.h" +#include <api/wnd/api_wnd.h> +#include "tooltip.h" + +#ifdef WASABI_COMPILE_CONFIG +#include <api/config/items/attrint.h> +#include <api/config/items/cfgitem.h> +#endif +#include <api/service/svc_enum.h> + +Tooltip::Tooltip(const wchar_t *txt) +{ + WASABI_API_WND->appdeactivation_push_disallow(NULL); + svc = NULL; + + if (!txt || !*txt) return ; + +#ifdef WASABI_COMPILE_CONFIG + // {9149C445-3C30-4e04-8433-5A518ED0FDDE} + const GUID uioptions_guid = + { 0x9149c445, 0x3c30, 0x4e04, { 0x84, 0x33, 0x5a, 0x51, 0x8e, 0xd0, 0xfd, 0xde } }; + if (!_intVal(WASABI_API_CONFIG->config_getCfgItemByGuid(uioptions_guid), L"Enable tooltips")) + { + // tooltips disabled + return ; + } +#endif + + waServiceFactory *svf = WASABI_API_SVC->service_enumService(WaSvc::TOOLTIPSRENDERER, 0); + svc = castService<svc_toolTipsRenderer>(svf); + + if (!svc) + { + // no tooltips available! + return ; + } + + svc->spawnTooltip(txt); +} + +Tooltip::~Tooltip() +{ + if (svc != NULL) + WASABI_API_SVC->service_release(svc); + WASABI_API_WND->appdeactivation_pop_disallow(NULL); +}
\ No newline at end of file |