Fcitx provides several abstraction of user interface element, in order to display them on different user interface implementation. Basically, there is a input window, with four text field.
Table 1. Standard Input Window Layout
| Auxiliary Text Up | Preedit String |
| Auxiliary Text Down | Candidate Words |
There is also a user interface element called status, basically it defines a switch button. The icon name rule can be defined by user interface itself. (Defined in fcitx/ui.h)
/**
* @brief Fcitx Status icon to be displayed on the UI
**/
typedef struct _FcitxUIStatus {
/**
* @brief status name, will not displayed on the UI.
**/
char name[MAX_STATUS_NAME + 1];
/**
* @brief short desription for this status, can be displayed on the UI
**/
char shortDescription[MAX_STATUS_SDESC + 1];
/**
* @brief long description for this status, can be displayed on the UI
**/
char longDescription[MAX_STATUS_LDESC + 1];
/**
* @brief toogle function
**/
void (*toggleStatus)(void *arg);
/**
* @brief get current value function
**/
boolean (*getCurrentStatus)(void *arg);
/**
* @brief private data for the UI implementation
**/
void *priv;
/**
* @brief extra argument for tooglefunction
**/
void* arg;
} FcitxUIStatus;
Short Description and Long Description is tend to be display on the user interface, the addon should have it translated before register the status.
Another user interface element is a menu, which currently only support by fcitx-classic-ui and fcitx-light-ui. Due to the limitation of kimpanel, it cannot support fcitx style menu currently. (Defined in fcitx/ui.h)
/**
* @brief a menu entry in a menu.
**/
typedef struct _MenuShell
{
/**
* @brief The displayed string
**/
char tipstr[MAX_MENU_STRING_LENGTH + 1];
/**
* @brief Can be used by ui to mark it's selected or not.
**/
int isselect;
/**
* @brief The type of menu shell
**/
MenuShellType type;
/**
* @brief the submenu to this entry
**/
struct _FcitxUIMenu *subMenu;
} MenuShell;
/**
* @brief Fcitx Menu Component, a UI doesn't need to support it,
* This struct is used by other module to register a menu.
**/
typedef struct _FcitxUIMenu {
/**
* @brief shell entries for this menu
**/
UT_array shell;
/**
* @brief menu name, can be displayed on the ui
**/
char name[MAX_MENU_STRING_LENGTH + 1];
/**
* @brief you might want to bind the menu on a status icon, but this is only a hint,
* depends on the ui implementation
**/
char candStatusBind[MAX_STATUS_NAME + 1];
/**
* @brief update the menu content
**/
UpdateMenuShellFunction UpdateMenuShell;
/**
* @brief function for process click on a menu entry
**/
MenuActionFunction MenuAction;
/**
* @brief private data for this menu
**/
void *priv;
/**
* @brief ui implementation private
**/
void *uipriv;
/**
* @brief this is sub menu or not
**/
boolean isSubMenu;
/**
* @brief mark of this menu
**/
int mark;
} FcitxUIMenu;
Module who want to use menu or status icon should use RegisterStatus and RegisterMenu function. A User interface in order to support status icon or menu, should implement UpdateStatus, RegisterStatus, RegisterMenu callbacks.