# OHOS::TextAdapter ## **Overview** **Related Modules:** [Graphic](Graphic.md) **Description:** Defines a text adapter, which implements [UILabel](OHOS-UILabel.md) instance construction and supports text data and continuous integer data. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Public Member Functions

Public Member Function Name

Description

TextAdapter ()

 

A constructor used to create a UILabel instance.

~TextAdapter ()

virtual 

A destructor used to delete the UILabel instance.

GetView (UIView *inView, int16_t index) override

UIView

Obtains a UILabel instance to convert adapter data into another UILabel instance.

SetData (List< const char * > *data)

void 

Sets the UILabel adapter data, which is a string linked list.

SetData (int16_t start, int16_t end)

void 

Sets continuously increasing data. For example, if you need to set data 0, 1, 2, 3, 4, use this function to set start to 0 and end to 4.

SetFontId (uint8_t fontId)

void 

Sets font ID.

GetFontId () const

uint8_t 

Obtains font ID.

SetFont (const char *name, uint8_t size)

void 

Sets the font.

GetStyle ()

Style

Obtains the UILabel adapter style.

GetCount () override

virtual uint16_t 

Obtains the data size of the UILabel adapter.

SetWidth (int16_t width)

void 

Sets the width of UILabel constructed by the adapter.

SetDirect (UITextLanguageDirect direct)

void 

Sets the direction of the UILabel constructed by the adapter.

SetHeight (int16_t height)

void 

Sets the height of the UILabel constructed by the adapter.

SetLineBreakMode (const uint8_t lineBreakMode)

void 

Sets the LineBreakMode attribute of UILabel constructed by the adapter. For details about the values of LineBreakMode, see LINE_BREAK_ADAPT, LINE_BREAK_WRAP, LINE_BREAK_ELLIPSIS, and LINE_BREAK_MARQUEE.

SetOnClickListener (UIView::OnClickListener *clickListener)

void 

Sets the callback function to be invoked upon a click event.

SetTextFormatter (TextFormatter *formatter)

void 

Sets the text formatter.

AbstractAdapter ()

 

A constructor used to create an AbstractAdapter instance.

~AbstractAdapter ()

virtual 

A destructor used to delete the AbstractAdapter instance.

operator new (size_t size)

void * 

Overrides the new function.

operator delete (void *p)

void 

Overrides the delete function.