• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SCENE_SRC_COMPONENT_TEXT_COMPONENT_H
17 #define SCENE_SRC_COMPONENT_TEXT_COMPONENT_H
18 
19 #include <scene/ext/component.h>
20 #include <scene/interface/intf_text.h>
21 
22 #include <meta/ext/object.h>
23 
24 SCENE_BEGIN_NAMESPACE()
25 
26 META_REGISTER_CLASS(TextComponent, "6abc426a-5fba-4920-a4da-fd4185d796de", META_NS::ObjectCategoryBits::NO_CATEGORY)
27 
28 class IInternalText : public CORE_NS::IInterface {
29     META_INTERFACE(CORE_NS::IInterface, IInternalText, "3dbbabbe-7231-4c25-9233-c66766fa5945")
30 public:
31     META_PROPERTY(BASE_NS::string, Text)
32     META_PROPERTY(BASE_NS::string, FontFamily)
33     META_PROPERTY(BASE_NS::string, FontStyle)
34     META_PROPERTY(float, FontSize)
35     META_PROPERTY(float, Font3DThickness)
36     META_PROPERTY(SCENE_NS::FontMethod, FontMethod)
37 };
38 
39 class TextComponent : public META_NS::IntroduceInterfaces<Component, IInternalText> {
40     META_OBJECT(TextComponent, ClassId::TextComponent, IntroduceInterfaces)
41 
42 public:
43     META_BEGIN_STATIC_DATA()
44     SCENE_STATIC_PROPERTY_DATA(IInternalText, BASE_NS::string, Text, "TextComponent.text")
45     SCENE_STATIC_PROPERTY_DATA(IInternalText, BASE_NS::string, FontFamily, "TextComponent.fontFamily")
46     SCENE_STATIC_PROPERTY_DATA(IInternalText, BASE_NS::string, FontStyle, "TextComponent.fontStyle")
47     SCENE_STATIC_PROPERTY_DATA(IInternalText, float, FontSize, "TextComponent.fontSize")
48     SCENE_STATIC_PROPERTY_DATA(IInternalText, float, Font3DThickness, "TextComponent.font3DThickness")
49     SCENE_STATIC_PROPERTY_DATA(IInternalText, SCENE_NS::FontMethod, FontMethod, "TextComponent.fontMethod")
50     META_END_STATIC_DATA()
51 
52     META_IMPLEMENT_PROPERTY(BASE_NS::string, Text)
53     META_IMPLEMENT_PROPERTY(BASE_NS::string, FontFamily)
54     META_IMPLEMENT_PROPERTY(BASE_NS::string, FontStyle)
55     META_IMPLEMENT_PROPERTY(float, FontSize)
56     META_IMPLEMENT_PROPERTY(float, Font3DThickness)
57     META_IMPLEMENT_PROPERTY(SCENE_NS::FontMethod, FontMethod)
58 
59 public:
60     BASE_NS::string GetName() const override;
61 };
62 
63 SCENE_END_NAMESPACE()
64 
65 #endif
66