Fcitx
Files | Classes | Macros | Typedefs | Enumerations | Functions | Friends
FcitxCore
Collaboration diagram for FcitxCore:

Files

file  addonfactory.h
 Addon Factory class.
 
file  addoninstance.h
 Addon For fcitx.
 
file  addonmanager.h
 Addon Manager class.
 
file  inputcontext.h
 Input Context for Fcitx.
 
file  inputcontextproperty.h
 Input Context Property for Fcitx.
 
file  inputmethodmanager.h
 Input Method Manager For fcitx.
 
file  inputpanel.h
 Class for input panel in UI.
 
file  menu.h
 Class for menu in UI.
 
file  statusarea.h
 Class for status area in UI.
 
file  surroundingtext.h
 Local cache for surrounding text.
 
file  text.h
 Formatted string commonly used in user interface.
 
file  userinterface.h
 Base class for User Interface addon.
 
file  userinterfacemanager.h
 Manager class for user interface.
 

Classes

class  fcitx::AddonFactory
 Base class for addon factory. More...
 
class  fcitx::AddonInstance
 Base class for any addon in fcitx. More...
 
class  fcitx::AddonManager
 
class  fcitx::InputContext
 An input context represents a client of Fcitx. More...
 
class  fcitx::InputContextEventBlocker
 A helper class for frontend addon. More...
 
class  fcitx::InputContextProperty
 This is a class that designed to store state that is specific to certain input context. More...
 
class  fcitx::InputContextPropertyFactory
 Factory class for input context property. More...
 
class  fcitx::SimpleInputContextPropertyFactory< T >
 
class  fcitx::LambdaInputContextPropertyFactory< Ret >
 
class  fcitx::InputMethodManager
 Class to manage all the input method relation information. More...
 
class  fcitx::InputPanel
 Input Panel is usually a floating window that is display at the cursor of input. More...
 
class  fcitx::Menu
 Menu that contains a list of actions. More...
 
class  fcitx::StatusArea
 Status area represent a list of actions and action may have sub actions. More...
 
class  fcitx::SurroundingText
 Class represents the current state of surrounding text of an input context. More...
 
class  fcitx::Text
 A class represents a formatted string. More...
 
class  fcitx::UserInterface
 ... More...
 
class  fcitx::UserInterfaceManager
 

Macros

#define FCITX_ADDON_DECLARE_FUNCTION(NAME, FUNCTION, SIGNATURE...)
 
#define FCITX_ADDON_EXPORT_FUNCTION(CLASS, FUNCTION)
 
#define FCITX_ADDON_FACTORY(ClassName)
 
#define FCITX_ADDON_DEPENDENCY_LOADER(NAME, ADDONMANAGER)
 A convenient macro to obtain the addon pointer of another addon. More...
 

Typedefs

typedef std::array< uint8_t, 16 > fcitx::ICUUID
 
typedef std::function< bool(InputContext *ic)> fcitx::InputContextVisitor
 
typedef T fcitx::SimpleInputContextPropertyFactory< T >::PropertyType
 
typedef Ret fcitx::LambdaInputContextPropertyFactory< Ret >::PropertyType
 
template<typename T >
using fcitx::FactoryFor = LambdaInputContextPropertyFactory< T >
 Convinient short type alias for creating a LambdaInputContextPropertyFactory. More...
 

Enumerations

enum  fcitx::StatusGroup { fcitx::StatusGroup::BeforeInputMethod, fcitx::StatusGroup::InputMethod, fcitx::StatusGroup::AfterInputMethod }
 
enum  fcitx::UserInterfaceComponent { fcitx::UserInterfaceComponent::InputPanel, fcitx::UserInterfaceComponent::StatusArea }
 

Functions

virtual AddonInstancefcitx::AddonFactory::create (AddonManager *manager)=0
 Create a addon instance for given addon manager. More...
 
virtual void fcitx::AddonInstance::reloadConfig ()
 Reload configuration from disk.
 
virtual void fcitx::AddonInstance::save ()
 Save any relevant data. Usually, it will be invoked when fcitx exits.
 
virtual const Configurationfcitx::AddonInstance::getConfig () const
 Get the configuration.
 
virtual void fcitx::AddonInstance::setConfig (const RawConfig &)
 Set configuration from Raw Config.
 
virtual const Configurationfcitx::AddonInstance::getSubConfig (const std::string &) const
 
virtual void fcitx::AddonInstance::setSubConfig (const std::string &, const RawConfig &)
 
template<typename Signature , typename... Args>
std::function< Signature >::result_type fcitx::AddonInstance::callWithSignature (const std::string &name, Args &&...args)
 
template<typename MetaSignatureString , typename... Args>
auto fcitx::AddonInstance::callWithMetaString (Args &&...args)
 
template<typename MetaType , typename... Args>
auto fcitx::AddonInstance::call (Args &&...args)
 Call an exported function for this addon.
 
void fcitx::AddonInstance::registerCallback (const std::string &name, AddonFunctionAdaptorBase *adaptor)
 
 fcitx::AddonManager::AddonManager ()
 Construct an addon manager.
 
 fcitx::AddonManager::AddonManager (const std::string &addonConfigDir)
 Create addon manager with given addon config dir. More...
 
