From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Wasabi/api/wnd/wndclass/tooltip.cpp | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Src/Wasabi/api/wnd/wndclass/tooltip.cpp (limited to 'Src/Wasabi/api/wnd/wndclass/tooltip.cpp') 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 +#include "./api.h" +#include +#include "tooltip.h" + +#ifdef WASABI_COMPILE_CONFIG +#include +#include +#endif +#include + +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(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 -- cgit