SkkContext

SkkContext — Main entry point of libskk.

Synopsis

#define             SKK_TYPE_CONTEXT
void                skk_context_add_dictionary          (SkkContext *self,
                                                         SkkDict *dict);
void                skk_context_remove_dictionary       (SkkContext *self,
                                                         SkkDict *dict);
gboolean            skk_context_process_key_events      (SkkContext *self,
                                                         const gchar *keyseq);
gboolean            skk_context_process_key_event       (SkkContext *self,
                                                         SkkKeyEvent *key);
void                skk_context_reset                   (SkkContext *self);
gchar *             skk_context_get_output              (SkkContext *self);
gchar *             skk_context_peek_output             (SkkContext *self);
gchar *             skk_context_poll_output             (SkkContext *self);
void                skk_context_clear_output            (SkkContext *self);
void                skk_context_get_preedit_underline   (SkkContext *self,
                                                         guint *offset,
                                                         guint *nchars);
void                skk_context_save_dictionaries       (SkkContext *self,
                                                         GError **error);
SkkContext *        skk_context_new                     (SkkDict **dictionaries,
                                                         int dictionaries_length1);
SkkDict **          skk_context_get_dictionaries        (SkkContext *self,
                                                         int *result_length1);
void                skk_context_set_dictionaries        (SkkContext *self,
                                                         SkkDict **value,
                                                         int value_length1);
SkkCandidateList *  skk_context_get_candidates          (SkkContext *self);
SkkInputMode        skk_context_get_input_mode          (SkkContext *self);
void                skk_context_set_input_mode          (SkkContext *self,
                                                         SkkInputMode value);
gchar **            skk_context_get_auto_start_henkan_keywords
                                                        (SkkContext *self,
                                                         int *result_length1);
void                skk_context_set_auto_start_henkan_keywords
                                                        (SkkContext *self,
                                                         gchar **value,
                                                         int value_length1);
gboolean            skk_context_get_egg_like_newline    (SkkContext *self);
void                skk_context_set_egg_like_newline    (SkkContext *self,
                                                         gboolean value);
SkkPeriodStyle      skk_context_get_period_style        (SkkContext *self);
void                skk_context_set_period_style        (SkkContext *self,
                                                         SkkPeriodStyle value);
SkkRule *           skk_context_get_typing_rule         (SkkContext *self);
void                skk_context_set_typing_rule         (SkkContext *self,
                                                         SkkRule *value);
SkkKeyEventFilter * skk_context_get_key_event_filter    (SkkContext *self);
const gchar *       skk_context_get_preedit             (SkkContext *self);
struct              SkkContext;
struct              SkkContextClass;
void                skk_init                            (void);
enum                SkkInputMode;

Object Hierarchy

  GObject
   +----SkkContext
  GEnum
   +----SkkInputMode

Properties

  "auto-start-henkan-keywords" GStrv                 : Read / Write
  "candidates"               SkkCandidateList*     : Read
  "egg-like-newline"         gboolean              : Read / Write
  "input-mode"               SkkInputMode          : Read / Write
  "key-event-filter"         SkkKeyEventFilter*    : Read
  "period-style"             SkkPeriodStyle        : Read / Write
  "preedit"                  gchar*                : Read
  "typing-rule"              SkkRule*              : Read / Write

Signals

  "delete-surrounding-text"                        : Run Last
  "retrieve-surrounding-text"                      : Run Last

Description

Context represents an input context with support for SKK kana-kanji conversion method.

Details

SKK_TYPE_CONTEXT

#define SKK_TYPE_CONTEXT (skk_context_get_type ())

The type for SkkContext.


skk_context_add_dictionary ()

void                skk_context_add_dictionary          (SkkContext *self,
                                                         SkkDict *dict);

Register dictionary.

self :

the SkkContext instance

dict :

a dictionary. [in]

Since 0.0.8


skk_context_remove_dictionary ()

void                skk_context_remove_dictionary       (SkkContext *self,
                                                         SkkDict *dict);

Unregister dictionary.

self :

the SkkContext instance

dict :

a dictionary. [in]

Since 0.0.8


skk_context_process_key_events ()

gboolean            skk_context_process_key_events      (SkkContext *self,
                                                         const gchar *keyseq);

Pass key events (separated by spaces) to the context.

This function is rarely used in programs but in unit tests.

self :

the SkkContext instance

keyseq :

a string representing key events, seperated by " ". [in]

Returns :

`true` if any of key events are handled, `false` otherwise

skk_context_process_key_event ()

gboolean            skk_context_process_key_event       (SkkContext *self,
                                                         SkkKeyEvent *key);

Pass one key event to the context.

self :

the SkkContext instance

key :

a key event. [in]

Returns :

`true` if the key event is handled, `false` otherwise

skk_context_reset ()

void                skk_context_reset                   (SkkContext *self);

