= SDLSKK
* ((<Japanese input system by SDLSKK>))
* ((<SDL::SKK::Context>))
* ((<SDL::SKK::Dictionary>))
* ((<SDL::SKK::Keybind>))
* ((<SDL::SKK::RomKanaRuleTable>))
* SDLSKK methods
TOC

== Japanese input system by SDLSKK
Ruby/SDL has 
((<SKK|URL:http://openlab.jp/skk/index-j.html>))-like
Japanese input system by 
((<SDLSKK|URL:http://www.kmc.gr.jp/~ohai/sdlskk.html>)).

This system enables you not only to input Japanse
but also to handle line input including 
cut and paste.

Please see sample/sdlskk.rb.

== SDL::SKK
This module has some SDLSKK-related module functions
and classes.

METHODS(SKK)

== SDL::SKK::Context
This class represents input state.

METHODS(SKK::Context)

== SDL::SKK::Dictionary
This class represents a Kana-Kanji dictionary.
Load SKK dictionary from files.

METHODS(SKK::Dictionary)

== SDL::SKK::Keybind
This class represents keybind.

METHODS(SKK::Keybind)

== SDL::SKK::RomKanaRuleTable
This class represents the translation table
from Romaji(Alphabet) to Kana.
Load text data from a file and create new table object.

METHODS(SKK::RomKanaRuleTable)

== SDLSKK methods
%%%
NAME encoding=
MOD SKK
TYPE .
DEP SDLSKK
PURPOSE Set SDLSKK internal encoding

PROTO
encoding=(encoding)

DESC
Sets SDLSKKK internal encoding to $[encoding].
Following constants are allowed:
* SDL::SKK::EUCJP
* SDL::SKK::UTF8
* SDL::SKK::SJIS
Default is SDL::SKK::EUCJP.

This encoding determines 
the encoding of @[dictionary files|SKK::Dictionary#load],
@[a romaji-kana translation table file|SKK::RomKanaRuleTable.new]
and @[private dictionary|SKK::Dictionary#save].

NOTES
This function should call once before calling other
SDLSKK methods.

SEEALSO
SKK.encoding
SKK::Dictionary#load
SKK::Dictionary#save
SKK::RomKanaRuleTable.new

%%
NAME encoding
MOD SKK
TYPE .
DEP SDLSKK
PURPOSE Get SDLSKK internal encoding
RVAL UINT

PROTO
encoding

DESC
Returns the SDLSKK internal encoding. Please see
@[SKK.encoding=] for more detail.

SEEALSO
SKK.encoding=

%%
NAME new
MOD SKK::RomKanaRuleTable
TYPE .
DEP SDLSKK
PURPOSE Load a Romaji-Kana trasnlation table
RVAL SDL::SKK::RomKanaRuleTable

PROTO
new(filename)

DESC
Load a Romaji-Kana trasnlation table from $[filename].
File format is:
* a line beginnig with ;; is comment
* empty line is ignored
* one entry per one line: <input alphabets><TAB><Katakana><TAB><Hiragana>
  
NOTES
Encoding of this file is set by @[SKK.encoding=]
before loading it.

SEEALSO
SKK::Context.new

%%
NAME new
MOD SKK::Dictionary
TYPE .
DEP SDLSKK
PURPOSE Create empty dictionary
RVAL SDL::SKK::Dictionary

PROTO
new

DESC
Creates empty dictionary object and returns it.

SEEALSO
SKK::Dictionary#load

%%
NAME load
MOD SKK::Dictionary
TYPE #
DEP SDLSKK
PURPOSE Read a dictionary file

PROTO
load(filename, user)

DESC
Read a dictionary data from $[filename]. 
Format of dictionary is same as of SKK
(Ruby/SDL cannot read data with annotations).
If $[user] is true, loaded data is treated as
user dictionary data. If $[user] is false,
loaded data is treated as system dictionary data.

NOTES
Encoding of this file is set by @[SKK.encoding=]
before loading it.

EXCEPTION *

SEEALSO
SKK::Dictionary.new
SKK::Dictionary#save
SKK::Context.new

%%
NAME save
MOD SKK::Dictionary
TYPE #
DEP SDLSKK
PURPOSE Save user dictionary data

PROTO
save(filename)

DESC
Save user dictionary data into $[filename].

SEEALSO
SKK::Dictionary.new
SKK::Dictionary#load

%%
NAME new
MOD SKK::Keybind
TYPE .
DEP SDLSKK
PURPOSE Create empty keybind
RVAL SDL::SKK::Keybind

PROTO
new

DESC
Creates empty keybind object and returns it.
Add keybind to this object using
@[SKK::Keybind#set_key] and @[SKK::Keybind#set_default_key].

SEEALSO
SKK::Keybind#set_key
SKK::Keybind#set_default_key
SKK::Context.new

%%
NAME set_key
MOD SKK::Keybind
TYPE #
DEP SDLSKK
PURPOSE Set keybind

PROTO
set_key(key_str, cmd_str)

DESC
Sets keybind. $[key_str] is a key-symbol string.
$[cmd_str] is command string.

Following strings are allowed as $[key_str]:
* Alphabet and ascii characters like "%"
* "SPC" "TAB" "DEL" "RET" "UP" "DOWN" "RIGHT" "LEFT" "INSERT" "HOME" "END"
  "PAGEUP" "PAGEDOWN" "F1" "F2" "F3" "F4" "F5" "F6" "F7" "F8" "F9" "F10"
  "F11" "F12" "F13" "F14" "F15" "HELP"
* key with modifiers like "C-a" and "M-C-a"

Following strings is allowed as $[cmd_str]:
* "backward-char",
* "forward-char",
* "backward-delete-char",
* "delete-char",
* "kakutei",
* "kettei",
* "space",
* "keyboard-quit",
* "set-mark-command",
* "kill-region",
* "yank",
* "copy",
* "graph-char",
* "upper-char",
* "lower-char",
* "abbrev-input",
* "latin-mode",
* "previous-candidate",
* "jisx0208-mode",
* "toggle-kana",
* "beginning-of-line"
* "end-of-line"
* "do-nothing"

You shouldn't change the keybind of only one ascii character key
like "a" and "/".

@[SKK::Keybind#set_default_key] is useful.

SEEALSO
SKK::Keybind#set_default_key
SKK::Keybind#unset_key

%%
NAME set_default_key
MOD SKK::Keybind
TYPE #
DEP SDLSKK
PURPOSE Load default Emacs-like keybinds

PROTO
set_default_key

DESC
Load default Emacs-like keybinds.

SEEALSO
SKK::Keybind#set_key

%%
NAME unset_key
MOD SKK::Keybind
TYPE #
DEP SDLSKK
PURPOSE Unset keybind

PROTO
unset_key(key_str)

DESC
Unset keybind of $[key_str].

SEEALSO
SKK::Keybind#set_key

%%
NAME new
MOD SKK::Context
TYPE .
DEP SDLSKK
PURPOSE Create new input context
RVAL SKK::Context

PROTO
new(dict, romkama_table, bind, use_minibuffer)

DESC
Creates input context and returns new @[SKK::Context] object.
$[dict] is a @[dictionary|SKK::Dictionary],
$[romkama_table] is a
@[Ronaji-Kana translation table|SKK::RomKanaRuleTable]
and $[bind] is @[keybind|SKK::Keybind].
If $[use_minibuffer] is true, 
SKK-like minibuffer is enabled.

EXAMPLE
# Create dictionary object and read data from 'jisyo'
dict = SDL::SKK::Dictionary.new
dict.load( 'jisyo', false )
# Read Romaji-Kana translation table from 'rule_table'
table = SDL::SKK::RomKanaRuleTable.new( 'rule_table' )
# Set keybind
bind = SDL::SKK::Keybind.new
bind.set_default_key

# Create context
context = SDL::SKK::Context.new( dict, table, bind, use_minibuffer )

SEEALSO
SKK::Context#input
SKK::Context#str

%%
NAME input
MOD SKK::Context
TYPE #
DEP SDLSKK
PURPOSE Handle keyboard event

PROTO
input(event)

DESC
Handles keyboard event. $[event] should be 
@[Event] object.
This method handles only @[keydown events|Event::KeyDown]
and ignore other events.

EXAMPLE
while event = SDL::Event.poll do
  case event
  when SDL::Event::Quit
    exit
  when SDL::Event::KeyDown
    if event.sym == SDL::Key::ESCAPE then
      exit
    end
    if event.sym == SDL::Key::F1
      dict.save("test_user_dict")
    end
    context.input( event )      
  end
end

%%
NAME str
MOD SKK::Context
TYPE #
DEP SDLSKK
PURPOSE Get input string
RVAL String

PROTO
str

DESC
Returns input string.

NOTES
If Ruby/SDL m17n support is enabled,
the string with proper encoding will be returned.

SEEALSO
SKK::Context#render_str
SKK::Context#clear
SKK::Context#clear_text
SKK.encoding

%%
NAME render_str
MOD SKK::Context
TYPE #
DEP SDLSKK
PURPOSE Render input string
RVAL SDL::Surface

PROTO
render_str(font, r, g, b)

DESC
Renders input string and returns @[Surface] object.

SEEALSO
SKK::Context#render_minibuffer_str

%%
NAME render_minibuffer_str
MOD SKK::Context
TYPE #
DEP SDLSKK
PURPOSE Render minibuffer string

PROTO
render_minibuffer_str(font, r, g, b)

DESC
Renders minibuffer string and returns @[Surface] object.

%%
NAME clear
MOD SKK::Context
TYPE #
DEP SDLSKK
PURPOSE Clear context

PROTO
clear

DESC
Clears input context.

SEEALSO
SKK::Context#clear_text

%%
NAME clear_text
MOD SKK::Context
TYPE #
DEP SDLSKK
PURPOSE Creat input text

PROTO
clear_text

DESC
Clears input text, but input mode is held.

If you want multi-line input, this method is better
than @[SKK::Context#clear]

SEEALSO
SKK::Context#get_basic_mode

%%
NAME get_basic_mode
MOD SKK::Context
TYPE #
DEP SDLSKK
PURPOSE Get whether input mode is basic mode
RVAL true/false

PROTO
get_basic_mode

DESC
Returns true if $[self]'s input mode is kakutei-mode,
latin-mode or jisx0208-latim-mode, otherwise returns
false.

NOTES
Please see ((<SKK|URL:http://openlab.jp/skk/index.html>)).

SEEALSO
SKK::Context#clear_text
