1885b47fbSopenharmony_ci/*
2885b47fbSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License.
5885b47fbSopenharmony_ci * You may obtain a copy of the License at
6885b47fbSopenharmony_ci *
7885b47fbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8885b47fbSopenharmony_ci *
9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and
13885b47fbSopenharmony_ci * limitations under the License.
14885b47fbSopenharmony_ci */
15885b47fbSopenharmony_ci
16885b47fbSopenharmony_ci#ifndef ACCESSIBILITY_CAPTION_H
17885b47fbSopenharmony_ci#define ACCESSIBILITY_CAPTION_H
18885b47fbSopenharmony_ci
19885b47fbSopenharmony_ci#include "accessibility_def.h"
20885b47fbSopenharmony_ci
21885b47fbSopenharmony_cinamespace OHOS {
22885b47fbSopenharmony_cinamespace AccessibilityConfig {
23885b47fbSopenharmony_ciclass CaptionProperty {
24885b47fbSopenharmony_cipublic:
25885b47fbSopenharmony_ci    /**
26885b47fbSopenharmony_ci     * @brief The constructor of CaptionProperty
27885b47fbSopenharmony_ci     */
28885b47fbSopenharmony_ci    CaptionProperty() = default;
29885b47fbSopenharmony_ci
30885b47fbSopenharmony_ci    /**
31885b47fbSopenharmony_ci     * @brief The deconstructor of CaptionProperty
32885b47fbSopenharmony_ci     */
33885b47fbSopenharmony_ci    ~CaptionProperty() = default;
34885b47fbSopenharmony_ci
35885b47fbSopenharmony_ci    /**
36885b47fbSopenharmony_ci     * @brief Check property
37885b47fbSopenharmony_ci     * @param property The value of property
38885b47fbSopenharmony_ci     */
39885b47fbSopenharmony_ci    bool CheckProperty(const std::string &property);
40885b47fbSopenharmony_ci
41885b47fbSopenharmony_ci    /**
42885b47fbSopenharmony_ci     * @brief Set font family
43885b47fbSopenharmony_ci     * @param family Font family
44885b47fbSopenharmony_ci     */
45885b47fbSopenharmony_ci    void SetFontFamily(const std::string &family);
46885b47fbSopenharmony_ci
47885b47fbSopenharmony_ci    /**
48885b47fbSopenharmony_ci     * @brief Get font family
49885b47fbSopenharmony_ci     * @return Font family
50885b47fbSopenharmony_ci     */
51885b47fbSopenharmony_ci    const std::string &GetFontFamily() const;
52885b47fbSopenharmony_ci
53885b47fbSopenharmony_ci    /**
54885b47fbSopenharmony_ci     * @brief Set font scale
55885b47fbSopenharmony_ci     * @param scale Font scale
56885b47fbSopenharmony_ci     */
57885b47fbSopenharmony_ci    void SetFontScale(int32_t scale);
58885b47fbSopenharmony_ci
59885b47fbSopenharmony_ci    /**
60885b47fbSopenharmony_ci     * @brief Get font scale
61885b47fbSopenharmony_ci     * @return Font scale
62885b47fbSopenharmony_ci     */
63885b47fbSopenharmony_ci    int32_t GetFontScale() const;
64885b47fbSopenharmony_ci
65885b47fbSopenharmony_ci    /**
66885b47fbSopenharmony_ci     * @brief Set font color
67885b47fbSopenharmony_ci     * @param color Font color
68885b47fbSopenharmony_ci     */
69885b47fbSopenharmony_ci    void SetFontColor(uint32_t color);
70885b47fbSopenharmony_ci
71885b47fbSopenharmony_ci    /**
72885b47fbSopenharmony_ci     * @brief Get font color
73885b47fbSopenharmony_ci     * @return Font color
74885b47fbSopenharmony_ci     */
75885b47fbSopenharmony_ci    uint32_t GetFontColor() const;
76885b47fbSopenharmony_ci
77885b47fbSopenharmony_ci    /**
78885b47fbSopenharmony_ci     * @brief Set font edge type
79885b47fbSopenharmony_ci     * @param type The type of font edge
80885b47fbSopenharmony_ci     */
81885b47fbSopenharmony_ci    void SetFontEdgeType(const std::string &type);
82885b47fbSopenharmony_ci
83885b47fbSopenharmony_ci    /**
84885b47fbSopenharmony_ci     * @brief Get font edge type
85885b47fbSopenharmony_ci     * @return The type of font edge
86885b47fbSopenharmony_ci     */
87885b47fbSopenharmony_ci    const std::string &GetFontEdgeType() const;
88885b47fbSopenharmony_ci
89885b47fbSopenharmony_ci    /**
90885b47fbSopenharmony_ci     * @brief Set window color
91885b47fbSopenharmony_ci     * @param color The color of window
92885b47fbSopenharmony_ci     */
93885b47fbSopenharmony_ci    void SetWindowColor(uint32_t color);
94885b47fbSopenharmony_ci
95885b47fbSopenharmony_ci    /**
96885b47fbSopenharmony_ci     * @brief Get window color
97885b47fbSopenharmony_ci     * @return The color of window
98885b47fbSopenharmony_ci     */
99885b47fbSopenharmony_ci    uint32_t GetWindowColor() const;
100885b47fbSopenharmony_ci
101885b47fbSopenharmony_ci    /**
102885b47fbSopenharmony_ci     * @brief Set background color
103885b47fbSopenharmony_ci     * @param color The color of background
104885b47fbSopenharmony_ci     */
105885b47fbSopenharmony_ci    void SetBackgroundColor(uint32_t color);
106885b47fbSopenharmony_ci
107885b47fbSopenharmony_ci    /**
108885b47fbSopenharmony_ci     * @brief Get background color
109885b47fbSopenharmony_ci     * @return The color of background
110885b47fbSopenharmony_ci     */
111885b47fbSopenharmony_ci    uint32_t GetBackgroundColor() const;
112885b47fbSopenharmony_ci
113885b47fbSopenharmony_ciprotected:
114885b47fbSopenharmony_ci    std::string fontFamily_ = "default";
115885b47fbSopenharmony_ci    int32_t fontScale_ = 75;    // font size
116885b47fbSopenharmony_ci    uint32_t fontColor_ = 0xff000000;
117885b47fbSopenharmony_ci    std::string fontEdgeType_ = "none";
118885b47fbSopenharmony_ci    uint32_t backgroundColor_ = 0xff000000;
119885b47fbSopenharmony_ci    uint32_t windowColor_ = 0xff000000;
120885b47fbSopenharmony_ci
121885b47fbSopenharmony_ciprivate:
122885b47fbSopenharmony_ci    bool HasBackgroundColor();
123885b47fbSopenharmony_ci    bool HasTextColor();
124885b47fbSopenharmony_ci    bool HasEdgeType();
125885b47fbSopenharmony_ci    bool HasEdgeColor();
126885b47fbSopenharmony_ci    bool HasWindowColor();
127885b47fbSopenharmony_ci};
128885b47fbSopenharmony_ci
129885b47fbSopenharmony_cienum CaptionObserverType : int32_t {
130885b47fbSopenharmony_ci    CAPTION_ENABLE = 0,
131885b47fbSopenharmony_ci    CAPTION_PROPERTY,
132885b47fbSopenharmony_ci};
133885b47fbSopenharmony_ciclass CaptionObserver {
134885b47fbSopenharmony_cipublic:
135885b47fbSopenharmony_ci    /**
136885b47fbSopenharmony_ci     * @brief The deconstructor of CaptionObserver
137885b47fbSopenharmony_ci     */
138885b47fbSopenharmony_ci    virtual ~CaptionObserver() = default;
139885b47fbSopenharmony_ci
140885b47fbSopenharmony_ci    /**
141885b47fbSopenharmony_ci     * @brief Called when the accessibility state changed.
142885b47fbSopenharmony_ci     * @param enable true:the accessibility state is enabled;false:the accessibility state is disabled
143885b47fbSopenharmony_ci     */
144885b47fbSopenharmony_ci    virtual void OnStateChanged(const bool& enable) = 0;
145885b47fbSopenharmony_ci
146885b47fbSopenharmony_ci    /**
147885b47fbSopenharmony_ci     * @brief Called when the caption property changed.
148885b47fbSopenharmony_ci     * @param caption current caption property.
149885b47fbSopenharmony_ci     */
150885b47fbSopenharmony_ci    virtual void OnPropertyChanged(const CaptionProperty& caption) = 0;
151885b47fbSopenharmony_ci};
152885b47fbSopenharmony_ci} // namespace Accessibility
153885b47fbSopenharmony_ci} // namespace OHOS
154885b47fbSopenharmony_ci#endif // ACCESSIBILITY_CAPTION_H