Reset the context.

self :

the SkkContext instance

skk_context_get_output ()

gchar *             skk_context_get_output              (SkkContext *self);

This is replaced with skk_context_poll_output().

self :

the SkkContext instance

Returns :

an output string Deprecated: 0.0.6

skk_context_peek_output ()

gchar *             skk_context_peek_output             (SkkContext *self);

Peek (retrieve, but not remove) the current output string.

self :

the SkkContext instance

Returns :

an output string

Since 0.0.6


skk_context_poll_output ()

gchar *             skk_context_poll_output             (SkkContext *self);

Poll (retrieve and remove) the current output string.

self :

the SkkContext instance

Returns :

an output string

Since 0.0.6


skk_context_clear_output ()

void                skk_context_clear_output            (SkkContext *self);

Clear the output buffer.

self :

the SkkContext instance

Since 0.0.6


skk_context_get_preedit_underline ()

void                skk_context_get_preedit_underline   (SkkContext *self,
                                                         guint *offset,
                                                         guint *nchars);

Get underlined range of preedit.

self :

the SkkContext instance

offset :

starting offset (in chars) of underline. [out]

nchars :

number of characters to be underlined. [out]

Since 0.0.6


skk_context_save_dictionaries ()

void                skk_context_save_dictionaries       (SkkContext *self,
                                                         GError **error);

Save dictionaries on to disk.

self :

the SkkContext instance

error :

location to store the error occuring, or NULL to ignore

skk_context_new ()

SkkContext *        skk_context_new                     (SkkDict **dictionaries,
                                                         int dictionaries_length1);

Create a new Context.

dictionaries :

an array of Dict. [in][array length=dictionaries_length1]

dictionaries_length1 :

length of the dictionaries array

Returns :

a new Context

skk_context_get_dictionaries ()

SkkDict **          skk_context_get_dictionaries        (SkkContext *self,
                                                         int *result_length1);

Get and return the current value of the "dictionaries" property.

self :

the SkkContext instance to query

Returns :

the value of the "dictionaries" property

skk_context_set_dictionaries ()

void                skk_context_set_dictionaries        (SkkContext *self,
                                                         SkkDict **value,
                                                         int value_length1);

Set the value of the "dictionaries" property to value.

self :

the SkkContext instance to modify

value :

the new value of the "dictionaries" property

skk_context_get_candidates ()

SkkCandidateList *  skk_context_get_candidates          (SkkContext *self);

Get and return the current value of the "candidates" property.

self :

the SkkContext instance to query

Returns :

the value of the "candidates" property

skk_context_get_input_mode ()

SkkInputMode        skk_context_get_input_mode          (SkkContext *self);

Get and return the current value of the "input-mode" property.

self :

the SkkContext instance to query

Returns :

the value of the "input-mode" property

skk_context_set_input_mode ()

void                skk_context_set_input_mode          (SkkContext *self,
                                                         SkkInputMode value);

Set the value of the "input-mode" property to value.

self :

the SkkContext instance to modify

value :

the new value of the "input-mode" property

skk_context_get_auto_start_henkan_keywords ()

gchar **            skk_context_get_auto_start_henkan_keywords
                                                        (SkkContext *self,
                                                         int *result_length1);

Get and return the current value of the "auto-start-henkan-keywords" property.

self :

the SkkContext instance to query

Returns :

the value of the "auto-start-henkan-keywords" property

skk_context_set_auto_start_henkan_keywords ()

void                skk_context_set_auto_start_henkan_keywords
                                                        (SkkContext *self,
                                                         gchar **value,
                                                         int value_length1);

Set the value of the "auto-start-henkan-keywords" property to value.

self :

the SkkContext instance to modify

value :

the new value of the "auto-start-henkan-keywords" property

skk_context_get_egg_like_newline ()

gboolean            skk_context_get_egg_like_newline    (SkkContext *self);

Get and return the current value of the "egg-like-newline" property.

self :

the SkkContext instance to query

Returns :

the value of the "egg-like-newline" property

skk_context_set_egg_like_newline ()

void                skk_context_set_egg_like_newline    (SkkContext *self,
                                                         gboolean value);

Set the value of the "egg-like-newline" property to value.

self :

the SkkContext instance to modify

value :

the new value of the "egg-like-newline" property

skk_context_get_period_style ()

SkkPeriodStyle      skk_context_get_period_style        (SkkContext *self);

Get and return the current value of the "period-style" property.

self :

the SkkContext instance to query

Returns :

the value of the "period-style" property

skk_context_set_period_style ()

void                skk_context_set_period_style        (SkkContext *self,
                                                         SkkPeriodStyle value);

Set the value of the "period-style" property to value.

self :

the SkkContext instance to modify

value :

the new value of the "period-style" property

skk_context_get_typing_rule ()