virtual fcitx::AddonManager::~AddonManager ()
 Destruct and unload all addons.
 
void fcitx::AddonManager::registerDefaultLoader (StaticAddonRegistry *registry)
 Register addon loader, including static and shared library loader. More...
 
void fcitx::AddonManager::registerLoader (std::unique_ptr< AddonLoader > loader)
 Register new addon loader. More...
 
void fcitx::AddonManager::unregisterLoader (const std::string &name)
 Unregister addon loader. More...
 
void fcitx::AddonManager::load (const std::unordered_set< std::string > &enabled={}, const std::unordered_set< std::string > &disabled={})
 Load addon based on given parameter. More...
 
void fcitx::AddonManager::unload ()
 Destruct all addon, all information is cleared to the initial state. More...
 
void fcitx::AddonManager::saveAll ()
 Save all addon configuration. More...
 
AddonInstancefcitx::AddonManager::addon (const std::string &name, bool load=false)
 Get the loaded addon instance. More...
 
const AddonInfofcitx::AddonManager::addonInfo (const std::string &name) const
 Get addon information for given addon. More...
 
std::unordered_set< std::string > fcitx::AddonManager::addonNames (AddonCategory category)
 
Instancefcitx::AddonManager::instance ()
 Return the fcitx instance when it is created by Fcitx. More...
 
EventLoopfcitx::AddonManager::eventLoop ()
 Return the associated event loop. More...
 
void fcitx::AddonManager::setEventLoop (EventLoop *eventLoop)
 Set event loop. More...
 
const SemanticVersionfcitx::AddonManager::version () const
 Return the version number of Fcitx5Core library.
 
bool fcitx::AddonManager::checkUpdate () const
 Check directory for quick hint for whether update is required. More...
 
 fcitx::InputContext::InputContext (InputContextManager &manager, const std::string &program={})
 
 fcitx::InputContext::InputContext (InputContext &&other)=delete
 
virtual const char * fcitx::InputContext::frontend () const =0
 Returns the underlying implementation of Input Context.
 
const ICUUID & fcitx::InputContext::uuid () const
 Returns the uuid of this input context.
 
const std::string & fcitx::InputContext::program () const
 Returns the program name of input context. More...
 
std::string fcitx::InputContext::display () const
 Returns the display server of the client. More...
 
const Rectfcitx::InputContext::cursorRect () const
 Returns the cursor position of the client.
 
double fcitx::InputContext::scaleFactor () const
 Return the client scale factor.
 
void fcitx::InputContext::focusIn ()
 Called When input context gains the input focus.
 
void fcitx::InputContext::focusOut ()
 Called when input context losts the input focus.
 
void fcitx::InputContext::setFocusGroup (FocusGroup *group)
 Set the focus group of this input context. More...
 
FocusGroupfcitx::InputContext::focusGroup () const
 Returns the current focus group of input context.
 
FCITXCORE_DEPRECATED void fcitx::InputContext::reset (ResetReason reason)
 Called when input context state need to be reset.
 
void fcitx::InputContext::reset ()
 Called when input context state need to be reset. More...
 
void fcitx::InputContext::setCapabilityFlags (CapabilityFlags flags)
 Update the capability flags of the input context. More...
 
CapabilityFlags fcitx::InputContext::capabilityFlags () const
 Returns the current capability flags. More...
 
void fcitx::InputContext::setEnablePreedit (bool enable)
 Override the preedit hint from client.
 
bool fcitx::InputContext::isPreeditEnabled () const
 Check if preedit is manually disalbed.
 
void fcitx::InputContext::setCursorRect (Rect rect)
 Update the current cursor rect of the input context.
 
void fcitx::InputContext::setCursorRect (Rect rect, double scale)
 Update the client rect with scale factor.
 
bool fcitx::InputContext::keyEvent (KeyEvent &event)
 Send a key event to current input context.
 
bool fcitx::InputContext::hasFocus () const
 Returns whether the input context holds the input focus. More...
 
void fcitx::InputContext::invokeAction (InvokeActionEvent &event)
 Invoke an action on the preedit.
 
SurroundingTextfcitx::InputContext::surroundingText ()
 Returns the mutable surrounding text of the input context. More...
 
const SurroundingTextfcitx::InputContext::surroundingText () const
 Returns the immutable surrounding text of the input context.
 
void fcitx::InputContext::updateSurroundingText ()
 Notifies the surrounding text modification from the client.
 
void fcitx::InputContext::commitString (const std::string &text)
 Commit a string to the client.
 
void fcitx::InputContext::deleteSurroundingText (int offset, unsigned int size)
 Ask client to delete a range of surrounding text.
 
void fcitx::InputContext::forwardKey (const Key &rawKey, bool isRelease=false, int time=0)
 Send a key event to client.
 
void fcitx::InputContext::updatePreedit ()
 Notifies client about changes in clientPreedit. More...
 
void fcitx::InputContext::updateUserInterface (UserInterfaceComponent component, bool immediate=false)
 Notifies UI about changes in user interface. More...
 
void fcitx::InputContext::setBlockEventToClient (bool block)
 Prevent event deliver to input context, and re-send the event later. More...
 
