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/skin/feeds/textfeed.h | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Src/Wasabi/api/skin/feeds/textfeed.h (limited to 'Src/Wasabi/api/skin/feeds/textfeed.h') diff --git a/Src/Wasabi/api/skin/feeds/textfeed.h b/Src/Wasabi/api/skin/feeds/textfeed.h new file mode 100644 index 00000000..1c2d9bc1 --- /dev/null +++ b/Src/Wasabi/api/skin/feeds/textfeed.h @@ -0,0 +1,57 @@ +#ifndef _TEXTFEED_H +#define _TEXTFEED_H + +#include +#include +#include +#include +#include +#include +#include + +/** + This is the standard helper class for implementing a textfeed. + Be sure to check out class EzFeed in ezfeed.h, which combines this + class with a service factory. +*/ +class TextFeed : public svc_textFeedI, public DependentI +{ +public: +/** + Call this to register your feeds by id. Make the ids unique! + @see sendFeed() + @ret TRUE if succeeded, FALSE on error (i.e. nonunique id) +*/ + int registerFeed(const wchar_t *feedid, const wchar_t *initial_text=L"", const wchar_t *description=L""); + +/** + Call this to send text into a feed. + @see registerFeed() + @ret TRUE if succeeded, FALSE on error (i.e. feedid not registered) +*/ + int sendFeed(const wchar_t *feedid, const wchar_t *text); + +// Gives the most recently sent text on a feed. + virtual const wchar_t *getFeedText(const wchar_t *feedid); + +// Gives a description for the feed (used by accessibility). + virtual const wchar_t *getFeedDescription(const wchar_t *feedid); + +protected: + virtual api_dependent *getDependencyPtr() { return this; } + virtual void dependent_onRegViewer(api_dependentviewer *viewer, int add); + virtual void *dependent_getInterface(const GUID *classguid); + +/** + Called when someone subscribes to this feed. +*/ + virtual void onRegClient() { } + virtual void onDeregClient() { } + + virtual int hasFeed(const wchar_t *name); + +private: + std::map > feeds; +}; + +#endif -- cgit