class
UIng::Area::AttributedString
- UIng::Area::AttributedString
- Reference
- Object
Included Modules
- UIng::BlockConstructor
Defined in:
uing/area/area/attributed_string.crConstructors
- .new(*args, &)
- .new(*args, **kwargs, &)
- .new(ref_ptr : Pointer(LibUI::AttributedString))
- .new(string : String)
Class Method Summary
Instance Method Summary
- #append_unattributed(text : String) : Nil
- #byte_index_to_grapheme(pos : LibC::SizeT) : LibC::SizeT
- #delete(start : LibC::SizeT, end_ : LibC::SizeT) : Nil
-
#each_attribute(&block : Attribute, LibC::SizeT, LibC::SizeT -> _) : Nil
Each yielded Attribute is borrowed and only valid until the block returns.
-
#each_attribute_while(&block : Attribute, LibC::SizeT, LibC::SizeT -> Bool) : Nil
Enumerates attributes while the block returns true.
- #finalize
- #free : Nil
- #grapheme_to_byte_index(pos : LibC::SizeT) : LibC::SizeT
- #insert_at_unattributed(text : String, at : LibC::SizeT) : Nil
- #len : LibC::SizeT
- #num_graphemes : LibC::SizeT
-
#set_attribute(attribute : Attribute, start : LibC::SizeT, end_ : LibC::SizeT) : Nil
Applies an attribute to a range of text.
- #string : String | Nil
- #to_unsafe
Macros inherited from module UIng::BlockConstructor
block_constructor
block_constructor
Constructor Detail
Class Method Detail
Instance Method Detail
Each yielded Attribute is borrowed and only valid until the block returns.
Enumerates attributes while the block returns true. Returning false stops enumeration after the current attribute.
Applies an attribute to a range of text.
IMPORTANT: Ownership transfer
- libui takes ownership of the attribute after this call.
- The attribute MUST NOT be reused or freed manually.
- Each call requires a NEW Attribute instance.
Example: attr_str.set_attribute(Attribute.new_color(1.0, 0.0, 0.0, 1.0), 0, 5)