Hasty Badger
Small UI library (a branch of Turbo Badger)
|
A block of text (a line, that might be wrapped) More...
#include <tb_style_edit.h>
Public Member Functions | |
TBBlock (TBStyleEdit *styledit) | |
void | Clear () |
void | Set (TBStr newstr) |
void | SetAlign (TB_TEXT_ALIGN align) |
int32_t | InsertText (int32_t ofs, const char *text, int32_t len, bool allow_line_recurse) |
void | RemoveContent (int32_t ofs, int32_t len) |
void | Split () |
Check if this block contains extra line breaks and split into new blocks if it does. More... | |
void | Merge () |
Check if we've lost the ending break on this block and if so merge it with the next block. More... | |
void | Layout (bool update_fragments, bool propagate_height) |
Layout the block. More... | |
void | SetSize (int32_t old_w, int32_t new_w, int32_t new_h, bool propagate_height) |
Update the size of this block. More... | |
TBTextFragment * | FindFragment (int32_t ofs, bool prefer_first=false) const |
TBTextFragment * | FindFragment (int32_t x, int32_t y) const |
int32_t | CalculateStringWidth (TBFontFace *font, const char *str, int len=TB_ALL_TO_TERMINATION) const |
int32_t | CalculateTabWidth (TBFontFace *font, int32_t xpos) const |
int32_t | CalculateLineHeight (TBFontFace *font) const |
int32_t | CalculateBaseline (TBFontFace *font) const |
void | Invalidate () const |
void | BuildSelectionRegion (int32_t translate_x, int32_t translate_y, TBTextProps *props, TBRegion &bg_region, TBRegion &fg_region) |
void | Paint (int32_t translate_x, int32_t translate_y, TBTextProps *props) |
Public Member Functions inherited from tb::TBLinkOf< TBBlock > | |
TBBlock * | GetPrev () const |
TBBlock * | GetNext () const |
Public Member Functions inherited from tb::TBLink | |
bool | IsInList () const |
Return true if the link is currently added to a list. More... | |
Public Attributes | |
TBStyleEdit * | styledit |
TBLinkListOf< TBTextFragment > | fragments |
int32_t | ypos |
int16_t | height |
int8_t | align |
int | line_width_max |
TBStr | str |
int32_t | str_len |
Public Attributes inherited from tb::TBLink | |
TBLink * | prev |
TBLink * | next |
TBLinkList * | linklist |
A block of text (a line, that might be wrapped)
void tb::TBBlock::Layout | ( | bool | update_fragments, |
bool | propagate_height | ||
) |
Layout the block.
To be called when the text has changed or the layout width has changed.
update_fragments | Should be true if the text has been changed (will recreate elements). |
propagate_height | If true, all following blocks will be moved if the height changed. |
void tb::TBBlock::Merge | ( | ) |
Check if we've lost the ending break on this block and if so merge it with the next block.
void tb::TBBlock::SetSize | ( | int32_t | old_w, |
int32_t | new_w, | ||
int32_t | new_h, | ||
bool | propagate_height | ||
) |
Update the size of this block.
If propagate_height is true, all following blocks will be moved if the height changed.
void tb::TBBlock::Split | ( | ) |
Check if this block contains extra line breaks and split into new blocks if it does.