18 std::shared_ptr<CandidateList> candidate_;
20 CustomInputPanelCallback customCallback_ =
nullptr;
21 CustomInputPanelCallback customVirtualKeyboardCallback_ =
nullptr;
30 InputPanel::~InputPanel() {}
32 void InputPanel::setAuxDown(
const Text &text) {
37 void InputPanel::setAuxUp(
const Text &text) {
42 void InputPanel::setCandidateList(std::unique_ptr<CandidateList> candidate) {
44 d->candidate_ = std::move(candidate);
49 d->clientPreedit_ = clientPreedit.
normalize();
52 if (d->clientPreedit_.empty()) {
57 void InputPanel::setPreedit(
const Text &text) {
62 const Text &InputPanel::auxDown()
const {
67 const Text &InputPanel::auxUp()
const {
74 return d->clientPreedit_;
77 const Text &InputPanel::preedit()
const {
84 return d->customCallback_;
88 CustomInputPanelCallback callback) {
90 d->customCallback_ = std::move(callback);
93 const CustomInputPanelCallback &
94 InputPanel::customVirtualKeyboardCallback()
const {
96 return d->customVirtualKeyboardCallback_;
99 void InputPanel::setCustomVirtualKeyboardCallback(
100 CustomInputPanelCallback callback) {
102 d->customVirtualKeyboardCallback_ = std::move(callback);
105 void InputPanel::reset() {
108 d->clientPreedit_.clear();
109 d->clientPreedit_.setCursor(0);
110 d->candidate_.reset();
113 d->customCallback_ =
nullptr;
114 d->customVirtualKeyboardCallback_ =
nullptr;
119 return d->preedit_.empty() && d->clientPreedit_.empty() &&
120 (!d->candidate_ || d->candidate_->size() == 0) &&
121 d->auxUp_.empty() && d->auxDown_.empty();
124 std::shared_ptr<CandidateList> InputPanel::candidateList()
const {
126 return d->candidate_;
const Text & clientPreedit() const
The preedit text embedded in client window.
const CustomInputPanelCallback & customInputPanelCallback() const
Return the current input panel display callback.
A class represents a formatted string.
Text normalize() const
Remove empty string piece and merge the string with same format.
InputPanel(InputContext *ic)
Construct a Input Panel associated with given input context.
void setCursor(int pos=-1)
Set cursor by byte.
bool empty() const
Whether input panel is totally empty.
An input context represents a client of Fcitx.
void setCustomInputPanelCallback(CustomInputPanelCallback callback)
Set a custom callback to display the input panel.