bool fcitx::InputContext::hasPendingEvents () const
 
InputContextPropertyfcitx::InputContext::property (const std::string &name)
 Returns the input context property by name.
 
InputContextPropertyfcitx::InputContext::property (const InputContextPropertyFactory *factory)
 Returns the input context property by factory.
 
InputPanelfcitx::InputContext::inputPanel ()
 Returns the associated input panel.
 
StatusAreafcitx::InputContext::statusArea ()
 Returns the associated StatusArea.
 
template<typename T >
T * fcitx::InputContext::propertyAs (const std::string &name)
 Helper function to return the input context property in specific type. More...
 
template<typename T >
T::PropertyType * fcitx::InputContext::propertyFor (const T *factory)
 Helper function to return the input context property in specific type by given factory. More...
 
void fcitx::InputContext::updateProperty (const std::string &name)
 Notifes the change of a given input context property. More...
 
void fcitx::InputContext::updateProperty (const InputContextPropertyFactory *factory)
 Notifes the change of a given input context property by its factory. More...
 
virtual void fcitx::InputContext::commitStringImpl (const std::string &text)=0
 Send the committed string to client. More...
 
virtual void fcitx::InputContext::deleteSurroundingTextImpl (int offset, unsigned int size)=0
 Send the delete Surrounding Text request to client. More...
 
virtual void fcitx::InputContext::forwardKeyImpl (const ForwardKeyEvent &key)=0
 Send the forwarded key to client. More...
 
virtual void fcitx::InputContext::updatePreeditImpl ()=0
 Send the preedit update to the client. More...
 
virtual void fcitx::InputContext::updateClientSideUIImpl ()
 Send the UI update to client. More...
 
void fcitx::InputContext::destroy ()
 Notifies the destruction of the input context. More...
 
void fcitx::InputContext::created ()
 Notifies the creation of input context. More...
 
 fcitx::InputContextEventBlocker::InputContextEventBlocker (InputContext *inputContext)
 
virtual void fcitx::InputContextProperty::copyTo (InputContextProperty *)
 copy state to another property. More...
 
virtual bool fcitx::InputContextProperty::needCopy () const
 Quick check if there's need to copy over the state.
 
virtual InputContextPropertyfcitx::InputContextPropertyFactory::create (InputContext &)=0
 
bool fcitx::InputContextPropertyFactory::registered () const
 Return whether the factory is already registered with an InputContextManager. More...
 
void fcitx::InputContextPropertyFactory::unregister ()
 Unregister the factory from current InputContextManager.
 
InputContextPropertyfcitx::SimpleInputContextPropertyFactory< T >::create (InputContext &) override
 
 fcitx::LambdaInputContextPropertyFactory< Ret >::LambdaInputContextPropertyFactory (std::function< Ret *(InputContext &)> f)
 
InputContextPropertyfcitx::LambdaInputContextPropertyFactory< Ret >::create (InputContext &ic) override
 
 fcitx::InputMethodManager::InputMethodManager (AddonManager *addonManager)
 
void fcitx::InputMethodManager::load (const std::function< void(InputMethodManager &)> &buildDefaultGroupCallback={})
 Load the input method information from disk. More...
 
void fcitx::InputMethodManager::reset (const std::function< void(InputMethodManager &)> &buildDefaultGroupCallback={})
 Reset all the group information to initial state.
 
void fcitx::InputMethodManager::refresh ()
 Load new input method configuration file from disk. More...
 
void fcitx::InputMethodManager::save ()
 Save the input method information to disk. More...
 
std::vector< std::string > fcitx::InputMethodManager::groups () const
 Return all the names of group by order.
 
int fcitx::InputMethodManager::groupCount () const
 Return the number of groups.
 
void fcitx::InputMethodManager::setCurrentGroup (const std::string &group)
 Set the name of current group, rest of the group order will be adjusted accordingly. More...
 
const InputMethodGroupfcitx::InputMethodManager::currentGroup () const
 Return the current group.
 
void fcitx::InputMethodManager::enumerateGroup (bool forward)
 Simply enumerate input method groups.
 
void fcitx::InputMethodManager::setDefaultInputMethod (const std::string &name)
 Set default input method for current group. More...
 
const InputMethodGroupfcitx::InputMethodManager::group (const std::string &name) const
 Return the input methdo group of given name.
 
void fcitx::InputMethodManager::setGroup (InputMethodGroup newGroupInfo)
 Update the information of an existing group. More...
 
void fcitx::InputMethodManager::addEmptyGroup (const std::string &name)
 Create a new empty group with given name.
 
void fcitx::InputMethodManager::removeGroup (const std::string &name)
 Remove an existing group by name.
 
void fcitx::InputMethodManager::setGroupOrder (const std::vector< std::string > &groups)
 Update the initial order of groups. More...
 
const InputMethodEntryfcitx::InputMethodManager::entry (const std::string &name) const
 Return a given input method entry by name.
 
bool fcitx::InputMethodManager::foreachEntries (const std::function< bool(const InputMethodEntry &entry)> &callback)
 Enumerate all the input method entries. More...
 
