| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#ifndef _TABLE_CANDIDATE_H_ |
| 8 |
#define _TABLE_CANDIDATE_H_ |
| 9 |
|
| 10 |
#include "engine.h" |
| 11 |
#include <cstddef> |
| 12 |
#include <fcitx/candidateaction.h> |
| 13 |
#include <fcitx/candidatelist.h> |
| 14 |
#include <fcitx/text.h> |
| 15 |
#include <libime/table/tablebaseddictionary.h> |
| 16 |
#include <string> |
| 17 |
#include <vector> |
| 18 |
|
| 19 |
namespace fcitx { |
| 20 |
|
| 21 |
class TableCandidateWord : public CandidateWord { |
| 22 |
public: |
| 23 |
TableCandidateWord(TableEngine *engine, Text text, Text comment, |
| 24 |
bool spaceBeforeHint, size_t idx); |
| 25 |
|
| 26 |
void select(InputContext *inputContext) const override; |
| 27 |
|
| 28 |
TableEngine *engine_; |
| 29 |
size_t idx_; |
| 30 |
}; |
| 31 |
|
| 32 |
class TablePinyinCandidateWord : public CandidateWord { |
| 33 |
public: |
| 34 |
TablePinyinCandidateWord(TableEngine *engine, std::string word, |
| 35 |
const libime::TableBasedDictionary &dict, |
| 36 |
bool customHint, std::string hintSeparator, |
| 37 |
bool spaceBeforeHint); |
| 38 |
|
| 39 |
void select(InputContext *inputContext) const override; |
| 40 |
|
| 41 |
TableEngine *engine_; |
| 42 |
std::string word_; |
| 43 |
}; |
| 44 |
|
| 45 |
class TablePunctuationCandidateWord : public CandidateWord { |
| 46 |
public: |
| 47 |
TablePunctuationCandidateWord(TableState *state, std::string word, |
| 48 |
bool isHalf); |
| 49 |
|
| 50 |
void select(InputContext *inputContext) const override; |
| 51 |
|
| 52 |
const std::string &word() const { return word_; } |
| 53 |
|
| 54 |
private: |
| 55 |
TableState *state_; |
| 56 |
std::string word_; |
| 57 |
}; |
| 58 |
|
| 59 |
class TablePredictCandidateWord : public CandidateWord { |
| 60 |
public: |
| 61 |
TablePredictCandidateWord(TableState *state, std::string word); |
| 62 |
|
| 63 |
void select(InputContext *inputContext) const override; |
| 64 |
|
| 65 |
TableState *state_; |
| 66 |
std::string word_; |
| 67 |
}; |
| 68 |
|
| 69 |
class TableActionableCandidateList : public ActionableCandidateList { |
| 70 |
public: |
| 71 |
TableActionableCandidateList(TableState *state); |
| 72 |
|
| 73 |
bool hasAction(const CandidateWord &candidate) const override; |
| 74 |
std::vector<CandidateAction> |
| 75 |
candidateActions(const CandidateWord &candidate) const override; |
| 76 |
void triggerAction(const CandidateWord &candidate, int id) override; |
| 77 |
|
| 78 |
private: |
| 79 |
TableState *state_; |
| 80 |
}; |
| 81 |
|
| 82 |
} |
| 83 |
|
| 84 |
#endif |