1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 */ 9 10 #pragma once 11 12 #include <sfx2/thumbnailview.hxx> 13 14 //unicode item defines 15 #define ITEM_MAX_WIDTH 30 16 #define ITEM_MAX_HEIGHT 30 17 #define ITEM_PADDING 5 18 #define ITEM_MAX_TEXT_LENGTH 10 19 20 enum class FILTER_CATEGORY 21 { 22 PEOPLE, 23 NATURE, 24 FOOD, 25 ACTIVITY, 26 TRAVEL, 27 OBJECTS, 28 SYMBOLS, 29 FLAGS, 30 UNICODE9 31 }; 32 33 // Display unicode emojis depending on the category 34 class ViewFilter_Category final 35 { 36 public: ViewFilter_Category(FILTER_CATEGORY rCategory)37 ViewFilter_Category(FILTER_CATEGORY rCategory) 38 : mCategory(rCategory) 39 { 40 } 41 42 bool operator()(const ThumbnailViewItem* pItem); 43 44 static bool isFilteredCategory(FILTER_CATEGORY filter, const OUString& rCategory); 45 46 private: 47 FILTER_CATEGORY mCategory; 48 }; 49 50 class EmojiView final : public ThumbnailView 51 { 52 public: 53 EmojiView(std::unique_ptr<weld::ScrolledWindow> xWindow); 54 55 virtual ~EmojiView() override; 56 57 // Fill view with emojis 58 void Populate(); 59 60 void setInsertEmojiHdl(const Link<ThumbnailViewItem*, void>& rLink); 61 62 void AppendItem(const OUString& rTitle, const OUString& rCategory, const OUString& rName); 63 64 private: 65 virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; 66 67 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; 68 69 virtual bool KeyInput(const KeyEvent& rKEvt) override; 70 71 std::string msJSONData; 72 73 Link<ThumbnailViewItem*, void> maInsertEmojiHdl; 74 }; 75 76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 77