diff options
author | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-06-27 16:15:23 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-07-28 20:54:44 +0000 |
commit | 72e6f08c692c0625db5ce377fb478a99660adb0d (patch) | |
tree | a5db439b850782ed2245462361107522a9ed9b5a /include/sfx2/emojiview.hxx | |
parent | 6dcd231892d80d2f130d1b9ebb9cf7dfa1115df1 (diff) |
GSoC Emoji Control
Tab Window
Add emoji.json to installation directory
Read the JSON data from code
Filter emojis according to categories
Insert Emoji at cursor position
Toolbar control
Change-Id: Ia5a577ce41398132872914ebfa499e4d4077d57e
Reviewed-on: https://gerrit.libreoffice.org/26700
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Akshay Deep <akshaydeepiitr@gmail.com>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'include/sfx2/emojiview.hxx')
-rw-r--r-- | include/sfx2/emojiview.hxx | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/include/sfx2/emojiview.hxx b/include/sfx2/emojiview.hxx new file mode 100644 index 000000000000..0eac5adf1fd7 --- /dev/null +++ b/include/sfx2/emojiview.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_SOURCE_INC_EMOJIVIEW_HXX +#define INCLUDED_SFX2_SOURCE_INC_EMOJIVIEW_HXX + +#include <sfx2/thumbnailview.hxx> + +//unicode item defines +#define ITEM_MAX_WIDTH 20 +#define ITEM_MAX_HEIGHT 20 +#define ITEM_PADDING 5 +#define ITEM_MAX_TEXT_LENGTH 10 + +class EmojiViewItem; + +enum class FILTER_CATEGORY +{ + PEOPLE, + NATURE, + FOOD, + ACTIVITY, + TRAVEL, + OBJECTS, + SYMBOLS, + FLAGS, + UNICODE9 +}; + +// Display unicode emojis depending on the category +class ViewFilter_Category +{ +public: + + ViewFilter_Category (FILTER_CATEGORY rCategory) + : mCategory(rCategory) + {} + + virtual ~ViewFilter_Category () {} + + bool operator () (const ThumbnailViewItem *pItem); + + static bool isFilteredCategory(FILTER_CATEGORY filter, const OUString &rCategory); + +protected: + + FILTER_CATEGORY mCategory; +}; + + +class EmojiView : public ThumbnailView +{ +public: + EmojiView ( vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP | WB_VSCROLL); + + virtual ~EmojiView (); + + // Fill view with emoji unicodes + void Populate (); + + void setInsertEmojiHdl (const Link<ThumbnailViewItem*, void> &rLink); + + void AppendItem(const OUString &rTitle, const OUString &rCategory ); + +protected: + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + + virtual void KeyInput( const KeyEvent& rKEvt ) override; + +protected: + std::string msJSONData; + + Link<ThumbnailViewItem*, void> maInsertEmojiHdl; +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_EMOJIVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |