-
Notifications
You must be signed in to change notification settings - Fork 111
/
quickphrase_public.h
52 lines (44 loc) · 1.63 KB
/
quickphrase_public.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* SPDX-FileCopyrightText: 2017-2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
*/
#ifndef _FCITX_MODULES_QUICKPHRASE_QUICKPHRASE_PUBLIC_H_
#define _FCITX_MODULES_QUICKPHRASE_QUICKPHRASE_PUBLIC_H_
#include <functional>
#include <string>
#include <fcitx-utils/key.h>
#include <fcitx-utils/metastring.h>
#include <fcitx/addoninstance.h>
#include <fcitx/inputcontext.h>
namespace fcitx {
enum class QuickPhraseAction {
Commit,
TypeToBuffer,
DigitSelection,
AlphaSelection,
NoneSelection,
DoNothing,
AutoCommit,
};
using QuickPhraseAddCandidateCallback = std::function<void(
const std::string &, const std::string &, QuickPhraseAction action)>;
using QuickPhraseProviderCallback =
std::function<bool(InputContext *ic, const std::string &,
const QuickPhraseAddCandidateCallback &)>;
} // namespace fcitx
/// Trigger quickphrase, with following format:
/// description_text prefix_text
FCITX_ADDON_DECLARE_FUNCTION(QuickPhrase, trigger,
void(InputContext *ic, const std::string &text,
const std::string &prefix,
const std::string &str,
const std::string &alt, const Key &key));
FCITX_ADDON_DECLARE_FUNCTION(QuickPhrase, setBuffer,
void(InputContext *ic, const std::string &text));
FCITX_ADDON_DECLARE_FUNCTION(
QuickPhrase, addProvider,
std::unique_ptr<HandlerTableEntry<QuickPhraseProviderCallback>>(
QuickPhraseProviderCallback));
#endif // _FCITX_MODULES_QUICKPHRASE_QUICKPHRASE_PUBLIC_H_