diff options
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 |