diff options
Diffstat (limited to 'fxjs/cjs_color.h')
-rw-r--r-- | fxjs/cjs_color.h | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/fxjs/cjs_color.h b/fxjs/cjs_color.h index fab035db21..667a13c21a 100644 --- a/fxjs/cjs_color.h +++ b/fxjs/cjs_color.h @@ -12,15 +12,38 @@ #include "fpdfsdk/pwl/cpwl_wnd.h" #include "fxjs/JS_Define.h" -class color : public CJS_EmbedObj { +class CJS_Color : public CJS_Object { public: + static void DefineJSObjects(CFXJS_Engine* pEngine); static v8::Local<v8::Array> ConvertPWLColorToArray(CJS_Runtime* pRuntime, const CFX_Color& color); static CFX_Color ConvertArrayToPWLColor(CJS_Runtime* pRuntime, v8::Local<v8::Array> array); - explicit color(CJS_Object* pJSObject); - ~color() override; + explicit CJS_Color(v8::Local<v8::Object> pObject); + ~CJS_Color() override; + + JS_STATIC_PROP(black, black, CJS_Color); + JS_STATIC_PROP(blue, blue, CJS_Color); + JS_STATIC_PROP(cyan, cyan, CJS_Color); + JS_STATIC_PROP(dkGray, dark_gray, CJS_Color); + JS_STATIC_PROP(gray, gray, CJS_Color); + JS_STATIC_PROP(green, green, CJS_Color); + JS_STATIC_PROP(ltGray, light_gray, CJS_Color); + JS_STATIC_PROP(magenta, magenta, CJS_Color); + JS_STATIC_PROP(red, red, CJS_Color); + JS_STATIC_PROP(transparent, transparent, CJS_Color); + JS_STATIC_PROP(white, white, CJS_Color); + JS_STATIC_PROP(yellow, yellow, CJS_Color); + + JS_STATIC_METHOD(convert, CJS_Color); + JS_STATIC_METHOD(equal, CJS_Color); + + private: + static int ObjDefnID; + static const char kName[]; + static const JSPropertySpec PropertySpecs[]; + static const JSMethodSpec MethodSpecs[]; CJS_Return get_black(CJS_Runtime* pRuntime); CJS_Return set_black(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); @@ -63,7 +86,6 @@ class color : public CJS_EmbedObj { CJS_Return equal(CJS_Runtime* pRuntime, const std::vector<v8::Local<v8::Value>>& params); - private: CJS_Return GetPropertyHelper(CJS_Runtime* pRuntime, CFX_Color* val); CJS_Return SetPropertyHelper(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp, @@ -83,33 +105,4 @@ class color : public CJS_EmbedObj { CFX_Color m_crLTGray; }; -class CJS_Color : public CJS_Object { - public: - static void DefineJSObjects(CFXJS_Engine* pEngine); - - explicit CJS_Color(v8::Local<v8::Object> pObject); - ~CJS_Color() override = default; - - JS_STATIC_PROP(black, black, color); - JS_STATIC_PROP(blue, blue, color); - JS_STATIC_PROP(cyan, cyan, color); - JS_STATIC_PROP(dkGray, dark_gray, color); - JS_STATIC_PROP(gray, gray, color); - JS_STATIC_PROP(green, green, color); - JS_STATIC_PROP(ltGray, light_gray, color); - JS_STATIC_PROP(magenta, magenta, color); - JS_STATIC_PROP(red, red, color); - JS_STATIC_PROP(transparent, transparent, color); - JS_STATIC_PROP(white, white, color); - JS_STATIC_PROP(yellow, yellow, color); - - JS_STATIC_METHOD(convert, color); - JS_STATIC_METHOD(equal, color); - - private: - static int ObjDefnID; - static const JSPropertySpec PropertySpecs[]; - static const JSMethodSpec MethodSpecs[]; -}; - #endif // FXJS_CJS_COLOR_H_ |