8 #ifndef _FCITX_INPUTCONTEXT_H_ 9 #define _FCITX_INPUTCONTEXT_H_ 17 #include <string_view> 20 #include <fcitx-utils/macros.h> 24 #include <fcitx/fcitxcore_export.h> 35 using ICUUID = std::array<uint8_t, 16>;
37 class InputContextManager;
39 class InputContextPrivate;
40 class InputContextProperty;
43 using InputContextVisitor = std::function<bool(InputContext *ic)>;
62 virtual const char *frontend()
const = 0;
72 std::string_view frontendName()
const;
75 const ICUUID &uuid()
const;
79 const std::string &program()
const;
83 std::string display()
const;
86 const Rect &cursorRect()
const;
89 double scaleFactor()
const;
113 FCITXCORE_DEPRECATED
void reset(ResetReason reason);
134 void setEnablePreedit(
bool enable);
137 bool isPreeditEnabled()
const;
140 void setCursorRect(
Rect rect);
143 void setCursorRect(
Rect rect,
double scale);
159 bool hasFocus()
const;
177 void updateSurroundingText();
182 void commitString(
const std::string &text);
192 void commitStringWithCursor(
const std::string &text,
size_t cursor);
195 void deleteSurroundingText(
int offset,
unsigned int size);
198 void forwardKey(
const Key &rawKey,
bool isRelease =
false,
int time = 0);
205 void updatePreedit();
215 void updatePreedit(
bool forceUpdate);
226 bool immediate =
false);
238 void setBlockEventToClient(
bool block);
239 bool hasPendingEvents()
const;
249 bool hasPendingEventsStrictOrder()
const;
284 template <
typename T>
286 return static_cast<T *
>(property(name));
297 template <
typename T>
299 return static_cast<typename T::PropertyType *
>(property(factory));
309 void updateProperty(
const std::string &name);
320 bool isVirtualKeyboardVisible()
const;
322 void showVirtualKeyboard()
const;
324 void hideVirtualKeyboard()
const;
326 bool clientControlVirtualkeyboardShow()
const;
328 void setClientControlVirtualkeyboardShow(
bool show);
330 bool clientControlVirtualkeyboardHide()
const;
332 void setClientControlVirtualkeyboardHide(
bool hide);
342 virtual void commitStringImpl(
const std::string &text) = 0;
350 virtual void deleteSurroundingTextImpl(
int offset,
unsigned int size) = 0;
364 virtual void updatePreeditImpl() = 0;
371 virtual void updateClientSideUIImpl();
382 void setHasFocus(
bool hasFocus);
384 std::unique_ptr<InputContextPrivate> d_ptr;
389 friend class InputContextPrivate;
392 using InputContext::InputContext;
396 virtual void commitStringWithCursorImpl(
const std::string &text,
417 #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.
Base class for User Interface addon.
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.
Class to represent a key.
This is a class that designed to store state that is specific to certain input context.