#pragma once #include "OLEDDisplay.h" #include "OLEDDisplayUi.h" #include "graphics/emotes.h" #include #include namespace graphics { namespace MessageRenderer { // === Thread filter modes === enum class ThreadMode { ALL, CHANNEL, DIRECT }; // Setter for switching thread mode void setThreadMode(ThreadMode mode, int channel = -1, uint32_t peer = 0); // Getter for current mode ThreadMode getThreadMode(); // Getter for current channel (valid if mode == CHANNEL) int getThreadChannel(); // Getter for current peer (valid if mode == DIRECT) uint32_t getThreadPeer(); // --- Registry accessors for menuHandler --- const std::vector &getSeenChannels(); const std::vector &getSeenPeers(); void clearThreadRegistries(); // Text and emote rendering void drawStringWithEmotes(OLEDDisplay *display, int x, int y, const std::string &line, const Emote *emotes, int emoteCount); /// Draws the text message frame for displaying received messages void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); // Function to generate lines with word wrapping std::vector generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth); // Function to calculate heights for each line std::vector calculateLineHeights(const std::vector &lines, const Emote *emotes); // Function to render the message content void renderMessageContent(OLEDDisplay *display, const std::vector &lines, const std::vector &rowHeights, int x, int yOffset, int scrollBottom, const Emote *emotes, int numEmotes, bool isInverted, bool isBold); // Reset scroll state when new messages arrive void resetScrollState(); } // namespace MessageRenderer } // namespace graphics