KkcContext

KkcContext — Main entry point of libkkc.

Functions

Properties

gboolean auto-correct Read / Write
KkcCandidateList * candidates Read
KkcDictionaryList * dictionaries Read / Write
gchar * input Read
gint input-cursor-pos Read
guint input-cursor-width Read
KkcInputMode input-mode Read / Write
KkcKeyEventFilter * key-event-filter Read
KkcPunctuationStyle punctuation-style Read / Write
KkcSegmentList * segments Read
KkcRule * typing-rule Read / Write

Signals

void request-selection-text Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── KkcContext

Description

Functions

kkc_context_set_selection_text ()

void
kkc_context_set_selection_text (KkcContext *self,
                                const gchar *text);

Set the current selection text.

Parameters

self

the KkcContext instance

 

text

 .

selection text

.

[in][allow-none]

kkc_context_process_key_events ()

gboolean
kkc_context_process_key_events (KkcContext *self,
                                const gchar *keyseq,
                                GError **error);

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

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

Parameters

self

the KkcContext instance

 

keyseq

 .

a string representing key events, separated by " "

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains KkcKeyEventFormatError]

Returns

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


kkc_context_process_key_event ()

gboolean
kkc_context_process_key_event (KkcContext *self,
                               KkcKeyEvent *key);

Pass one key event to the context.

Parameters

self

the KkcContext instance

 

key

 .

a key event

.

[in]

Returns

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


kkc_context_reset ()

void
kkc_context_reset (KkcContext *self);

Reset the context.

Parameters

self

the KkcContext instance

 

kkc_context_has_output ()

gboolean
kkc_context_has_output (KkcContext *self);

Check if there is pending output

Parameters

self

the KkcContext instance

 

Returns

`true` if there is output, `false` otherwise


kkc_context_peek_output ()

gchar *
kkc_context_peek_output (KkcContext *self);

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

Parameters

self

the KkcContext instance

 

Returns

an output string


kkc_context_poll_output ()

gchar *
kkc_context_poll_output (KkcContext *self);

Poll (retrieve and remove) the current output string.

Parameters

self

the KkcContext instance

 

Returns

an output string


kkc_context_clear_output ()

void
kkc_context_clear_output (KkcContext *self);

Clear the output buffer.

Parameters

self

the KkcContext instance

 

kkc_context_new ()

KkcContext *
kkc_context_new (KkcLanguageModel *model);

Create a new Context.

Parameters

model

 .

a language model

.

[in]

Returns

a new Context


kkc_context_get_dictionaries ()

KkcDictionaryList *
kkc_context_get_dictionaries (KkcContext *self);

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

Dictionaries.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "dictionaries" property


kkc_context_set_dictionaries ()

void
kkc_context_set_dictionaries (KkcContext *self,
                              KkcDictionaryList *value);

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

Dictionaries.

Parameters

self

the KkcContext instance to modify

 

value

the new value of the "dictionaries" property

 

kkc_context_get_candidates ()

KkcCandidateList *
kkc_context_get_candidates (KkcContext *self);

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

Current candidates.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "candidates" property


kkc_context_get_segments ()

KkcSegmentList *
kkc_context_get_segments (KkcContext *self);

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

Current segments.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "segments" property


kkc_context_get_input ()

gchar *
kkc_context_get_input (KkcContext *self);

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

Current input string.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "input" property


kkc_context_get_input_cursor_pos ()

gint
kkc_context_get_input_cursor_pos (KkcContext *self);

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

Current cursor position in input string.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "input-cursor-pos" property


kkc_context_get_input_cursor_width ()

guint
kkc_context_get_input_cursor_width (KkcContext *self);

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

Current cursor width in input string.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "input-cursor-width" property


kkc_context_get_input_mode ()

KkcInputMode
kkc_context_get_input_mode (KkcContext *self);

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

Current input mode.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "input-mode" property


kkc_context_set_input_mode ()

void
kkc_context_set_input_mode (KkcContext *self,
                            KkcInputMode value);

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

