1a3e0fd82Sopenharmony_ci/*
2a3e0fd82Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3a3e0fd82Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4a3e0fd82Sopenharmony_ci * you may not use this file except in compliance with the License.
5a3e0fd82Sopenharmony_ci * You may obtain a copy of the License at
6a3e0fd82Sopenharmony_ci *
7a3e0fd82Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8a3e0fd82Sopenharmony_ci *
9a3e0fd82Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10a3e0fd82Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11a3e0fd82Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12a3e0fd82Sopenharmony_ci * See the License for the specific language governing permissions and
13a3e0fd82Sopenharmony_ci * limitations under the License.
14a3e0fd82Sopenharmony_ci */
15a3e0fd82Sopenharmony_ci
16a3e0fd82Sopenharmony_ci#include "components/ui_checkbox.h"
17a3e0fd82Sopenharmony_ci#include "default_resource/check_box_res.h"
18a3e0fd82Sopenharmony_ci#include "draw/draw_image.h"
19a3e0fd82Sopenharmony_ci#include "engines/gfx/gfx_engine_manager.h"
20a3e0fd82Sopenharmony_ci#include "imgdecode/cache_manager.h"
21a3e0fd82Sopenharmony_ci
22a3e0fd82Sopenharmony_cinamespace OHOS {
23a3e0fd82Sopenharmony_cinamespace {
24a3e0fd82Sopenharmony_ciconstexpr uint8_t DEFAULT_UNSELECT_BG_OPA = 168;     // default background opacity
25a3e0fd82Sopenharmony_ciconstexpr float DEFAULT_COEFFICIENT_START_DX = 0.22; // start point: x-cordinate offset
26a3e0fd82Sopenharmony_ciconstexpr float DEFAULT_COEFFICIENT_START_DY = 0.5;  // start point: y-cordinate offset
27a3e0fd82Sopenharmony_ciconstexpr float DEFAULT_COEFFICIENT_MID_DX = 0.2;    // middle point: y-cordinate offset
28a3e0fd82Sopenharmony_ciconstexpr float DEFAULT_COEFFICIENT_MID_DY = 0.38;   // middle point: y-cordinate offset
29a3e0fd82Sopenharmony_ciconstexpr int16_t DEFAULT_RATIO_BORDER_RADIUS_LINE_WIDTH = 4;
30a3e0fd82Sopenharmony_ciconstexpr uint8_t DEFAULT_BG_RED = 31;
31a3e0fd82Sopenharmony_ciconstexpr uint8_t DEFAULT_BG_GREEN = 113;
32a3e0fd82Sopenharmony_ciconstexpr uint8_t DEFAULT_BG_BLUE = 255;
33a3e0fd82Sopenharmony_ci#if DEFAULT_ANIMATION
34a3e0fd82Sopenharmony_ciconstexpr int16_t DEFAULT_ANIMATOR_TIME = 200;
35a3e0fd82Sopenharmony_ciconstexpr float BEZIER_CONTROL_POINT_X_1 = 0.33;
36a3e0fd82Sopenharmony_ciconstexpr float BEZIER_CONTROL_POINT_X_2 = 0.67;
37a3e0fd82Sopenharmony_ci#endif
38a3e0fd82Sopenharmony_ci} // namespace
39a3e0fd82Sopenharmony_ciUICheckBox::UICheckBox()
40a3e0fd82Sopenharmony_ci    : state_(UNSELECTED),
41a3e0fd82Sopenharmony_ci      onStateChangeListener_(nullptr),
42a3e0fd82Sopenharmony_ci      width_(DEFAULT_HOT_WIDTH),
43a3e0fd82Sopenharmony_ci      height_(DEFAULT_HOT_HEIGHT),
44a3e0fd82Sopenharmony_ci      borderWidth_(DEFAULT_BORDER_WIDTH),
45a3e0fd82Sopenharmony_ci      backgroundOpacity_(0)
46a3e0fd82Sopenharmony_ci{
47a3e0fd82Sopenharmony_ci    touchable_ = true;
48a3e0fd82Sopenharmony_ci    style_ = &(StyleDefault::GetBackgroundTransparentStyle());
49a3e0fd82Sopenharmony_ci#if defined(ENABLE_DEFAULT_CHECKBOX_IMAGE) && (ENABLE_DEFAULT_CHECKBOX_IMAGE == 1)
50a3e0fd82Sopenharmony_ci    image_[UNSELECTED].SetSrc(GetCheckBoxOffInfo());
51a3e0fd82Sopenharmony_ci    image_[SELECTED].SetSrc(GetCheckBoxOnInfo());
52a3e0fd82Sopenharmony_ci#endif
53a3e0fd82Sopenharmony_ci    ImageHeader header = {0};
54a3e0fd82Sopenharmony_ci    image_[UNSELECTED].GetHeader(header);
55a3e0fd82Sopenharmony_ci    Resize(header.width, header.height);
56a3e0fd82Sopenharmony_ci#if DEFAULT_ANIMATION
57a3e0fd82Sopenharmony_ci    runTime_ = 0;
58a3e0fd82Sopenharmony_ci    checkBoxAnimator_ = Animator(this, this, DEFAULT_ANIMATOR_TIME, false);
59a3e0fd82Sopenharmony_ci#endif
60a3e0fd82Sopenharmony_ci    selectedStateColor_ = Color::GetColorFromRGB(DEFAULT_BG_RED, DEFAULT_BG_GREEN, DEFAULT_BG_BLUE);
61a3e0fd82Sopenharmony_ci}
62a3e0fd82Sopenharmony_ci
63a3e0fd82Sopenharmony_civoid UICheckBox::SetState(UICheckBoxState state, bool needAnimater)
64a3e0fd82Sopenharmony_ci{
65a3e0fd82Sopenharmony_ci    if (state_ == state) {
66a3e0fd82Sopenharmony_ci        return;
67a3e0fd82Sopenharmony_ci    }
68a3e0fd82Sopenharmony_ci    state_ = state;
69a3e0fd82Sopenharmony_ci    if ((image_[SELECTED].GetSrcType() == IMG_SRC_UNKNOWN) || (image_[UNSELECTED].GetSrcType() == IMG_SRC_UNKNOWN)) {
70a3e0fd82Sopenharmony_ci#if DEFAULT_ANIMATION
71a3e0fd82Sopenharmony_ci        if (needAnimater) {
72a3e0fd82Sopenharmony_ci            checkBoxAnimator_.Start();
73a3e0fd82Sopenharmony_ci            ResetCallback();
74a3e0fd82Sopenharmony_ci        } else {
75a3e0fd82Sopenharmony_ci            backgroundOpacity_ = (state_ == SELECTED) ? OPA_OPAQUE : 0;
76a3e0fd82Sopenharmony_ci        }
77a3e0fd82Sopenharmony_ci#else
78a3e0fd82Sopenharmony_ci        backgroundOpacity_ = (state_ == SELECTED) ? OPA_OPAQUE : 0;
79a3e0fd82Sopenharmony_ci#endif
80a3e0fd82Sopenharmony_ci    }
81a3e0fd82Sopenharmony_ci    if (onStateChangeListener_ != nullptr) {
82a3e0fd82Sopenharmony_ci        onStateChangeListener_->OnChange(state);
83a3e0fd82Sopenharmony_ci    }
84a3e0fd82Sopenharmony_ci    Invalidate();
85a3e0fd82Sopenharmony_ci}
86a3e0fd82Sopenharmony_ci
87a3e0fd82Sopenharmony_civoid UICheckBox::ReverseState()
88a3e0fd82Sopenharmony_ci{
89a3e0fd82Sopenharmony_ci    if (state_ == SELECTED) {
90a3e0fd82Sopenharmony_ci        SetState(UNSELECTED, true);
91a3e0fd82Sopenharmony_ci    } else {
92a3e0fd82Sopenharmony_ci        SetState(SELECTED, true);
93a3e0fd82Sopenharmony_ci    }
94a3e0fd82Sopenharmony_ci}
95a3e0fd82Sopenharmony_ci
96a3e0fd82Sopenharmony_cibool UICheckBox::OnClickEvent(const ClickEvent& event)
97a3e0fd82Sopenharmony_ci{
98a3e0fd82Sopenharmony_ci    ReverseState();
99a3e0fd82Sopenharmony_ci    Invalidate();
100a3e0fd82Sopenharmony_ci    return UIView::OnClickEvent(event);
101a3e0fd82Sopenharmony_ci}
102a3e0fd82Sopenharmony_ci
103a3e0fd82Sopenharmony_civoid UICheckBox::SetImages(const char* selectedImageSrc, const char* unselectedImageSrc)
104a3e0fd82Sopenharmony_ci{
105a3e0fd82Sopenharmony_ci    image_[SELECTED].SetSrc(selectedImageSrc);
106a3e0fd82Sopenharmony_ci    image_[UNSELECTED].SetSrc(unselectedImageSrc);
107a3e0fd82Sopenharmony_ci}
108a3e0fd82Sopenharmony_ci
109a3e0fd82Sopenharmony_civoid UICheckBox::SetImages(const ImageInfo* selectedImageSrc, const ImageInfo* unselectedImageSrc)
110a3e0fd82Sopenharmony_ci{
111a3e0fd82Sopenharmony_ci    image_[SELECTED].SetSrc(selectedImageSrc);
112a3e0fd82Sopenharmony_ci    image_[UNSELECTED].SetSrc(unselectedImageSrc);
113a3e0fd82Sopenharmony_ci}
114a3e0fd82Sopenharmony_ci
115a3e0fd82Sopenharmony_civoid UICheckBox::CalculateSize()
116a3e0fd82Sopenharmony_ci{
117a3e0fd82Sopenharmony_ci    int16_t width = GetWidth();
118a3e0fd82Sopenharmony_ci    int16_t height = GetHeight();
119a3e0fd82Sopenharmony_ci    if ((width_ == width) && (height_ == height)) {
120a3e0fd82Sopenharmony_ci        return;
121a3e0fd82Sopenharmony_ci    }
122a3e0fd82Sopenharmony_ci    width_ = width;
123a3e0fd82Sopenharmony_ci    height_ = height;
124a3e0fd82Sopenharmony_ci    int16_t minValue = (width_ > height_) ? height_ : width_;
125a3e0fd82Sopenharmony_ci    borderWidth_ = DEFAULT_BORDER_WIDTH * minValue / DEFAULT_HOT_WIDTH;
126a3e0fd82Sopenharmony_ci}
127a3e0fd82Sopenharmony_ci
128a3e0fd82Sopenharmony_civoid UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer,
129a3e0fd82Sopenharmony_ci                                              Rect rect,
130a3e0fd82Sopenharmony_ci                                              Rect trunc,
131a3e0fd82Sopenharmony_ci                                              int16_t borderRadius,
132a3e0fd82Sopenharmony_ci                                              int16_t rectLineWidth)
133a3e0fd82Sopenharmony_ci{
134a3e0fd82Sopenharmony_ci    if (backgroundOpacity_ == 0) {
135a3e0fd82Sopenharmony_ci        return;
136a3e0fd82Sopenharmony_ci    }
137a3e0fd82Sopenharmony_ci    Style styleSelect = StyleDefault::GetBackgroundTransparentStyle();
138a3e0fd82Sopenharmony_ci    styleSelect.borderRadius_ = borderRadius;
139a3e0fd82Sopenharmony_ci    styleSelect.bgColor_ = selectedStateColor_;
140a3e0fd82Sopenharmony_ci    styleSelect.bgOpa_ = backgroundOpacity_;
141a3e0fd82Sopenharmony_ci    BaseGfxEngine* baseGfxEngine = BaseGfxEngine::GetInstance();
142a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawRect(gfxDstBuffer, rect, trunc, styleSelect, opaScale_);
143a3e0fd82Sopenharmony_ci    int16_t dx = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_START_DX);
144a3e0fd82Sopenharmony_ci    int16_t dy = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_START_DY);
145a3e0fd82Sopenharmony_ci    Point start = {static_cast<int16_t>(rect.GetX() + dx), static_cast<int16_t>(rect.GetY() + dy)};
146a3e0fd82Sopenharmony_ci    dx = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_MID_DX);
147a3e0fd82Sopenharmony_ci    Point mid = {static_cast<int16_t>(start.x + dx), static_cast<int16_t>(start.y + dx)};
148a3e0fd82Sopenharmony_ci    dx = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_MID_DY);
149a3e0fd82Sopenharmony_ci    Point end = {static_cast<int16_t>(mid.x + dx), static_cast<int16_t>(mid.y - dx)};
150a3e0fd82Sopenharmony_ci    const int16_t half = 2; // 2 :half
151a3e0fd82Sopenharmony_ci    ArcInfo arcInfoLeft = {start,
152a3e0fd82Sopenharmony_ci                           {0, 0},
153a3e0fd82Sopenharmony_ci                           static_cast<uint16_t>(rectLineWidth),
154a3e0fd82Sopenharmony_ci                           SEMICIRCLE_IN_DEGREE + QUARTER_IN_DEGREE / half,
155a3e0fd82Sopenharmony_ci                           QUARTER_IN_DEGREE / half,
156a3e0fd82Sopenharmony_ci                           nullptr};
157a3e0fd82Sopenharmony_ci    ArcInfo arcInfoMid = {mid,
158a3e0fd82Sopenharmony_ci                          {0, 0},
159a3e0fd82Sopenharmony_ci                          static_cast<uint16_t>(rectLineWidth),
160a3e0fd82Sopenharmony_ci                          SEMICIRCLE_IN_DEGREE - QUARTER_IN_DEGREE / half,
161a3e0fd82Sopenharmony_ci                          SEMICIRCLE_IN_DEGREE + QUARTER_IN_DEGREE / half,
162a3e0fd82Sopenharmony_ci                          nullptr};
163a3e0fd82Sopenharmony_ci    ArcInfo arcInfoRight = {end,
164a3e0fd82Sopenharmony_ci                            {0, 0},
165a3e0fd82Sopenharmony_ci                            static_cast<uint16_t>(rectLineWidth),
166a3e0fd82Sopenharmony_ci                            CIRCLE_IN_DEGREE - QUARTER_IN_DEGREE / half,
167a3e0fd82Sopenharmony_ci                            SEMICIRCLE_IN_DEGREE - QUARTER_IN_DEGREE / half,
168a3e0fd82Sopenharmony_ci                            nullptr};
169a3e0fd82Sopenharmony_ci    styleSelect.lineColor_ = Color::White();
170a3e0fd82Sopenharmony_ci    styleSelect.lineOpa_ = backgroundOpacity_;
171a3e0fd82Sopenharmony_ci    uint8_t opa = DrawUtils::GetMixOpacity(opaScale_, backgroundOpacity_);
172a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfoLeft, trunc, styleSelect, opaScale_, CapType::CAP_NONE);
173a3e0fd82Sopenharmony_ci    // 2 : double
174a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawLine(gfxDstBuffer, start, mid, trunc, rectLineWidth * 2, Color::White(), opa);
175a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfoMid, trunc, styleSelect, opaScale_, CapType::CAP_NONE);
176a3e0fd82Sopenharmony_ci    // 2 : double
177a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawLine(gfxDstBuffer, mid, end, trunc, rectLineWidth * 2, Color::White(), opa);
178a3e0fd82Sopenharmony_ci    baseGfxEngine->DrawArc(gfxDstBuffer, arcInfoRight, trunc, styleSelect, opaScale_, CapType::CAP_NONE);
179a3e0fd82Sopenharmony_ci}
180a3e0fd82Sopenharmony_ci
181a3e0fd82Sopenharmony_civoid UICheckBox::UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer,
182a3e0fd82Sopenharmony_ci                                                Rect rect,
183a3e0fd82Sopenharmony_ci                                                Rect trunc,
184a3e0fd82Sopenharmony_ci                                                int16_t borderRadius,
185a3e0fd82Sopenharmony_ci                                                int16_t rectLineWidth)
186a3e0fd82Sopenharmony_ci{
187a3e0fd82Sopenharmony_ci    Style styleUnSelect = StyleDefault::GetBackgroundTransparentStyle();
188a3e0fd82Sopenharmony_ci    styleUnSelect.borderWidth_ = rectLineWidth;
189a3e0fd82Sopenharmony_ci    styleUnSelect.borderRadius_ = borderRadius;
190a3e0fd82Sopenharmony_ci    styleUnSelect.borderColor_ = Color::White();
191a3e0fd82Sopenharmony_ci    styleUnSelect.borderOpa_ = DEFAULT_UNSELECT_BG_OPA;
192a3e0fd82Sopenharmony_ci    BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, rect, trunc, styleUnSelect, opaScale_);
193a3e0fd82Sopenharmony_ci}
194a3e0fd82Sopenharmony_ci
195a3e0fd82Sopenharmony_ci#if DEFAULT_ANIMATION
196a3e0fd82Sopenharmony_civoid UICheckBox::ResetCallback()
197a3e0fd82Sopenharmony_ci{
198a3e0fd82Sopenharmony_ci    if ((runTime_ != 0) && (checkBoxAnimator_.GetTime() != runTime_)) {
199a3e0fd82Sopenharmony_ci        checkBoxAnimator_.SetRunTime(checkBoxAnimator_.GetTime() - runTime_);
200a3e0fd82Sopenharmony_ci    }
201a3e0fd82Sopenharmony_ci}
202a3e0fd82Sopenharmony_ci
203a3e0fd82Sopenharmony_civoid UICheckBox::Callback(UIView* view)
204a3e0fd82Sopenharmony_ci{
205a3e0fd82Sopenharmony_ci    runTime_ = checkBoxAnimator_.GetRunTime();
206a3e0fd82Sopenharmony_ci    float x = static_cast<float>(runTime_) / checkBoxAnimator_.GetTime();
207a3e0fd82Sopenharmony_ci    float coefficient = Interpolation::GetBezierY(x, BEZIER_CONTROL_POINT_X_1, 0, BEZIER_CONTROL_POINT_X_2, 1);
208a3e0fd82Sopenharmony_ci    backgroundOpacity_ = (state_ == SELECTED) ? (static_cast<uint8_t>(coefficient * OPA_OPAQUE)) :
209a3e0fd82Sopenharmony_ci                                                (static_cast<uint8_t>((1 - coefficient) * OPA_OPAQUE));
210a3e0fd82Sopenharmony_ci    Invalidate();
211a3e0fd82Sopenharmony_ci}
212a3e0fd82Sopenharmony_ci
213a3e0fd82Sopenharmony_civoid UICheckBox::OnStop(UIView& view)
214a3e0fd82Sopenharmony_ci{
215a3e0fd82Sopenharmony_ci    backgroundOpacity_ = (state_ == SELECTED) ? OPA_OPAQUE : 0;
216a3e0fd82Sopenharmony_ci    Invalidate();
217a3e0fd82Sopenharmony_ci}
218a3e0fd82Sopenharmony_ci#endif
219a3e0fd82Sopenharmony_ci
220a3e0fd82Sopenharmony_civoid UICheckBox::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
221a3e0fd82Sopenharmony_ci{
222a3e0fd82Sopenharmony_ci    Rect trunc = invalidatedArea;
223a3e0fd82Sopenharmony_ci    if ((image_[SELECTED].GetSrcType() != IMG_SRC_UNKNOWN) && (image_[UNSELECTED].GetSrcType() != IMG_SRC_UNKNOWN)) {
224a3e0fd82Sopenharmony_ci        ImageHeader header = {0};
225a3e0fd82Sopenharmony_ci        image_[state_].GetHeader(header);
226a3e0fd82Sopenharmony_ci        int16_t imgWidth = header.width;
227a3e0fd82Sopenharmony_ci        int16_t imgHeight = header.height;
228a3e0fd82Sopenharmony_ci        Rect coords = GetContentRect();
229a3e0fd82Sopenharmony_ci        coords.SetWidth(imgWidth);
230a3e0fd82Sopenharmony_ci        coords.SetHeight(imgHeight);
231a3e0fd82Sopenharmony_ci        BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, GetRect(), invalidatedArea, *style_, opaScale_);
232a3e0fd82Sopenharmony_ci        int16_t offsetLeft = (GetWidth() - imgWidth) / 2;  // 2 : half
233a3e0fd82Sopenharmony_ci        int16_t offsetTop = (GetHeight() - imgHeight) / 2; // 2 : half
234a3e0fd82Sopenharmony_ci        coords.SetX(coords.GetX() + offsetLeft);
235a3e0fd82Sopenharmony_ci        coords.SetY(coords.GetY() + offsetTop);
236a3e0fd82Sopenharmony_ci        if (trunc.Intersect(trunc, coords)) {
237a3e0fd82Sopenharmony_ci            image_[state_].DrawImage(gfxDstBuffer, coords, trunc, *style_, opaScale_);
238a3e0fd82Sopenharmony_ci        }
239a3e0fd82Sopenharmony_ci    } else {
240a3e0fd82Sopenharmony_ci        Rect contentRect = GetContentRect();
241a3e0fd82Sopenharmony_ci        bool isIntersect = trunc.Intersect(trunc, contentRect);
242a3e0fd82Sopenharmony_ci        if (!isIntersect) {
243a3e0fd82Sopenharmony_ci            return;
244a3e0fd82Sopenharmony_ci        }
245a3e0fd82Sopenharmony_ci        CalculateSize();
246a3e0fd82Sopenharmony_ci        int16_t rectLineWidth = borderWidth_ / DEFAULT_BORDER_WIDTH;
247a3e0fd82Sopenharmony_ci        int16_t borderRadius = rectLineWidth * DEFAULT_RATIO_BORDER_RADIUS_LINE_WIDTH;
248a3e0fd82Sopenharmony_ci        BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, GetRect(), invalidatedArea, *style_, opaScale_);
249a3e0fd82Sopenharmony_ci        int16_t x = contentRect.GetX() + (width_ - borderWidth_) / 2;  // 2: half
250a3e0fd82Sopenharmony_ci        int16_t y = contentRect.GetY() + (height_ - borderWidth_) / 2; // 2: half
251a3e0fd82Sopenharmony_ci        Rect rect(x, y, x + borderWidth_, y + borderWidth_);
252a3e0fd82Sopenharmony_ci#if DEFAULT_ANIMATION
253a3e0fd82Sopenharmony_ci        UnSelectedStateSoftwareDrawing(gfxDstBuffer, rect, trunc, borderRadius, rectLineWidth);
254a3e0fd82Sopenharmony_ci        SelectedStateSoftwareDrawing(gfxDstBuffer, rect, trunc, borderRadius, rectLineWidth);
255a3e0fd82Sopenharmony_ci#else
256a3e0fd82Sopenharmony_ci        if (state_ == SELECTED) {
257a3e0fd82Sopenharmony_ci            SelectedStateSoftwareDrawing(gfxDstBuffer, rect, trunc, borderRadius, rectLineWidth);
258a3e0fd82Sopenharmony_ci        } else {
259a3e0fd82Sopenharmony_ci            UnSelectedStateSoftwareDrawing(gfxDstBuffer, rect, trunc, borderRadius, rectLineWidth);
260a3e0fd82Sopenharmony_ci        }
261a3e0fd82Sopenharmony_ci#endif
262a3e0fd82Sopenharmony_ci    }
263a3e0fd82Sopenharmony_ci}
264a3e0fd82Sopenharmony_ci
265a3e0fd82Sopenharmony_civoid UICheckBox::SetSelectedStateColor(ColorType color)
266a3e0fd82Sopenharmony_ci{
267a3e0fd82Sopenharmony_ci    selectedStateColor_ = color;
268a3e0fd82Sopenharmony_ci}
269a3e0fd82Sopenharmony_ci
270a3e0fd82Sopenharmony_ciColorType UICheckBox::GetSelectedStateColor() const
271a3e0fd82Sopenharmony_ci{
272a3e0fd82Sopenharmony_ci    return selectedStateColor_;
273a3e0fd82Sopenharmony_ci}
274a3e0fd82Sopenharmony_ci} // namespace OHOS
275