• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 SPANNABLE_STRING_H
17 #define SPANNABLE_STRING_H
18 #include "gfx_utils/list.h"
19 #include "font/ui_font_header.h"
20 namespace OHOS {
21 #if defined(ENABLE_SPANNABLE_STRING) && ENABLE_SPANNABLE_STRING
22 class StyleSpan : public HeapBase {
23 public:
StyleSpan()24     StyleSpan() {};
~StyleSpan()25     ~StyleSpan() {};
26     TextStyle textStyle_;
27     uint16_t start_;
28     uint16_t end_;
StyleSpan(TextStyle textStyle,uint16_t start,uint16_t end)29     StyleSpan(TextStyle textStyle, uint16_t start, uint16_t end)
30     {
31         textStyle_ = textStyle;
32         start_ = start;
33         end_ = end;
34     };
35 };
36 class SpannableString : public HeapBase {
37 public:
SpannableString()38     SpannableString() {};
39     ~SpannableString();
40     SpannableString(const char* text);
41     char* text_;
42     List<StyleSpan*> spanList_;
43     void SetTextStyle(TextStyle textStyle, uint16_t startIndex, uint16_t endIndex);
44 };
45 #endif
46 }
47 #endif
48