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();
216 bool immediate =
false);
228 void setBlockEventToClient(
bool block);
229 bool hasPendingEvents()
const;
239 bool hasPendingEventsStrictOrder()
const;
274 template <
typename T>
276 return static_cast<T *
>(property(name));
287 template <
typename T>
289 return static_cast<typename T::PropertyType *
>(property(factory));
299 void updateProperty(
const std::string &name);
310 bool isVirtualKeyboardVisible()
const;
312 void showVirtualKeyboard()
const;
314 void hideVirtualKeyboard()
const;
316 bool clientControlVirtualkeyboardShow()
const;
318 void setClientControlVirtualkeyboardShow(
bool show);
320 bool clientControlVirtualkeyboardHide()
const;
322 void setClientControlVirtualkeyboardHide(
bool hide);
332 virtual void commitStringImpl(
const std::string &text) = 0;
340 virtual void deleteSurroundingTextImpl(
int offset,
unsigned int size) = 0;
354 virtual void updatePreeditImpl() = 0;
361 virtual void updateClientSideUIImpl();
372 void setHasFocus(
bool hasFocus);
374 std::unique_ptr<InputContextPrivate> d_ptr;
379 friend class InputContextPrivate;
382 using InputContext::InputContext;
386 virtual void commitStringWithCursorImpl(
const std::string &text,
407 #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.