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/** 17a3e0fd82Sopenharmony_ci * @addtogroup UI_Components 18a3e0fd82Sopenharmony_ci * @{ 19a3e0fd82Sopenharmony_ci * 20a3e0fd82Sopenharmony_ci * @brief Defines UI components such as buttons, texts, images, lists, and progress bars. 21a3e0fd82Sopenharmony_ci * 22a3e0fd82Sopenharmony_ci * @since 1.0 23a3e0fd82Sopenharmony_ci * @version 1.0 24a3e0fd82Sopenharmony_ci */ 25a3e0fd82Sopenharmony_ci 26a3e0fd82Sopenharmony_ci/** 27a3e0fd82Sopenharmony_ci * @file ui_arc_label.h 28a3e0fd82Sopenharmony_ci * 29a3e0fd82Sopenharmony_ci * @brief Defines the attributes of an arc label. 30a3e0fd82Sopenharmony_ci * 31a3e0fd82Sopenharmony_ci * The attributes include the center and radius of an arc, angle range, and text orientation. 32a3e0fd82Sopenharmony_ci * 33a3e0fd82Sopenharmony_ci * @since 1.0 34a3e0fd82Sopenharmony_ci * @version 1.0 35a3e0fd82Sopenharmony_ci */ 36a3e0fd82Sopenharmony_ci 37a3e0fd82Sopenharmony_ci#ifndef GRAPHIC_LITE_UI_ARC_LABEL_H 38a3e0fd82Sopenharmony_ci#define GRAPHIC_LITE_UI_ARC_LABEL_H 39a3e0fd82Sopenharmony_ci 40a3e0fd82Sopenharmony_ci#include "animator/animator.h" 41a3e0fd82Sopenharmony_ci#include "common/text.h" 42a3e0fd82Sopenharmony_ci#include "components/ui_view.h" 43a3e0fd82Sopenharmony_ci 44a3e0fd82Sopenharmony_cinamespace OHOS { 45a3e0fd82Sopenharmony_ciclass ArcLabelScrollListener : public HeapBase { 46a3e0fd82Sopenharmony_cipublic: 47a3e0fd82Sopenharmony_ci virtual void Finish() = 0; 48a3e0fd82Sopenharmony_ci}; 49a3e0fd82Sopenharmony_ci 50a3e0fd82Sopenharmony_ci/** 51a3e0fd82Sopenharmony_ci * @brief Defines functions related to an arc label. 52a3e0fd82Sopenharmony_ci * 53a3e0fd82Sopenharmony_ci * @since 1.0 54a3e0fd82Sopenharmony_ci * @version 1.0 55a3e0fd82Sopenharmony_ci */ 56a3e0fd82Sopenharmony_ciclass UIArcLabel : public UIView { 57a3e0fd82Sopenharmony_cipublic: 58a3e0fd82Sopenharmony_ci /** 59a3e0fd82Sopenharmony_ci * @brief A default constructor used to create a <b>UIArcLabel</b> instance. 60a3e0fd82Sopenharmony_ci * 61a3e0fd82Sopenharmony_ci * @since 1.0 62a3e0fd82Sopenharmony_ci * @version 1.0 63a3e0fd82Sopenharmony_ci */ 64a3e0fd82Sopenharmony_ci UIArcLabel(); 65a3e0fd82Sopenharmony_ci 66a3e0fd82Sopenharmony_ci /** 67a3e0fd82Sopenharmony_ci * @brief A destructor used to delete the <b>UIArcLabel</b> instance. 68a3e0fd82Sopenharmony_ci * 69a3e0fd82Sopenharmony_ci * @since 1.0 70a3e0fd82Sopenharmony_ci * @version 1.0 71a3e0fd82Sopenharmony_ci */ 72a3e0fd82Sopenharmony_ci virtual ~UIArcLabel(); 73a3e0fd82Sopenharmony_ci 74a3e0fd82Sopenharmony_ci /** 75a3e0fd82Sopenharmony_ci * @brief Obtains the view type. 76a3e0fd82Sopenharmony_ci * 77a3e0fd82Sopenharmony_ci * @return Returns <b>UI_ARC_LABEL</b>, as defined in {link UIViewType}. 78a3e0fd82Sopenharmony_ci * @since 1.0 79a3e0fd82Sopenharmony_ci * @version 1.0 80a3e0fd82Sopenharmony_ci */ 81a3e0fd82Sopenharmony_ci UIViewType GetViewType() const override 82a3e0fd82Sopenharmony_ci { 83a3e0fd82Sopenharmony_ci return UI_ARC_LABEL; 84a3e0fd82Sopenharmony_ci } 85a3e0fd82Sopenharmony_ci 86a3e0fd82Sopenharmony_ci /** 87a3e0fd82Sopenharmony_ci * @brief Obtains the width of this arc text. 88a3e0fd82Sopenharmony_ci * 89a3e0fd82Sopenharmony_ci * @return Returns the width of this arc text. 90a3e0fd82Sopenharmony_ci * @since 1.0 91a3e0fd82Sopenharmony_ci * @version 1.0 92a3e0fd82Sopenharmony_ci */ 93a3e0fd82Sopenharmony_ci int16_t GetWidth() override 94a3e0fd82Sopenharmony_ci { 95a3e0fd82Sopenharmony_ci ReMeasure(); 96a3e0fd82Sopenharmony_ci return UIView::GetWidth(); 97a3e0fd82Sopenharmony_ci } 98a3e0fd82Sopenharmony_ci 99a3e0fd82Sopenharmony_ci /** 100a3e0fd82Sopenharmony_ci * @brief Obtains the height of this arc text. 101a3e0fd82Sopenharmony_ci * 102a3e0fd82Sopenharmony_ci * @return Returns the height of this arc text. 103a3e0fd82Sopenharmony_ci * @since 1.0 104a3e0fd82Sopenharmony_ci * @version 1.0 105a3e0fd82Sopenharmony_ci */ 106a3e0fd82Sopenharmony_ci int16_t GetHeight() override 107a3e0fd82Sopenharmony_ci { 108a3e0fd82Sopenharmony_ci ReMeasure(); 109a3e0fd82Sopenharmony_ci return UIView::GetHeight(); 110a3e0fd82Sopenharmony_ci } 111a3e0fd82Sopenharmony_ci 112a3e0fd82Sopenharmony_ci /** 113a3e0fd82Sopenharmony_ci * @brief Sets the view style. 114a3e0fd82Sopenharmony_ci * @param style Indicates the view style. 115a3e0fd82Sopenharmony_ci * @since 1.0 116a3e0fd82Sopenharmony_ci * @version 1.0 117a3e0fd82Sopenharmony_ci */ 118a3e0fd82Sopenharmony_ci void SetStyle(Style& style) override 119a3e0fd82Sopenharmony_ci { 120a3e0fd82Sopenharmony_ci UIView::SetStyle(style); 121a3e0fd82Sopenharmony_ci } 122a3e0fd82Sopenharmony_ci 123a3e0fd82Sopenharmony_ci /** 124a3e0fd82Sopenharmony_ci * @brief Sets a style. 125a3e0fd82Sopenharmony_ci * 126a3e0fd82Sopenharmony_ci * @param key Indicates the key of the style to set. 127a3e0fd82Sopenharmony_ci * @param value Indicates the value matching the key. 128a3e0fd82Sopenharmony_ci * @since 1.0 129a3e0fd82Sopenharmony_ci * @version 1.0 130a3e0fd82Sopenharmony_ci */ 131a3e0fd82Sopenharmony_ci void SetStyle(uint8_t key, int64_t value) override; 132a3e0fd82Sopenharmony_ci 133a3e0fd82Sopenharmony_ci /** 134a3e0fd82Sopenharmony_ci * @brief Sets the text content for this arc label. 135a3e0fd82Sopenharmony_ci * 136a3e0fd82Sopenharmony_ci * @param text Indicates the pointer to the text content. 137a3e0fd82Sopenharmony_ci * @since 1.0 138a3e0fd82Sopenharmony_ci * @version 1.0 139a3e0fd82Sopenharmony_ci */ 140a3e0fd82Sopenharmony_ci void SetText(const char* text); 141a3e0fd82Sopenharmony_ci 142a3e0fd82Sopenharmony_ci /** 143a3e0fd82Sopenharmony_ci * @brief Obtains the text of this arc label. 144a3e0fd82Sopenharmony_ci * 145a3e0fd82Sopenharmony_ci * @return Returns the text. 146a3e0fd82Sopenharmony_ci * @since 1.0 147a3e0fd82Sopenharmony_ci * @version 1.0 148a3e0fd82Sopenharmony_ci */ 149a3e0fd82Sopenharmony_ci const char* GetText() const; 150a3e0fd82Sopenharmony_ci 151a3e0fd82Sopenharmony_ci /** 152a3e0fd82Sopenharmony_ci * @brief Sets the alignment mode for this text. 153a3e0fd82Sopenharmony_ci * 154a3e0fd82Sopenharmony_ci * @param horizontalAlign Indicates the horizontal alignment mode to set, 155a3e0fd82Sopenharmony_ci * which can be {@link TEXT_ALIGNMENT_LEFT}, 156a3e0fd82Sopenharmony_ci * {@link TEXT_ALIGNMENT_CENTER}, or {@link TEXT_ALIGNMENT_RIGHT}. 157a3e0fd82Sopenharmony_ci * @since 1.0 158a3e0fd82Sopenharmony_ci * @version 1.0 159a3e0fd82Sopenharmony_ci */ 160a3e0fd82Sopenharmony_ci void SetAlign(UITextLanguageAlignment horizontalAlign); 161a3e0fd82Sopenharmony_ci 162a3e0fd82Sopenharmony_ci /** 163a3e0fd82Sopenharmony_ci * @brief Obtains the horizontal alignment mode. 164a3e0fd82Sopenharmony_ci * 165a3e0fd82Sopenharmony_ci * @return Returns the horizontal alignment mode. 166a3e0fd82Sopenharmony_ci * @since 1.0 167a3e0fd82Sopenharmony_ci * @version 1.0 168a3e0fd82Sopenharmony_ci */ 169a3e0fd82Sopenharmony_ci UITextLanguageAlignment GetHorAlign(); 170a3e0fd82Sopenharmony_ci 171a3e0fd82Sopenharmony_ci /** 172a3e0fd82Sopenharmony_ci * @brief Obtains the direction of this text. 173a3e0fd82Sopenharmony_ci * 174a3e0fd82Sopenharmony_ci * @return Returns the text direction, as defined in {@link UITextLanguageDirect}. 175a3e0fd82Sopenharmony_ci * @since 1.0 176a3e0fd82Sopenharmony_ci * @version 1.0 177a3e0fd82Sopenharmony_ci */ 178a3e0fd82Sopenharmony_ci UITextLanguageDirect GetDirect(); 179a3e0fd82Sopenharmony_ci 180a3e0fd82Sopenharmony_ci /** 181a3e0fd82Sopenharmony_ci * @brief Sets the font ID for this arc label. 182a3e0fd82Sopenharmony_ci * 183a3e0fd82Sopenharmony_ci * @param fontId Indicates the font ID composed of font name and size. 184a3e0fd82Sopenharmony_ci * @since 1.0 185a3e0fd82Sopenharmony_ci * @version 1.0 186a3e0fd82Sopenharmony_ci */ 187a3e0fd82Sopenharmony_ci void SetFontId(uint16_t fontId); 188a3e0fd82Sopenharmony_ci 189a3e0fd82Sopenharmony_ci /** 190a3e0fd82Sopenharmony_ci * @brief Obtains the font ID composed of font name and size. 191a3e0fd82Sopenharmony_ci * 192a3e0fd82Sopenharmony_ci * @return Returns the front ID of this arc label. 193a3e0fd82Sopenharmony_ci * @since 1.0 194a3e0fd82Sopenharmony_ci * @version 1.0 195a3e0fd82Sopenharmony_ci */ 196a3e0fd82Sopenharmony_ci uint16_t GetFontId(); 197a3e0fd82Sopenharmony_ci 198a3e0fd82Sopenharmony_ci /** 199a3e0fd82Sopenharmony_ci * @brief Sets the font for this arc label. 200a3e0fd82Sopenharmony_ci * 201a3e0fd82Sopenharmony_ci * @param name Indicates the pointer to the font name. 202a3e0fd82Sopenharmony_ci * @param size Indicates the font size to set. 203a3e0fd82Sopenharmony_ci * @since 1.0 204a3e0fd82Sopenharmony_ci * @version 1.0 205a3e0fd82Sopenharmony_ci */ 206a3e0fd82Sopenharmony_ci void SetFont(const char* name, uint8_t size); 207a3e0fd82Sopenharmony_ci 208a3e0fd82Sopenharmony_ci /** 209a3e0fd82Sopenharmony_ci * @brief Sets the center position for this arc text. 210a3e0fd82Sopenharmony_ci * 211a3e0fd82Sopenharmony_ci * @param x Indicates the x-coordinate to set. 212a3e0fd82Sopenharmony_ci * @param y Indicates the y-coordinate to set. 213a3e0fd82Sopenharmony_ci * @since 1.0 214a3e0fd82Sopenharmony_ci * @version 1.0 215a3e0fd82Sopenharmony_ci */ 216a3e0fd82Sopenharmony_ci void SetArcTextCenter(int16_t x, int16_t y) 217a3e0fd82Sopenharmony_ci { 218a3e0fd82Sopenharmony_ci if ((arcCenter_.x != x) || (arcCenter_.y != y)) { 219a3e0fd82Sopenharmony_ci arcCenter_.x = x; 220a3e0fd82Sopenharmony_ci arcCenter_.y = y; 221a3e0fd82Sopenharmony_ci RefreshArcLabel(); 222a3e0fd82Sopenharmony_ci } 223a3e0fd82Sopenharmony_ci } 224a3e0fd82Sopenharmony_ci 225a3e0fd82Sopenharmony_ci /** 226a3e0fd82Sopenharmony_ci * @brief Obtains the center position of this arc text. 227a3e0fd82Sopenharmony_ci * 228a3e0fd82Sopenharmony_ci * @return Returns the center position of this arc text. 229a3e0fd82Sopenharmony_ci * @since 1.0 230a3e0fd82Sopenharmony_ci * @version 1.0 231a3e0fd82Sopenharmony_ci */ 232a3e0fd82Sopenharmony_ci Point GetArcTextCenter() const 233a3e0fd82Sopenharmony_ci { 234a3e0fd82Sopenharmony_ci return arcCenter_; 235a3e0fd82Sopenharmony_ci } 236a3e0fd82Sopenharmony_ci 237a3e0fd82Sopenharmony_ci /** 238a3e0fd82Sopenharmony_ci * @brief Sets the radius for this arc text. 239a3e0fd82Sopenharmony_ci * 240a3e0fd82Sopenharmony_ci * @param radius Indicates the radius to set. 241a3e0fd82Sopenharmony_ci * @since 1.0 242a3e0fd82Sopenharmony_ci * @version 1.0 243a3e0fd82Sopenharmony_ci */ 244a3e0fd82Sopenharmony_ci void SetArcTextRadius(uint16_t radius) 245a3e0fd82Sopenharmony_ci { 246a3e0fd82Sopenharmony_ci if (radius_ != radius) { 247a3e0fd82Sopenharmony_ci radius_ = radius; 248a3e0fd82Sopenharmony_ci RefreshArcLabel(); 249a3e0fd82Sopenharmony_ci } 250a3e0fd82Sopenharmony_ci } 251a3e0fd82Sopenharmony_ci 252a3e0fd82Sopenharmony_ci /** 253a3e0fd82Sopenharmony_ci * @brief Obtains the radius of this arc text. 254a3e0fd82Sopenharmony_ci * 255a3e0fd82Sopenharmony_ci * @return Returns the radius of this arc text. 256a3e0fd82Sopenharmony_ci * @since 1.0 257a3e0fd82Sopenharmony_ci * @version 1.0 258a3e0fd82Sopenharmony_ci */ 259a3e0fd82Sopenharmony_ci uint16_t GetArcTextRadius() const 260a3e0fd82Sopenharmony_ci { 261a3e0fd82Sopenharmony_ci return radius_; 262a3e0fd82Sopenharmony_ci } 263a3e0fd82Sopenharmony_ci 264a3e0fd82Sopenharmony_ci /** 265a3e0fd82Sopenharmony_ci * @brief Sets the start angle and end angle for this arc text. 266a3e0fd82Sopenharmony_ci * 267a3e0fd82Sopenharmony_ci * The angle in 12 o'clock direction is 0 degrees, and the value increases clockwise. 268a3e0fd82Sopenharmony_ci * The text direction is clockwise when the end angle is greater than the start angle, and the text direction is 269a3e0fd82Sopenharmony_ci * counterclockwise otherwise. 270a3e0fd82Sopenharmony_ci * 271a3e0fd82Sopenharmony_ci * @param startAngle Indicates the start angle to set. 272a3e0fd82Sopenharmony_ci * @param endAngle Indicates the end angle to set. 273a3e0fd82Sopenharmony_ci * @since 1.0 274a3e0fd82Sopenharmony_ci * @version 1.0 275a3e0fd82Sopenharmony_ci */ 276a3e0fd82Sopenharmony_ci void SetArcTextAngle(int16_t startAngle, int16_t endAngle) 277a3e0fd82Sopenharmony_ci { 278a3e0fd82Sopenharmony_ci if ((startAngle_ != startAngle) || (endAngle_ != endAngle)) { 279a3e0fd82Sopenharmony_ci startAngle_ = startAngle; 280a3e0fd82Sopenharmony_ci endAngle_ = endAngle; 281a3e0fd82Sopenharmony_ci RefreshArcLabel(); 282a3e0fd82Sopenharmony_ci } 283a3e0fd82Sopenharmony_ci } 284a3e0fd82Sopenharmony_ci 285a3e0fd82Sopenharmony_ci /** 286a3e0fd82Sopenharmony_ci * @brief Obtains the start angle of this arc text. 287a3e0fd82Sopenharmony_ci * 288a3e0fd82Sopenharmony_ci * @return Returns the start angle of this arc text. 289a3e0fd82Sopenharmony_ci * @since 1.0 290a3e0fd82Sopenharmony_ci * @version 1.0 291a3e0fd82Sopenharmony_ci */ 292a3e0fd82Sopenharmony_ci int16_t GetArcTextStartAngle() const 293a3e0fd82Sopenharmony_ci { 294a3e0fd82Sopenharmony_ci return startAngle_; 295a3e0fd82Sopenharmony_ci } 296a3e0fd82Sopenharmony_ci 297a3e0fd82Sopenharmony_ci /** 298a3e0fd82Sopenharmony_ci * @brief Obtains the end angle of this arc text. 299a3e0fd82Sopenharmony_ci * 300a3e0fd82Sopenharmony_ci * @return Returns the end angle of this arc text. 301a3e0fd82Sopenharmony_ci * @since 1.0 302a3e0fd82Sopenharmony_ci * @version 1.0 303a3e0fd82Sopenharmony_ci */ 304a3e0fd82Sopenharmony_ci int16_t GetArcTextEndAngle() const 305a3e0fd82Sopenharmony_ci { 306a3e0fd82Sopenharmony_ci return endAngle_; 307a3e0fd82Sopenharmony_ci } 308a3e0fd82Sopenharmony_ci 309a3e0fd82Sopenharmony_ci /** 310a3e0fd82Sopenharmony_ci * @brief Sets the orientation for this arc text. 311a3e0fd82Sopenharmony_ci * 312a3e0fd82Sopenharmony_ci * @param orientation Indicates the text orientation to set. 313a3e0fd82Sopenharmony_ci * @since 1.0 314a3e0fd82Sopenharmony_ci * @version 1.0 315a3e0fd82Sopenharmony_ci */ 316a3e0fd82Sopenharmony_ci void SetArcTextOrientation(TextOrientation orientation) 317a3e0fd82Sopenharmony_ci { 318a3e0fd82Sopenharmony_ci if (orientation_ != orientation) { 319a3e0fd82Sopenharmony_ci orientation_ = orientation; 320a3e0fd82Sopenharmony_ci RefreshArcLabel(); 321a3e0fd82Sopenharmony_ci } 322a3e0fd82Sopenharmony_ci } 323a3e0fd82Sopenharmony_ci 324a3e0fd82Sopenharmony_ci /** 325a3e0fd82Sopenharmony_ci * @brief Obtains the orientation of this arc text. 326a3e0fd82Sopenharmony_ci * 327a3e0fd82Sopenharmony_ci * @return Returns the orientation of this arc text. 328a3e0fd82Sopenharmony_ci * @since 1.0 329a3e0fd82Sopenharmony_ci * @version 1.0 330a3e0fd82Sopenharmony_ci */ 331a3e0fd82Sopenharmony_ci TextOrientation GetArcTextOrientation() const 332a3e0fd82Sopenharmony_ci { 333a3e0fd82Sopenharmony_ci return orientation_; 334a3e0fd82Sopenharmony_ci } 335a3e0fd82Sopenharmony_ci 336a3e0fd82Sopenharmony_ci /** 337a3e0fd82Sopenharmony_ci * @brief Is it compatible with older versions. 338a3e0fd82Sopenharmony_ci * 339a3e0fd82Sopenharmony_ci * @param compatibilityMode Indicates compatible with older versions. 340a3e0fd82Sopenharmony_ci */ 341a3e0fd82Sopenharmony_ci void SetCompatibilityMode(bool compatibilityMode) 342a3e0fd82Sopenharmony_ci { 343a3e0fd82Sopenharmony_ci if (compatibilityMode_ != compatibilityMode) { 344a3e0fd82Sopenharmony_ci compatibilityMode_ = compatibilityMode; 345a3e0fd82Sopenharmony_ci RefreshArcLabel(); 346a3e0fd82Sopenharmony_ci } 347a3e0fd82Sopenharmony_ci } 348a3e0fd82Sopenharmony_ci 349a3e0fd82Sopenharmony_ci /** 350a3e0fd82Sopenharmony_ci * @brief Draws an arc text. 351a3e0fd82Sopenharmony_ci * 352a3e0fd82Sopenharmony_ci * @param invalidatedArea Indicates the area to draw. 353a3e0fd82Sopenharmony_ci * @since 1.0 354a3e0fd82Sopenharmony_ci * @version 1.0 355a3e0fd82Sopenharmony_ci */ 356a3e0fd82Sopenharmony_ci void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; 357a3e0fd82Sopenharmony_ci 358a3e0fd82Sopenharmony_ci /** 359a3e0fd82Sopenharmony_ci * @brief Start animation. 360a3e0fd82Sopenharmony_ci * 361a3e0fd82Sopenharmony_ci */ 362a3e0fd82Sopenharmony_ci void Start(); 363a3e0fd82Sopenharmony_ci 364a3e0fd82Sopenharmony_ci /** 365a3e0fd82Sopenharmony_ci * @brief Stop animation. 366a3e0fd82Sopenharmony_ci * 367a3e0fd82Sopenharmony_ci */ 368a3e0fd82Sopenharmony_ci void Stop(); 369a3e0fd82Sopenharmony_ci 370a3e0fd82Sopenharmony_ci /** 371a3e0fd82Sopenharmony_ci * @brief Sets the number of cycles. 372a3e0fd82Sopenharmony_ci * 373a3e0fd82Sopenharmony_ci * @param rollCount Indicates number of cycles. 374a3e0fd82Sopenharmony_ci */ 375a3e0fd82Sopenharmony_ci void SetRollCount(const uint16_t rollCount); 376a3e0fd82Sopenharmony_ci 377a3e0fd82Sopenharmony_ci /** 378a3e0fd82Sopenharmony_ci * @brief Register a listener that contains a callback to be invoked scroll state change. 379a3e0fd82Sopenharmony_ci * 380a3e0fd82Sopenharmony_ci * @param scrollListener Indicates the listener to register. 381a3e0fd82Sopenharmony_ci */ 382a3e0fd82Sopenharmony_ci void RegisterScrollListener(ArcLabelScrollListener* scrollListener); 383a3e0fd82Sopenharmony_ci 384a3e0fd82Sopenharmony_ci /** 385a3e0fd82Sopenharmony_ci * @brief Set animation speed. 386a3e0fd82Sopenharmony_ci * 387a3e0fd82Sopenharmony_ci * @param speed Indicates the scroll speed to set. 388a3e0fd82Sopenharmony_ci */ 389a3e0fd82Sopenharmony_ci void SetRollSpeed(const uint16_t speed); 390a3e0fd82Sopenharmony_ci 391a3e0fd82Sopenharmony_ci /** 392a3e0fd82Sopenharmony_ci * @brief Obtains the scroll speed for this arclabel. 393a3e0fd82Sopenharmony_ci * 394a3e0fd82Sopenharmony_ci * @return Returns the scroll speed. 395a3e0fd82Sopenharmony_ci */ 396a3e0fd82Sopenharmony_ci uint16_t GetRollSpeed() const; 397a3e0fd82Sopenharmony_ci 398a3e0fd82Sopenharmony_ci void ReMeasure() override; 399a3e0fd82Sopenharmony_ciprotected: 400a3e0fd82Sopenharmony_ci Text* arcLabelText_; 401a3e0fd82Sopenharmony_ci bool compatibilityMode_; 402a3e0fd82Sopenharmony_ci float offsetAngle_; 403a3e0fd82Sopenharmony_ci ArcTextInfo arcTextInfo_; 404a3e0fd82Sopenharmony_ci bool needRefresh_; 405a3e0fd82Sopenharmony_ci bool hasAnimator_; 406a3e0fd82Sopenharmony_ci 407a3e0fd82Sopenharmony_ci virtual void InitArcLabelText() 408a3e0fd82Sopenharmony_ci { 409a3e0fd82Sopenharmony_ci if (arcLabelText_ == nullptr) { 410a3e0fd82Sopenharmony_ci arcLabelText_ = new Text(); 411a3e0fd82Sopenharmony_ci if (arcLabelText_ == nullptr) { 412a3e0fd82Sopenharmony_ci GRAPHIC_LOGE("new Text fail"); 413a3e0fd82Sopenharmony_ci return; 414a3e0fd82Sopenharmony_ci } 415a3e0fd82Sopenharmony_ci } 416a3e0fd82Sopenharmony_ci } 417a3e0fd82Sopenharmony_ci void RefreshArcLabel(); 418a3e0fd82Sopenharmony_ci 419a3e0fd82Sopenharmony_ci virtual void DrawArcText(BufferInfo& gfxDstBuffer, 420a3e0fd82Sopenharmony_ci const Rect& mask, 421a3e0fd82Sopenharmony_ci OpacityType opaScale, 422a3e0fd82Sopenharmony_ci ArcTextInfo arcTextInfo, 423a3e0fd82Sopenharmony_ci TextOrientation orientation); 424a3e0fd82Sopenharmony_ci 425a3e0fd82Sopenharmony_ci virtual Rect GetArcTextRect(const char* text, 426a3e0fd82Sopenharmony_ci uint16_t fontId, 427a3e0fd82Sopenharmony_ci uint8_t fontSize, 428a3e0fd82Sopenharmony_ci const Point& arcCenter, 429a3e0fd82Sopenharmony_ci int16_t letterSpace, 430a3e0fd82Sopenharmony_ci TextOrientation orientation, 431a3e0fd82Sopenharmony_ci const ArcTextInfo& arcTextInfo); 432a3e0fd82Sopenharmony_ci 433a3e0fd82Sopenharmony_ci virtual uint32_t GetLineEnd(int16_t maxLength); 434a3e0fd82Sopenharmony_ci 435a3e0fd82Sopenharmony_ci virtual uint16_t GetArcLength(); 436a3e0fd82Sopenharmony_ciprivate: 437a3e0fd82Sopenharmony_ci friend class ArcLabelAnimator; 438a3e0fd82Sopenharmony_ci void MeasureArcTextInfo(); 439a3e0fd82Sopenharmony_ci void OnMeasureArcTextInfo(const uint16_t arcAngle, const uint16_t letterHeight); 440a3e0fd82Sopenharmony_ci 441a3e0fd82Sopenharmony_ci Point textSize_; 442a3e0fd82Sopenharmony_ci uint16_t radius_; 443a3e0fd82Sopenharmony_ci int16_t startAngle_; 444a3e0fd82Sopenharmony_ci int16_t endAngle_; 445a3e0fd82Sopenharmony_ci Point arcCenter_; 446a3e0fd82Sopenharmony_ci TextOrientation orientation_; 447a3e0fd82Sopenharmony_ci struct { 448a3e0fd82Sopenharmony_ci Animator* animator; 449a3e0fd82Sopenharmony_ci ArcLabelScrollListener* scrollListener; 450a3e0fd82Sopenharmony_ci uint16_t speed; 451a3e0fd82Sopenharmony_ci uint16_t rollCount; 452a3e0fd82Sopenharmony_ci float secondLapOffsetAngle_; 453a3e0fd82Sopenharmony_ci } animator_; 454a3e0fd82Sopenharmony_ci}; 455a3e0fd82Sopenharmony_ci} // namespace OHOS 456a3e0fd82Sopenharmony_ci#endif // GRAPHIC_LITE_UI_ARC_LABEL_H 457