librime: editor.h Source File

| librime 1.2 Rime Input Method Engine, the core library

editor.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-10-23 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_EDITOR_H_
8#define RIME_EDITOR_H_
9
10#include <rime/common.h>
11#include <rime/component.h>
12#include <rime/key_event.h>
13#include <rime/processor.h>
14#include <rime/gear/key_binding_processor.h>
15
16namespace rime {
17
18class Context;
19
20 class Editor : public Processor, public KeyBindingProcessor<Editor> {
21 public:
22 typedef ProcessResult CharHandler(Context* ctx, int ch);
23 using CharHandlerPtr = ProcessResult (Editor::*)(Context* ctx, int ch);
24
25 Editor(const Ticket& ticket, bool auto_commit);
26 ProcessResult ProcessKeyEvent(const KeyEvent& key_event);
27
28 Handler Confirm;
29 Handler ToggleSelection;
30 Handler CommitComment;
31 Handler CommitScriptText;
32 Handler CommitRawInput;
33 Handler CommitComposition;
34 Handler RevertLastEdit;
35 Handler BackToPreviousInput;
36 Handler BackToPreviousSyllable;
37 Handler DeleteCandidate;
38 Handler DeleteChar;
39 Handler CancelComposition;
40
41 CharHandler DirectCommit;
42 CharHandler AddToInput;
43
44 protected:
45 void LoadConfig();
46
47 CharHandlerPtr char_handler_ = nullptr;
48};
49
50 class FluidEditor : public Editor {
51 public:
52 FluidEditor(const Ticket& ticket);
53};
54
55 class ExpressEditor : public Editor {
56 public:
57 ExpressEditor(const Ticket& ticket);
58};
59
60} // namespace rime
61
62#endif // RIME_EDITOR_H_
common.h
component.h
processor.h
key_event.h
key_binding_processor.h
rime
Definition algebra.cc:12
rime::ProcessResult
ProcessResult
Definition processor.h:18
rime::Context
Definition context.h:19
rime::Editor::CommitComposition
Handler CommitComposition
Definition editor.h:33
rime::Editor::RevertLastEdit
Handler RevertLastEdit
Definition editor.h:34
rime::Editor::Confirm
Handler Confirm
Definition editor.h:28
rime::Editor::CommitScriptText
Handler CommitScriptText
Definition editor.h:31
rime::Editor::CharHandler
ProcessResult CharHandler(Context *ctx, int ch)
Definition editor.h:22
rime::Editor::CharHandlerPtr
ProcessResult(Editor::*)(Context *ctx, int ch) CharHandlerPtr
Definition editor.h:23
rime::Editor::BackToPreviousSyllable
Handler BackToPreviousSyllable
Definition editor.h:36
rime::Editor::BackToPreviousInput
Handler BackToPreviousInput
Definition editor.h:35
rime::Editor::CommitComment
Handler CommitComment
Definition editor.h:30
rime::Editor::LoadConfig
void LoadConfig()
Definition editor.cc:68
rime::Editor::CommitRawInput
Handler CommitRawInput
Definition editor.h:32
rime::Editor::Editor
Editor(const Ticket &ticket, bool auto_commit)
Definition editor.cc:41
rime::Editor::AddToInput
CharHandler AddToInput
Definition editor.h:42
rime::Editor::ProcessKeyEvent
ProcessResult ProcessKeyEvent(const KeyEvent &key_event)
Definition editor.cc:46
rime::Editor::DeleteChar
Handler DeleteChar
Definition editor.h:38
rime::Editor::DeleteCandidate
Handler DeleteCandidate
Definition editor.h:37
rime::Editor::ToggleSelection
Handler ToggleSelection
Definition editor.h:29
rime::Editor::CancelComposition
Handler CancelComposition
Definition editor.h:39
rime::Editor::char_handler_
CharHandlerPtr char_handler_
Definition editor.h:47
rime::Editor::DirectCommit
CharHandler DirectCommit
Definition editor.h:41
rime::FluidEditor::FluidEditor
FluidEditor(const Ticket &ticket)
Definition editor.cc:189
rime::ExpressEditor::ExpressEditor
ExpressEditor(const Ticket &ticket)
Definition editor.cc:205
rime::KeyBindingProcessor< Editor >::KeyBindingProcessor
KeyBindingProcessor(ActionDef *action_definitions)
Definition key_binding_processor.h:36
rime::KeyBindingProcessor< Editor >::Handler
bool Handler(Context *ctx)
Definition key_binding_processor.h:19
rime::KeyEvent
Definition key_event.h:17
rime::Processor::Processor
Processor(const Ticket &ticket)
Definition processor.h:26
rime::Ticket
Definition ticket.h:17