bool fcitx::InputMethodManager::checkUpdate () const
 Check if there is new entries could be loaded. More...
 
 fcitx::InputMethodManager::FCITX_DECLARE_SIGNAL (InputMethodManager, CurrentGroupAboutToChange, void(const std::string &group))
 Emit the signal when current group is about to change. More...
 
 fcitx::InputMethodManager::FCITX_DECLARE_SIGNAL (InputMethodManager, CurrentGroupChanged, void(const std::string &group))
 
 fcitx::InputMethodManager::FCITX_DECLARE_SIGNAL (InputMethodManager, GroupAdded, void(const std::string &group))
 Emit the signal when a new group is added. More...
 
 fcitx::InputMethodManager::FCITX_DECLARE_SIGNAL (InputMethodManager, GroupRemoved, void(const std::string &group))
 Emit the signal when a group is removed. More...
 
 fcitx::InputPanel::InputPanel (InputContext *ic)
 Construct a Input Panel associated with given input context.
 
const Textfcitx::InputPanel::preedit () const
 
void fcitx::InputPanel::setPreedit (const Text &text)
 
const Textfcitx::InputPanel::auxUp () const
 
void fcitx::InputPanel::setAuxUp (const Text &text)
 
const Textfcitx::InputPanel::auxDown () const
 
void fcitx::InputPanel::setAuxDown (const Text &text)
 
const Textfcitx::InputPanel::clientPreedit () const
 The preedit text embedded in client window.
 
void fcitx::InputPanel::setClientPreedit (const Text &clientPreedit)
 
std::shared_ptr< CandidateListfcitx::InputPanel::candidateList () const
 
void fcitx::InputPanel::setCandidateList (std::unique_ptr< CandidateList > candidate)
 
void fcitx::InputPanel::reset ()
 
bool fcitx::InputPanel::empty () const
 Whether input panel is totally empty.
 
void fcitx::Menu::addAction (Action *action)
 
void fcitx::Menu::removeAction (Action *action)
 
void fcitx::Menu::insertAction (Action *before, Action *action)
 
std::vector< Action * > fcitx::Menu::actions ()
 
 fcitx::Menu::FCITX_DECLARE_SIGNAL (Menu, Update, void())
 
 fcitx::StatusArea::StatusArea (InputContext *ic)
 Construct status area for associated input context.
 
void fcitx::StatusArea::addAction (StatusGroup group, Action *action)
 Add an action to given group.
 
void fcitx::StatusArea::removeAction (Action *action)
 Remove an action from given group.
 
void fcitx::StatusArea::clear ()
 Clear all the actions, will be called when input context lost focus.
 
void fcitx::StatusArea::clearGroup (StatusGroup group)
 Clear only given status group.
 
std::vector< Action * > fcitx::StatusArea::actions (StatusGroup group) const
 Get the associated actions for group.
 
std::vector< Action * > fcitx::StatusArea::allActions () const
 Get all the associated actions.
 
void fcitx::SurroundingText::invalidate ()
 Reset surrounding text to invalid state.
 
bool fcitx::SurroundingText::isValid () const
 Return whether surrounding text is valid.
 
unsigned int fcitx::SurroundingText::anchor () const
 offset of anchor in character.
 
unsigned int fcitx::SurroundingText::cursor () const
 offset of anchor in character.
 
const std::string & fcitx::SurroundingText::text () const
 
std::string fcitx::SurroundingText::selectedText () const
 
void fcitx::SurroundingText::setText (const std::string &text, unsigned int cursor, unsigned int anchor)
 Set current of surrounding text. More...
 
void fcitx::SurroundingText::setCursor (unsigned int cursor, unsigned int anchor)
 Set current cursor and anchor of surrounding text. More...
 
void fcitx::SurroundingText::deleteText (int offset, unsigned int size)
 Delete surrounding text with offset and size. More...
 
LogMessageBuilderfcitx::operator<< (LogMessageBuilder &log, const SurroundingText &surroundingText)
 
 fcitx::Text::Text (std::string text, TextFormatFlags flag=TextFormatFlag::NoFlag)
 
 fcitx::Text::FCITX_DECLARE_VIRTUAL_DTOR_COPY_AND_MOVE (Text)
 
int fcitx::Text::cursor () const
 Get cursor by byte.
 
void fcitx::Text::setCursor (int pos=-1)
 Set cursor by byte.
 
void fcitx::Text::clear ()
 
void fcitx::Text::append (std::string str, TextFormatFlags flag=TextFormatFlag::NoFlag)
 
const std::string & fcitx::Text::stringAt (int idx) const
 
TextFormatFlags fcitx::Text::formatAt (int idx) const
 
size_t fcitx::Text::size () const
 
bool fcitx::Text::empty () const
 
size_t fcitx::Text::textLength () const
 
std::string fcitx::Text::toString () const
 
std::string fcitx::Text::toStringForCommit () const
 
std::vector< Textfcitx::Text::splitByLine () const
 Split Text object into lines. More...
 
std::ostream & fcitx::operator<< (std::ostream &os, const Text &text)
 
virtual void fcitx::UserInterface::update (UserInterfaceComponent component, InputContext *inputContext)=0
 
virtual bool fcitx::UserInterface::available ()=0
 