Current input mode.

Parameters

self

the KkcContext instance to modify

 

value

the new value of the "input-mode" property

 

kkc_context_get_punctuation_style ()

KkcPunctuationStyle
kkc_context_get_punctuation_style (KkcContext *self);

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

Punctuation style used in romaji-to-kana conversion.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "punctuation-style" property


kkc_context_set_punctuation_style ()

void
kkc_context_set_punctuation_style (KkcContext *self,
                                   KkcPunctuationStyle value);

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

Punctuation style used in romaji-to-kana conversion.

Parameters

self

the KkcContext instance to modify

 

value

the new value of the "punctuation-style" property

 

kkc_context_get_auto_correct ()

gboolean
kkc_context_get_auto_correct (KkcContext *self);

Get and return the current value of the "auto-correct" property.

Flag to indicate if romaji-to-kana conversion is auto-corrected.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "auto-correct" property


kkc_context_set_auto_correct ()

void
kkc_context_set_auto_correct (KkcContext *self,
                              gboolean value);

Set the value of the "auto-correct" property to value .

Flag to indicate if romaji-to-kana conversion is auto-corrected.

Parameters

self

the KkcContext instance to modify

 

value

the new value of the "auto-correct" property

 

kkc_context_get_typing_rule ()

KkcRule *
kkc_context_get_typing_rule (KkcContext *self);

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

The name of typing rule.

Parameters

self

the KkcContext instance to query

 

Returns

the value of the "typing-rule" property


kkc_context_set_typing_rule ()

void
kkc_context_set_typing_rule (KkcContext *self,
                             KkcRule *value);

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

The name of typing rule.

Parameters

self

the KkcContext instance to modify

 

value

the new value of the "typing-rule" property

 

kkc_context_get_key_event_filter ()

KkcKeyEventFilter *
kkc_context_get_key_event_filter (KkcContext *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 KkcContext instance to query

 

Returns

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

Types and Values

KKC_TYPE_CONTEXT

#define KKC_TYPE_CONTEXT (kkc_context_get_type ())

The type for KkcContext.


struct KkcContext

struct KkcContext;

Main entry point of libkkc.


struct KkcContextClass

struct KkcContextClass {
	GObjectClass parent_class;
};

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

Members

Property Details

The “auto-correct” property

  “auto-correct”             gboolean

Flag to indicate if romaji-to-kana conversion is auto-corrected.

Flags: Read / Write

Default value: FALSE


The “candidates” property

  “candidates”               KkcCandidateList *

Current candidates.

Flags: Read


The “dictionaries” property

  “dictionaries”             KkcDictionaryList *

Dictionaries.

Flags: Read / Write


The “input” property

  “input”                    gchar *

Current input string.

Flags: Read

Default value: NULL


The “input-cursor-pos” property

  “input-cursor-pos”         gint

Current cursor position in input string.

Flags: Read

Default value: 0


The “input-cursor-width” property

  “input-cursor-width”       guint

Current cursor width in input string.

Flags: Read

Default value: 0


The “input-mode” property

  “input-mode”               KkcInputMode

Current input mode.

Flags: Read / Write

Default value: KKC_INPUT_MODE_HIRAGANA


The “key-event-filter” property

  “key-event-filter”         KkcKeyEventFilter *

Filter which runs before process_key_event.

This is particularly useful for NICOLA.

See also: KkcNicolaKeyEventFilter

Flags: Read


The “punctuation-style” property

  “punctuation-style”        KkcPunctuationStyle

Punctuation style used in romaji-to-kana conversion.

Flags: Read / Write

Default value: KKC_PUNCTUATION_STYLE_JA_JA


The “segments” property

  “segments”                 KkcSegmentList *

Current segments.

Flags: Read


The “typing-rule” property

  “typing-rule”              KkcRule *

The name of typing rule.

Flags: Read / Write

Signal Details

The “request-selection-text” signal

void
user_function (KkcContext *context,
               gpointer    user_data)

Parameters

context

the KkcContext instance that received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last