#pragma once // Spec: INV-social 20 (EmojiPicker). Browse mode: optional Recent section plus 9 categories in a scroll view, a // category bar at the bottom that scrolls to a section; search mode: Unicode name substring match. // // void presentEmojiPicker(ui::Rect anchor, std::function onPick); // sheet, closes on pick // ViewPtr EmojiPickerView(std::shared_ptr, onPick, onDismiss) // the body only // // Every pick is reported to onPick and recorded with SettingsStore::recordEmojiPick (max 30 recents). // DIFF: category bar scrolling jumps (no animation); the search field sits under the navigation bar. #include #include #include #include #include "ui/Navigation.hpp" namespace dp { // State that must survive the per-frame rebuild. struct EmojiPickerModel { std::string search; std::vector sectionOffsets; // y of each section in the scroll content, filled while building std::vector sectionIds; bool dismissOnPick = true; }; // Pure layout helpers (unit tested). struct EmojiPickerMetrics { static int columnCount(float width); // max(1, Int((width - 16 + 4) / 48)) static float sectionHeight(std::size_t emojiCount, int columns); }; ui::ViewPtr EmojiPickerView(std::shared_ptr model, std::function onPick, std::function onDismiss); class EmojiPickerScreen : public ui::Screen { public: explicit EmojiPickerScreen(std::function onPick, bool dismissOnPick = true); ui::ViewPtr body() override; std::string title() const override { return ""; } TitleMode titleMode() const override { return TitleMode::Inline; } ui::ViewPtr toolbarLeading() override; private: std::function onPick_; std::shared_ptr model_; }; void presentEmojiPicker(ui::Rect anchor, std::function onPick); } // namespace dp