virtual void fcitx::UserInterface::suspend ()=0
 
virtual void fcitx::UserInterface::resume ()=0
 
 fcitx::UserInterfaceManager::UserInterfaceManager (AddonManager *manager)
 
void fcitx::UserInterfaceManager::load (const std::string &ui={})
 
bool fcitx::UserInterfaceManager::registerAction (const std::string &name, Action *action)
 
bool fcitx::UserInterfaceManager::registerAction (Action *action)
 
void fcitx::UserInterfaceManager::unregisterAction (Action *action)
 
Actionfcitx::UserInterfaceManager::lookupAction (const std::string &name) const
 
Actionfcitx::UserInterfaceManager::lookupActionById (int id) const
 
void fcitx::UserInterfaceManager::update (UserInterfaceComponent component, InputContext *inputContext)
 
void fcitx::UserInterfaceManager::expire (InputContext *inputContext)
 
void fcitx::UserInterfaceManager::flush ()
 
void fcitx::UserInterfaceManager::updateAvailability ()
 
std::string fcitx::UserInterfaceManager::currentUI () const
 

Friends

class fcitx::AddonManager::Instance
 
class fcitx::InputContext::InputContextManagerPrivate
 
class fcitx::InputContext::FocusGroup
 
class fcitx::InputContext::UserInterfaceManager
 
class fcitx::InputContextPropertyFactory::InputContextManager
 
class fcitx::Menu::Action
 

Detailed Description

Macro Definition Documentation

◆ FCITX_ADDON_DECLARE_FUNCTION

#define FCITX_ADDON_DECLARE_FUNCTION (   NAME,
  FUNCTION,
  SIGNATURE... 
)
Value:
namespace fcitx { \
template <> \
struct AddonFunctionSignature<fcitxMakeMetaString(#NAME "::" #FUNCTION)> { \
typedef std::remove_reference_t<decltype(std::declval<SIGNATURE>())> \
type; \
}; \
namespace I##NAME { \
struct FUNCTION { \
typedef fcitxMakeMetaString(#NAME "::" #FUNCTION) Name; \
using Signature = AddonFunctionSignatureType<Name>; \
}; \
} \
}
#define fcitxMakeMetaString(STRING)
Create meta string from string literal.
Definition: metastring.h:183
Definition: action.cpp:12

Definition at line 124 of file addoninstance.h.

◆ FCITX_ADDON_DEPENDENCY_LOADER

#define FCITX_ADDON_DEPENDENCY_LOADER (   NAME,
  ADDONMANAGER 
)
Value:
auto NAME() { \
if (_##NAME##FirstCall_) { \
_##NAME##_ = (ADDONMANAGER).addon(#NAME, true); \
_##NAME##FirstCall_ = false; \
} \
return _##NAME##_; \
} \
bool _##NAME##FirstCall_ = true; \
::fcitx::AddonInstance *_##NAME##_ = nullptr;
Base class for any addon in fcitx.
Definition: addoninstance.h:71

A convenient macro to obtain the addon pointer of another addon.

Definition at line 160 of file addoninstance.h.

◆ FCITX_ADDON_EXPORT_FUNCTION

