8 #ifndef _FCITX_INPUTCONTEXT_H_ 9 #define _FCITX_INPUTCONTEXT_H_ 16 #include <string_view> 18 #include <fcitx-utils/macros.h> 22 #include <fcitx/fcitxcore_export.h> 32 using ICUUID = std::array<uint8_t, 16>;
34 class InputContextManager;
36 class InputContextPrivate;
37 class InputContextProperty;
40 using InputContextVisitor = std::function<bool(InputContext *ic)>;
59 virtual const char *frontend()
const = 0;
69 std::string_view frontendName()
const;
72 const ICUUID &uuid()
const;
76 const std::string &program()
const;
80 std::string display()
const;
83 const Rect &cursorRect()
const;
86 double scaleFactor()
const;
110 FCITXCORE_DEPRECATED
void reset(ResetReason reason);
131 void setEnablePreedit(
bool enable);
134 bool isPreeditEnabled()
const;
137 void setCursorRect(
Rect rect);
140 void setCursorRect(
Rect rect,
double scale);
156 bool hasFocus()
const;
174 void updateSurroundingText();
179 void commitString(
const std::string &text);
189 void commitStringWithCursor(
const std::string &text,
size_t cursor);
192 void deleteSurroundingText(
int offset,
unsigned int size);
195 void forwardKey(
const Key &rawKey,
bool isRelease =
false,
int time = 0);
202 void updatePreedit();
213 bool immediate =
false);
225 void setBlockEventToClient(
bool block);
226 bool hasPendingEvents()
const;
236 bool hasPendingEventsStrictOrder()
const;
271 template <
typename T>
273 return static_cast<T *
>(property(name));
284 template <
typename T>
286 return static_cast<typename T::PropertyType *
>(property(factory));
296 void updateProperty(
const std::string &name);
307 bool isVirtualKeyboardVisible()
const;
309 void showVirtualKeyboard()
const;
311 void hideVirtualKeyboard()
const;
313 bool clientControlVirtualkeyboardShow()
const;
315 void setClientControlVirtualkeyboardShow(
bool show);
317 bool clientControlVirtualkeyboardHide()
const;
319 void setClientControlVirtualkeyboardHide(
bool show);
329 virtual void commitStringImpl(
const std::string &text) = 0;
337 virtual void deleteSurroundingTextImpl(
int offset,
unsigned int size) = 0;
351 virtual void updatePreeditImpl() = 0;
358 virtual void updateClientSideUIImpl();
369 void setHasFocus(
bool hasFocus);
371 std::unique_ptr<InputContextPrivate> d_ptr;
376 friend class InputContextPrivate;
379 using InputContext::InputContext;
383 virtual void commitStringWithCursorImpl(
const std::string &text,
404 #endif // _FCITX_INPUTCONTEXT_H_ Utility class provides a weak reference to the object.
T::PropertyType * propertyFor(const T *factory)
Helper function to return the input context property in specific type by given factory.
Utitliy classes for statically tracking the life of a object.
T * propertyAs(const std::string &name)
Helper function to return the input context property in specific type.
Local cache for surrounding text.
Provide utility to handle rectangle.
Enum type for input context capability.
Class represents the current state of surrounding text of an input context.
A helper class for frontend addon.
Helper class to be used with TrackableObjectReference.
Status area represent a list of actions and action may have sub actions.
Factory class for input context property.
Class provides bit flag support for Enum.
Input Method event for Fcitx.
Input Context Property for Fcitx.
An input context represents a client of Fcitx.
This is a class that designed to store state that is specific to certain input context.