Logo Search packages:      
Sourcecode: ucimf-openvanilla version File versions  Download package

OpenVanilla.h File Reference


Detailed Description

OpenVanilla Framework OpenVanilla.org OpenVanilla is a collection of popular Chinese, Taiwanese, Japanese and symbol input methods and language tools, and there are already OpenVanilla installation package for Mac OS X, Windows and Linux platform.

However, in the point of view of developers, OpenVanilla is not only an Inpur Method software, but a cross-platform Input Method/Text Proccessing framework.

The OpenVanilla framework composites two main parts. One is the core loader, while another part is the collection of modules (or so-called plugins). The core loader's work is to communicate with the system Input Method APIs, such as the IME (Input Method Editor) architecture on Microsoft Windows platform, TSM (Text Service Manager) and IMK (Input Method Kit) architectures on Mac OS X, and so on. Another work of the core loader is to load the module, the modules are dynamic loadable binary files.

In other words, OpenVanilla provides an abstract interface between the Input Method engines and the system Input Method APIs. By the implementation of an OpenVnailla Inpue Method module, you need not to rewrite your codes for varied platforms just because the system APis are varied.

The core of the OpenVanilla framework is just a concept, a header file, or just several simple C++ classes which define the basic but flexible properties that an Input Method should have, the events it should handle and the tools it could use.

To work with your own Input Method module, just implemet the OVInputMethod class by providing an unique identifier and localized name, and creating an Input Method context (the OVInputMethodContext class) to handle keyboard events. The keyEvent method is the function to proccess/translate the keyboard events to corresponding text to output to the current application. The keyboard events are defined in the OVKeyCode class.

There are two main tools that an Input Method module could use while proccessing the keyboard events, they are the pre-edit buffer (OVBuffer) and the candidate list window (OVCandidate). If your Input Method needs to use several keys as components to compose a character, like most Chinese and Japanese Input Methods and so on, you can use the pre-edit buffer to display the components by calling the append() method to append a component to current content of the buffer, and call the send() method to send the content of the buffer to the current application.

If there are two or more results matching to the combination of the components, you may ask users to choose one of these results. In this case, you should use the candidate list window. You can decide the content of the window, and ask it to be shown and hidden.

If your module offers extra settings which allow users to customize the behaviours, your can read the settings from the configuration file in the initialize() method in your module. The settings of your module is restored in the OVDictionary object which contains varied string and integer values. You can use the update() method to write the settings.

You can also obtain the file path of your module in the initialize() method. That means, if your Input Method need to load extra resources such as a database file and so on, you can specify the path of your database file when the loader is calling the initialize() method of modules.

The OVService class also supports some simple tools that your module can use, for example, if you need to make an alert sound when the users input wrong keys, you can call the beep() method. And if you want to show some messages to notify the users, just call the notify() method.

The OpenVanilla Framework also has a kind of module which is called Output Filter. Unlike an Input Method module which handles the keyboard events, an Output Filter module haneles the output text of an Input Method module. For example, when a user typed a character in Traditional Chinese, he or she can use an Output Filter module to convert the character to Simplified Chinese. So he or she can use his or her favorite Traditional Chinese Input Method to type Simplified Chinese without learning any Simplified Chinese Input Methods.

Most methods in an Ouput Filter module are the same as the methods in an Input Method module. The difference between an Output Filter and an Input Method modules is, an Output Filter has no Input Method context, and you need to implement the process() method. You can obtain the source text to convert in this method, and just return the converted result.

Definition in file OpenVanilla.h.

Go to the source code of this file.

Classes

class  OVBase
class  OVBuffer
class  OVCandidate
class  OVDictionary
class  OVInputMethod
class  OVInputMethodContext
class  OVKeyCode
class  OVModule
class  OVOutputFilter
class  OVService

Defines

#define OV_VERSION   (0x00080000)

Enumerations

enum  {
  ovkEsc = 27, ovkSpace = 32, ovkReturn = 13, ovkDelete = 127,
  ovkBackspace = 8, ovkUp = 30, ovkDown = 31, ovkLeft = 28,
  ovkRight = 29, ovkHome = 1, ovkEnd = 4, ovkPageUp = 11,
  ovkPageDown = 12, ovkTab = 9
}


Generated by  Doxygen 1.6.0   Back to index