SkkRule *           skk_context_get_typing_rule         (SkkContext *self);

Get and return the current value of the "typing-rule" property.

self :

the SkkContext instance to query

Returns :

the value of the "typing-rule" property

skk_context_set_typing_rule ()

void                skk_context_set_typing_rule         (SkkContext *self,
                                                         SkkRule *value);

Set the value of the "typing-rule" property to value.

self :

the SkkContext instance to modify

value :

the new value of the "typing-rule" property

skk_context_get_key_event_filter ()

SkkKeyEventFilter * skk_context_get_key_event_filter    (SkkContext *self);

Get and return the current value of the "key-event-filter" property.

self :

the SkkContext instance to query

Returns :

the value of the "key-event-filter" property

skk_context_get_preedit ()

const gchar *       skk_context_get_preedit             (SkkContext *self);

Get and return the current value of the "preedit" property.

self :

the SkkContext instance to query

Returns :

the value of the "preedit" property

struct SkkContext

struct SkkContext;

Main entry point of libskk.

Context represents an input context with support for SKK kana-kanji conversion method.


struct SkkContextClass

struct SkkContextClass {
	GObjectClass parent_class;
};

The class structure for SKK_TYPE_CONTEXT. All the fields in this structure are private and should never be accessed directly.

GObjectClass parent_class;

the parent class structure

skk_init ()

void                skk_init                            (void);

Initialize libskk.

Must be called before using any functions in libskk.

self :

the (null) instance

enum SkkInputMode

typedef enum {
	SKK_INPUT_MODE_HIRAGANA = SKK_KANA_MODE_HIRAGANA,
	SKK_INPUT_MODE_KATAKANA = SKK_KANA_MODE_KATAKANA,
	SKK_INPUT_MODE_HANKAKU_KATAKANA = SKK_KANA_MODE_HANKAKU_KATAKANA,
	SKK_INPUT_MODE_LATIN,
	SKK_INPUT_MODE_WIDE_LATIN,
	SKK_INPUT_MODE_LAST,
	SKK_INPUT_MODE_DEFAULT = SKK_INPUT_MODE_HIRAGANA
} SkkInputMode;

Type to specify input modes.

SKK_INPUT_MODE_HIRAGANA

Hiragana like "あいう...".

SKK_INPUT_MODE_KATAKANA

Katakana like "アイウ...".

SKK_INPUT_MODE_HANKAKU_KATAKANA

Half-width katakana like "アイウ...".

SKK_INPUT_MODE_LATIN

Half-width latin like "abc...".

SKK_INPUT_MODE_WIDE_LATIN

Full-width latin like "abc...".

SKK_INPUT_MODE_LAST

SKK_INPUT_MODE_DEFAULT

The default.

Property Details

The "auto-start-henkan-keywords" property

  "auto-start-henkan-keywords" GStrv                 : Read / Write

Array of strings which triggers automatic conversion.


The "candidates" property

  "candidates"               SkkCandidateList*     : Read

Current candidates.


The "egg-like-newline" property

  "egg-like-newline"         gboolean              : Read / Write

Flag to indicate whether or not "\n" is consumed on commit.

Default value: FALSE


The "input-mode" property

  "input-mode"               SkkInputMode          : Read / Write

Current input mode.

Default value: SKK_INPUT_MODE_HIRAGANA


The "key-event-filter" property

  "key-event-filter"         SkkKeyEventFilter*    : Read

Filter which runs before process_key_event.

This is particularly useful for NICOLA.

See also: SkkNicolaKeyEventFilter


The "period-style" property

  "period-style"             SkkPeriodStyle        : Read / Write

Period style used in romaji-to-kana conversion.

Default value: SKK_PERIOD_STYLE_JA_JA


The "preedit" property

  "preedit"                  gchar*                : Read

Current preedit string.

Default value: NULL


The "typing-rule" property

  "typing-rule"              SkkRule*              : Read / Write

The name of typing rule.

Signal Details

The "delete-surrounding-text" signal

gboolean            user_function                      (SkkContext *context,
                                                        gint        offset,
                                                        guint       nchars,
                                                        gpointer    user_data)      : Run Last

Signal emitted when the context requests deletion of surrounding-text.

context :

the SkkContext instance that received the signal

offset :

character offset from the cursor position.

nchars :

number of characters to delete.

user_data :

user data set when the signal handler was connected.

Returns :

`true` on success, `false` on failure

The "retrieve-surrounding-text" signal

gboolean            user_function                      (SkkContext *context,
                                                        gpointer    text,
                                                        gpointer    cursor_pos,
                                                        gpointer    user_data)       : Run Last

Signal emitted when the context requires surrounding-text.

context :

the SkkContext instance that received the signal

text :

surrounding text

cursor_pos :

cursor position in text

user_data :

user data set when the signal handler was connected.

Returns :

`true` on success, `false` on failure