7#include "fxjs/cjs_event.h"
9#include "fxjs/cjs_event_context.h"
10#include "fxjs/cjs_field.h"
11#include "fxjs/cjs_object.h"
12#include "fxjs/js_define.h"
15 {
"change", get_change_static, set_change_static},
16 {
"changeEx", get_change_ex_static, set_change_ex_static},
17 {
"commitKey", get_commit_key_static, set_commit_key_static},
18 {
"fieldFull", get_field_full_static, set_field_full_static},
19 {
"keyDown", get_key_down_static, set_key_down_static},
20 {
"modifier", get_modifier_static, set_modifier_static},
21 {
"name", get_name_static, set_name_static},
22 {
"rc", get_rc_static, set_rc_static},
23 {
"richChange", get_rich_change_static, set_rich_change_static},
24 {
"richChangeEx", get_rich_change_ex_static, set_rich_change_ex_static},
25 {
"richValue", get_rich_value_static, set_rich_value_static},
26 {
"selEnd", get_sel_end_static, set_sel_end_static},
27 {
"selStart", get_sel_start_static, set_sel_start_static},
28 {
"shift", get_shift_static, set_shift_static},
29 {
"source", get_source_static, set_source_static},
30 {
"target", get_target_static, set_target_static},
31 {
"targetName", get_target_name_static, set_target_name_static},
32 {
"type", get_type_static, set_type_static},
33 {
"value", get_value_static, set_value_static},
34 {
"willCommit", get_will_commit_static, set_will_commit_static}};
36uint32_t CJS_Event::ObjDefnID = 0;
37const char CJS_Event::kName[] =
"event";
47 JSConstructor<CJS_Event>, JSDestructor);
51CJS_Event::
CJS_Event(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
56CJS_Result CJS_Event::get_change(CJS_Runtime* pRuntime) {
59 pRuntime->NewString(pEvent
->Change().AsStringView())
);
62CJS_Result CJS_Event::set_change(CJS_Runtime* pRuntime,
63 v8::Local<v8::Value> vp) {
71CJS_Result CJS_Event::get_change_ex(CJS_Runtime* pRuntime) {
77CJS_Result CJS_Event::set_change_ex(CJS_Runtime* pRuntime,
78 v8::Local<v8::Value> vp) {
82CJS_Result CJS_Event::get_commit_key(CJS_Runtime* pRuntime) {
87CJS_Result CJS_Event::set_commit_key(CJS_Runtime* pRuntime,
88 v8::Local<v8::Value> vp) {
92CJS_Result CJS_Event::get_field_full(CJS_Runtime* pRuntime) {
94 if (pEvent
->Name() !=
"Keystroke")
100CJS_Result CJS_Event::set_field_full(CJS_Runtime* pRuntime,
101 v8::Local<v8::Value> vp) {
105CJS_Result CJS_Event::get_key_down(CJS_Runtime* pRuntime) {
110CJS_Result CJS_Event::set_key_down(CJS_Runtime* pRuntime,
111 v8::Local<v8::Value> vp) {
115CJS_Result CJS_Event::get_modifier(CJS_Runtime* pRuntime) {
120CJS_Result CJS_Event::set_modifier(CJS_Runtime* pRuntime,
121 v8::Local<v8::Value> vp) {
125CJS_Result CJS_Event::get_name(CJS_Runtime* pRuntime) {
130CJS_Result CJS_Event::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
134CJS_Result CJS_Event::get_rc(CJS_Runtime* pRuntime) {
139CJS_Result CJS_Event::set_rc(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
141 pEvent
->Rc() = pRuntime->ToBoolean(vp);
145CJS_Result CJS_Event::get_rich_change(CJS_Runtime* pRuntime) {
149CJS_Result CJS_Event::set_rich_change(CJS_Runtime* pRuntime,
150 v8::Local<v8::Value> vp) {
154CJS_Result CJS_Event::get_rich_change_ex(CJS_Runtime* pRuntime) {
158CJS_Result CJS_Event::set_rich_change_ex(CJS_Runtime* pRuntime,
159 v8::Local<v8::Value> vp) {
163CJS_Result CJS_Event::get_rich_value(CJS_Runtime* pRuntime) {
167CJS_Result CJS_Event::set_rich_value(CJS_Runtime* pRuntime,
168 v8::Local<v8::Value> vp) {
172CJS_Result CJS_Event::get_sel_end(CJS_Runtime* pRuntime) {
174 if (pEvent
->Name() !=
"Keystroke")
180CJS_Result CJS_Event::set_sel_end(CJS_Runtime* pRuntime,
181 v8::Local<v8::Value> vp) {
183 if (pEvent
->Name() ==
"Keystroke")
189CJS_Result CJS_Event::get_sel_start(CJS_Runtime* pRuntime) {
191 if (pEvent
->Name() !=
"Keystroke")
197CJS_Result CJS_Event::set_sel_start(CJS_Runtime* pRuntime,
198 v8::Local<v8::Value> vp) {
200 if (pEvent
->Name() ==
"Keystroke")
206CJS_Result CJS_Event::get_shift(CJS_Runtime* pRuntime) {
211CJS_Result CJS_Event::set_shift(CJS_Runtime* pRuntime,
212 v8::Local<v8::Value> vp) {
216CJS_Result CJS_Event::get_source(CJS_Runtime* pRuntime) {
223CJS_Result CJS_Event::set_source(CJS_Runtime* pRuntime,
224 v8::Local<v8::Value> vp) {
228CJS_Result CJS_Event::get_target(CJS_Runtime* pRuntime) {
235CJS_Result CJS_Event::set_target(CJS_Runtime* pRuntime,
236 v8::Local<v8::Value> vp) {
240CJS_Result CJS_Event::get_target_name(CJS_Runtime* pRuntime) {
246CJS_Result CJS_Event::set_target_name(CJS_Runtime* pRuntime,
247 v8::Local<v8::Value> vp) {
251CJS_Result CJS_Event::get_type(CJS_Runtime* pRuntime) {
256CJS_Result CJS_Event::set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
260CJS_Result CJS_Event::get_value(CJS_Runtime* pRuntime) {
262 if (pEvent
->Type() !=
"Field")
269 pRuntime->NewString(pEvent
->Value().AsStringView())
);
272CJS_Result CJS_Event::set_value(CJS_Runtime* pRuntime,
273 v8::Local<v8::Value> vp) {
275 if (pEvent
->Type() !=
"Field")
284 if (vp->IsNullOrUndefined() || vp->IsBoolean())
287 pEvent
->Value() = pRuntime->ToWideString(vp);
291CJS_Result CJS_Event::get_will_commit(CJS_Runtime* pRuntime) {
297CJS_Result CJS_Event::set_will_commit(CJS_Runtime* pRuntime,
298 v8::Local<v8::Value> vp) {
CJS_Field * TargetField()
WideString ChangeEx() const
WideString TargetName() const
ByteStringView Name() const
ByteStringView Type() const
void SetSelEnd(int value)
CJS_Field * SourceField()
void SetSelStart(int value)
static void DefineJSObjects(CFXJS_Engine *pEngine)
CJS_Event(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
static uint32_t GetObjDefnID()
static void DefineProps(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSPropertySpec > consts)
static CJS_Result Success()
static CJS_Result Failure(JSMessage id)
static CJS_Result Failure(const WideString &str)
CJS_EventContext * GetCurrentEventContext() const