SkkContext

SkkContext — Main entry point of libskk.

Functions

Properties

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

Signals

gboolean delete-surrounding-text Run Last
void request-selection-text Run Last
gboolean retrieve-surrounding-text Run Last

Types and Values

Object Hierarchy

    GEnum
    ╰── SkkInputMode
    GObject
    ╰── SkkContext

Description

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

Functions

skk_context_add_dictionary ()

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

Register dictionary.

Parameters

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.

Parameters

self

the SkkContext instance

 

dict

 .

a dictionary

.

[in]

Since: 0.0.8


skk_context_set_selection_text ()

void
skk_context_set_selection_text (SkkContext *self,
                                const gchar *text);

Set the current selection text.

Parameters

self

the SkkContext instance

 

text

 .

selection text

.

[in][allow-none]

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.

Parameters

self

the SkkContext instance

 

keyseq

 .

a string representing key events, separated 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.

Parameters

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.

Parameters

self

the SkkContext instance

 

skk_context_get_output ()

gchar *
skk_context_get_output (SkkContext *self);

This is replaced with skk_context_poll_output().

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

self

the SkkContext instance

 

error

location to store the error occurring, or NULL to ignore

 

skk_context_new ()

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

Create a new Context.

Parameters

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,
                              gint *result_length1);

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

Dictionaries.

Parameters

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,
                              gint value_length1);

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

Dictionaries.

Parameters

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.

Current candidates.

Parameters

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.

Current input mode.

Parameters

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 .

Current input mode.

Parameters

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,
                                gint *result_length1);

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

Array of strings which triggers automatic conversion.

Parameters

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,
                                gint value_length1);

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

Array of strings which triggers automatic conversion.

Parameters

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.

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

Parameters

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 .

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

Parameters

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.

Period style used in romaji-to-kana conversion.

Parameters

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 .

Period style used in romaji-to-kana conversion.

Parameters

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.

The name of typing rule.

Parameters

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 .

The name of typing rule.

Parameters

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.

Filter which runs before process_key_event.

This is particularly useful for NICOLA.

Parameters

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.

Current preedit string.

Parameters

self

the SkkContext instance to query

 

Returns

the value of the "preedit" property


skk_init ()

void
skk_init (void);

Initialize libskk.

Must be called before using any functions in libskk.

Parameters

self

the (null) instance

 

Types and Values

SKK_TYPE_CONTEXT

#define SKK_TYPE_CONTEXT (skk_context_get_type ())

The type for SkkContext.


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.

Members


enum SkkInputMode

Type to specify input modes.

Members

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

Array of strings which triggers automatic conversion.

Owner: SkkContext

Flags: Read / Write


The “candidates” property

  “candidates”               SkkCandidateList *

Current candidates.

Owner: SkkContext

Flags: Read


The “egg-like-newline” property

  “egg-like-newline”         gboolean

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

Owner: SkkContext

Flags: Read / Write

Default value: FALSE


The “input-mode” property

  “input-mode”               SkkInputMode

Current input mode.

Owner: SkkContext

Flags: Read / Write

Default value: SKK_INPUT_MODE_HIRAGANA


The “key-event-filter” property

  “key-event-filter”         SkkKeyEventFilter *

Filter which runs before process_key_event.

This is particularly useful for NICOLA.

See also: SkkNicolaKeyEventFilter

Owner: SkkContext

Flags: Read


The “period-style” property

  “period-style”             SkkPeriodStyle

Period style used in romaji-to-kana conversion.

Owner: SkkContext

Flags: Read / Write

Default value: SKK_PERIOD_STYLE_JA_JA


The “preedit” property

  “preedit”                  gchar *

Current preedit string.

Owner: SkkContext

Flags: Read

Default value: NULL


The “typing-rule” property

  “typing-rule”              SkkRule *

The name of typing rule.

Owner: SkkContext

Flags: Read / Write

Signal Details

The “delete-surrounding-text” signal

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

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

Parameters

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

Flags: Run Last


The “request-selection-text” signal

void
user_function (SkkContext *context,
               gpointer    user_data)

Parameters

context

the SkkContext instance that received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “retrieve-surrounding-text” signal

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

Signal emitted when the context requires surrounding-text.

Parameters

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

Flags: Run Last