#define FCITX_ADDON_EXPORT_FUNCTION (   CLASS,
  FUNCTION 
)
Value:
decltype(::fcitx::MakeAddonFunctionAdaptor( \
&CLASS::FUNCTION)) FUNCTION##Adaptor{#CLASS "::" #FUNCTION, this, \
&CLASS::FUNCTION}; \
static_assert( \
std::is_same<decltype(::fcitx::MakeAddonFunctionAdaptor( \
&CLASS::FUNCTION))::Signature, \
::fcitx::AddonFunctionSignatureType<fcitxMakeMetaString( \
#CLASS "::" #FUNCTION)>>::value, \
"Signature doesn't match");
#define fcitxMakeMetaString(STRING)
Create meta string from string literal.
Definition: metastring.h:183

Definition at line 139 of file addoninstance.h.

◆ FCITX_ADDON_FACTORY

#define FCITX_ADDON_FACTORY (   ClassName)
Value:
extern "C" { \
FCITXCORE_EXPORT \
::fcitx::AddonFactory *fcitx_addon_factory_instance() { \
static ClassName factory; \
return &factory; \
} \
}
Base class for addon factory.
Definition: addonfactory.h:24

Definition at line 150 of file addoninstance.h.

Typedef Documentation

◆ FactoryFor

template<typename T >
using fcitx::FactoryFor = typedef LambdaInputContextPropertyFactory<T>

Convinient short type alias for creating a LambdaInputContextPropertyFactory.

Example usage: Define it as a field of AddonInstance.

FactoryFor<MyProperty> factory_;

Register the property to InputContextManager in constructor of AddonInstance.

instance_->inputContextManager().registerProperty("propertyName",
&factory_);

The name of property need to be unique.

Get the property from input context within the addon.

auto *state = inputContext->propertyFor(&factory_);

The returned type will be casted automatically. Get property with factory is faster than get property with name.

Accessing the property outside the addon.

InputContextProperty *state = inputContext->property("propertyName");

You may need to cast the type to access any private data within it.

Definition at line 138 of file inputcontextproperty.h.

Enumeration Type Documentation

◆ StatusGroup

enum fcitx::StatusGroup
strong
Enumerator
BeforeInputMethod 

Action shown before input method group.

InputMethod 

Group should be solely used by input method engine.

It will be cleared automatically before InputMethodEngine::activate.

See also
InputMethodEngine::activate
AfterInputMethod 

Action shown after input method group.

Definition at line 27 of file statusarea.h.

◆ UserInterfaceComponent

Enumerator
InputPanel 

Input Panel component.

See also
InputPanel
StatusArea 

Status Area component.

See also
StatusArea

Definition at line 23 of file userinterface.h.

Function Documentation

◆ addon()

AddonInstance * fcitx::AddonManager::addon ( const std::string &  name,
bool  load = false 
)

Get the loaded addon instance.

Parameters
namename of addon.
loadto force load the addon if possible.
Returns
instance of addon.

Definition at line 319 of file addonmanager.cpp.

◆ addonInfo()

const AddonInfo * fcitx::AddonManager::addonInfo ( const std::string &  name) const

Get addon information for given addon.

Parameters
namename of addon.
Returns
const fcitx::AddonInfo*

Definition at line 333 of file addonmanager.cpp.

◆ AddonManager()

fcitx::AddonManager::AddonManager ( const std::string &  addonConfigDir)

Create addon manager with given addon config dir.

By default, addonConfigDir is set to "addon". It can be a relative path to PkgData, or an absolute path. This function is only used by test.

Parameters
addonConfigDirdirectory name.
See also
StandardPath

Definition at line 215 of file addonmanager.cpp.

◆ capabilityFlags()

CapabilityFlags fcitx::InputContext::capabilityFlags ( ) const

Returns the current capability flags.

See also
CapabilityFlag

Definition at line 171 of file inputcontext.cpp.

◆ checkUpdate() [1/2]

bool fcitx::InputMethodManager::checkUpdate ( ) const

Check if there is new entries could be loaded.

Returns
whether need to perform update.
See also
InputMethodManager::refresh

Definition at line 449 of file inputmethodmanager.cpp.

◆ checkUpdate() [2/2]

bool fcitx::AddonManager::checkUpdate ( ) const

Check directory for quick hint for whether update is required.

Since
5.0.6

Definition at line 381 of file addonmanager.cpp.

◆ commitStringImpl()

virtual void fcitx::InputContext::commitStringImpl ( const std::string &  text)
protectedpure virtual

Send the committed string to client.

Parameters
textstring
See also
commitString

◆ copyTo()

virtual void fcitx::InputContextProperty::copyTo ( InputContextProperty )
inlinevirtual

copy state to another property.

Default implemenation is empty. This is triggered by InputContext::updateProperty.

See also
InputContext::updateProperty

Definition at line 48 of file inputcontextproperty.h.

◆ create()

virtual AddonInstance* fcitx::AddonFactory::create ( AddonManager manager)
pure virtual

Create a addon instance for given addon manager.

This function is called by AddonManager

Returns
a created addon isntance.
See also
AddonManager

◆ created()

void fcitx::InputContext::created ( )
protected

Notifies the creation of input context.

Need to be called at the end of the constructor.

Definition at line 73 of file inputcontext.cpp.

◆ deleteSurroundingTextImpl()

virtual void fcitx::InputContext::deleteSurroundingTextImpl ( int  offset,
unsigned int  size 
)
protectedpure virtual

Send the delete Surrounding Text request to client.

Parameters
offsetoffset of deletion start, in UCS4 char.
sizelength of the deletion in UCS4 char.

◆ deleteText()

void fcitx::SurroundingText::deleteText ( int  offset,
unsigned int  size 
)

Delete surrounding text with offset and size.

This can be used to update the local state of surrounding text before client send it back.

Parameters
offsetoffset to cursor position.
sizelength of text to delete.

Definition at line 98 of file surroundingtext.cpp.

◆ destroy()

void fcitx::InputContext::destroy ( )
protected

Notifies the destruction of the input context.

Need to be called in the destructor.

Definition at line 78 of file inputcontext.cpp.

◆ display()

std::string fcitx::InputContext::display ( ) const

Returns the display server of the client.

In form of type:string, E.g. client from X11 server of :0 will become x11::0.

Definition at line 99 of file inputcontext.cpp.

◆ eventLoop()

EventLoop * fcitx::AddonManager::eventLoop ( )

Return the associated event loop.

If AddonManager is created by Instance, it will return the event loop of associated instance.

Returns
event loop.

Definition at line 371 of file addonmanager.cpp.

◆ FCITX_DECLARE_SIGNAL() [1/3]

fcitx::InputMethodManager::FCITX_DECLARE_SIGNAL ( InputMethodManager  ,
CurrentGroupAboutToChange  ,
void(const std::string &group  
)

◆ FCITX_DECLARE_SIGNAL() [2/3]

fcitx::InputMethodManager::FCITX_DECLARE_SIGNAL ( InputMethodManager  ,
GroupAdded  ,
void(const std::string &group  
)

Emit the signal when a new group is added.

This will not be emitted when building the group.

See also
InputMethodManager::addEmptyGroup
Since
5.0.8

◆ FCITX_DECLARE_SIGNAL() [3/3]

fcitx::InputMethodManager::FCITX_DECLARE_SIGNAL ( InputMethodManager  ,
GroupRemoved  ,
void(const std::string &group  
)

Emit the signal when a group is removed.

This will not be emitted when building the group.

See also
InputMethodManager::removeGroup
Since
5.0.8

◆ foreachEntries()

bool fcitx::InputMethodManager::foreachEntries ( const std::function< bool(const InputMethodEntry &entry)> &  callback)

Enumerate all the input method entries.

Returns
return true if the enumeration is done without interruption.

Definition at line 430 of file inputmethodmanager.cpp.

◆ forwardKeyImpl()

virtual void fcitx::InputContext::forwardKeyImpl ( const ForwardKeyEvent key)
protectedpure virtual

Send the forwarded key to client.

See also
forwardKey

◆ hasFocus()

bool fcitx::InputContext::hasFocus ( ) const

Returns whether the input context holds the input focus.

Input context need to have focus.

Definition at line 246 of file inputcontext.cpp.

◆ instance()

Instance * fcitx::AddonManager::instance ( )

Return the fcitx instance when it is created by Fcitx.

Returns
fcitx instance.

Definition at line 355 of file addonmanager.cpp.

◆ load() [1/2]

void fcitx::InputMethodManager::load ( const std::function< void(InputMethodManager &)> &  buildDefaultGroupCallback = {})

Load the input method information from disk.

If it does not exist, use the callback to create the default setup.

Definition at line 217 of file inputmethodmanager.cpp.

◆ load() [2/2]

void fcitx::AddonManager::load ( const std::unordered_set< std::string > &  enabled = {},
const std::unordered_set< std::string > &  disabled = {} 
)

Load addon based on given parameter.

By default, addon is enable or disabled by config file, but enabled or disabled may be used to override it.

Usually this function should only be called once. You can pass –enable=... –disable= in fcitx's flag to set it. "enabled" will override "disabled" if they have same addon name in it.

A special name "all" can be used to enable or disable all addons.

Parameters
enabledset of additionally enabled addons.
disabledset of disabled addons

Definition at line 243 of file addonmanager.cpp.

◆ program()

const std::string & fcitx::InputContext::program ( ) const

Returns the program name of input context.

It can be empty depending on the application.

Definition at line 94 of file inputcontext.cpp.

◆ propertyAs()

template<typename T >
T* fcitx::InputContext::propertyAs ( const std::string &  name)
inline

Helper function to return the input context property in specific type.

Parameters
Ttype of the input context property.
namename of the input context property.
Returns
T*

Definition at line 220 of file inputcontext.h.

◆ propertyFor()

template<typename T >
T::PropertyType* fcitx::InputContext::propertyFor ( const T *  factory)
inline

Helper function to return the input context property in specific type by given factory.

Parameters
Ttype of the input context property factory.
namename of the input context property.
Returns
T*

Definition at line 233 of file inputcontext.h.

◆ refresh()

void fcitx::InputMethodManager::refresh ( )

Load new input method configuration file from disk.

It only load "new" input method configuration, and it would not update the loaded data. Should only be used after load is called.

Definition at line 242 of file inputmethodmanager.cpp.

◆ registerDefaultLoader()

void fcitx::AddonManager::registerDefaultLoader ( StaticAddonRegistry *  registry)

Register addon loader, including static and shared library loader.

This function usually need to be called before any other function call to adddon manager.

Parameters
registrystatic addon registry that can be used to set a list of built-in addons.

Definition at line 236 of file addonmanager.cpp.

◆ registered()

bool fcitx::InputContextPropertyFactory::registered ( ) const

Return whether the factory is already registered with an InputContextManager.

Definition at line 17 of file inputcontextproperty.cpp.

◆ registerLoader()

void fcitx::AddonManager::registerLoader ( std::unique_ptr< AddonLoader loader)

Register new addon loader.

Parameters
loaderaddon loader instance.

Definition at line 222 of file addonmanager.cpp.

◆ reset()

void fcitx::InputContext::reset ( )

Called when input context state need to be reset.

Input context need to have focus.

Definition at line 291 of file inputcontext.cpp.

◆ save()

void fcitx::InputMethodManager::save ( )

Save the input method information to disk.

Commonly, the storage path will be ~/.config/fcitx5/profile.

Definition at line 396 of file inputmethodmanager.cpp.

◆ saveAll()

void fcitx::AddonManager::saveAll ( )

Save all addon configuration.

See also
fcitx::AddonInstance::save

Definition at line 305 of file addonmanager.cpp.

◆ setBlockEventToClient()

void fcitx::InputContext::setBlockEventToClient ( bool  block)

Prevent event deliver to input context, and re-send the event later.

This should be only used by frontend to make sync and async event handled in the same order.

Parameters
blockblock state of input context.
See also
InputContextEventBlocker

Definition at line 312 of file inputcontext.cpp.

◆ setCapabilityFlags()

void fcitx::InputContext::setCapabilityFlags ( CapabilityFlags  flags)

Update the capability flags of the input context.

See also
CapabilityFlag

Definition at line 155 of file inputcontext.cpp.

◆ setCurrentGroup()

void fcitx::InputMethodManager::setCurrentGroup ( const std::string &  group)

Set the name of current group, rest of the group order will be adjusted accordingly.

Definition at line 259 of file inputmethodmanager.cpp.

◆ setCursor()

void fcitx::SurroundingText::setCursor ( unsigned int  cursor,
unsigned int  anchor 
)

Set current cursor and anchor of surrounding text.

If cursor and anchor are out of range, it will be reset to invalid state. This function is useful to safe some bandwidth.

Parameters
cursoroffset of cursor in character.
anchoroffset of anchor in character.

Definition at line 88 of file surroundingtext.cpp.

◆ setDefaultInputMethod()

void fcitx::InputMethodManager::setDefaultInputMethod ( const std::string &  name)

Set default input method for current group.

See also
InputMethodGroup::setDefaultInputMethod

Definition at line 295 of file inputmethodmanager.cpp.

◆ setEventLoop()

void fcitx::AddonManager::setEventLoop ( EventLoop eventLoop)

Set event loop.

It should be only used with stand alone AddonManager. E.g. write test or for some special purpose.

Parameters
eventLoopevent loop.
See also
fcitx::AddonManager::eventLoop

Definition at line 366 of file addonmanager.cpp.

◆ setFocusGroup()

void fcitx::InputContext::setFocusGroup ( FocusGroup group)

Set the focus group of this input context.

group can be null if it does not belong to any group.

See also
FocusGroup

Definition at line 209 of file inputcontext.cpp.

◆ setGroup()

void fcitx::InputMethodManager::setGroup ( InputMethodGroup  newGroupInfo)

Update the information of an existing group.

The group info will be revalidated and filtered to the existing input methods.

Definition at line 307 of file inputmethodmanager.cpp.

◆ setGroupOrder()

void fcitx::InputMethodManager::setGroupOrder ( const std::vector< std::string > &  groups)

Update the initial order of groups.

This function should be only used in the buildDefaultGroupCallback. Otherwise the group order can be only modified via setCurrentGroup.

Parameters
groupsthe order of groups.
See also
InputMethodManager::load

Definition at line 441 of file inputmethodmanager.cpp.

◆ setText()

void fcitx::SurroundingText::setText ( const std::string &  text,
unsigned int  cursor,
unsigned int  anchor 
)

Set current of surrounding text.

If cursor and anchor are out of range, it will be reset to invalid state.

Parameters
texttext
cursoroffset of cursor in character.
anchoroffset of anchor in character.

Definition at line 72 of file surroundingtext.cpp.

◆ splitByLine()

std::vector< Text > fcitx::Text::splitByLine ( ) const

Split Text object into lines.

Returns
lines.
Since
5.0.6

Definition at line 122 of file text.cpp.

◆ surroundingText()

SurroundingText & fcitx::InputContext::surroundingText ( )

Returns the mutable surrounding text of the input context.

updateSurroundingText() need to be called after changes by frontend.

See also
InputContext::updateSurroundingText SurroundingText

Definition at line 297 of file inputcontext.cpp.

◆ unload()

void fcitx::AddonManager::unload ( )

Destruct all addon, all information is cleared to the initial state.

But depending on the addon it loads, it may have some leftover data in the memory.

Definition at line 288 of file addonmanager.cpp.

◆ unregisterLoader()

void fcitx::AddonManager::unregisterLoader ( const std::string &  name)

Unregister addon loader.

Parameters
namename of addon type.

Definition at line 231 of file addonmanager.cpp.

◆ updateClientSideUIImpl()

void fcitx::InputContext::updateClientSideUIImpl ( )
protectedvirtual

Send the UI update to client.

See also
CapabilityFlag::ClientSideUI

Definition at line 373 of file inputcontext.cpp.

◆ updatePreedit()

void fcitx::InputContext::updatePreedit ( )

Notifies client about changes in clientPreedit.

See also
InputPanel::clientPreedit

Definition at line 349 of file inputcontext.cpp.

◆ updatePreeditImpl()

virtual void fcitx::InputContext::updatePreeditImpl ( )
protectedpure virtual

Send the preedit update to the client.

See also
updatePreedit

◆ updateProperty() [1/2]

void fcitx::InputContext::updateProperty ( const std::string &  name)

Notifes the change of a given input context property.

Parameters
namename of the input context property.
See also
InputContextProperty::copyTo

Definition at line 129 of file inputcontext.cpp.

◆ updateProperty() [2/2]

void fcitx::InputContext::updateProperty ( const InputContextPropertyFactory factory)

Notifes the change of a given input context property by its factory.

Parameters
namename of the input context property.
See also
InputContextProperty::copyTo

Definition at line 138 of file inputcontext.cpp.

◆ updateUserInterface()

void fcitx::InputContext::updateUserInterface ( UserInterfaceComponent  component,
bool  immediate = false 
)

Notifies UI about changes in user interface.

Parameters
componentThe components of UI that need to be updated.
immediateimmediately flush the update to UI.
See also
UserInterfaceComponent InputPanel StatusArea

Definition at line 357 of file inputcontext.cpp.