Hasty Badger
Small UI library (a branch of Turbo Badger)
|
The textfragment baseclass for TBStyleEdit. More...
#include <tb_style_edit.h>
Public Member Functions | |
TBTextFragment (TBTextFragmentContent *content=nullptr) | |
void | Init (TBBlock *block, uint16_t ofs, uint16_t len) |
void | UpdateContentPos () |
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) |
void | Click (int button, uint32_t modifierkeys) |
bool | IsText () const |
bool | IsEmbedded () const |
bool | IsBreak () const |
bool | IsSpace () const |
bool | IsTab () const |
int32_t | GetCharX (TBFontFace *font, int32_t ofs) |
int32_t | GetCharOfs (TBFontFace *font, int32_t x) |
int32_t | GetStringWidth (TBFontFace *font, const char *str, int len) |
Get the stringwidth. More... | |
bool | GetAllowBreakBefore () const |
bool | GetAllowBreakAfter () const |
const char * | Str () const |
int32_t | GetWidth (TBFontFace *font) |
int32_t | GetHeight (TBFontFace *font) |
int32_t | GetBaseline (TBFontFace *font) |
Public Member Functions inherited from tb::TBLinkOf< TBTextFragment > | |
TBTextFragment * | GetPrev () const |
TBTextFragment * | 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 | |
int16_t | xpos |
int16_t | ypos |
uint16_t | ofs |
uint16_t | len |
uint16_t | line_ypos |
uint16_t | line_height |
TBBlock * | block |
TBTextFragmentContent * | content |
Public Attributes inherited from tb::TBLink | |
TBLink * | prev |
TBLink * | next |
TBLinkList * | linklist |
The textfragment baseclass for TBStyleEdit.
TODO: This object is allocated on vast amounts and need to shrink in size. Remove all cached positioning and implement a fragment traverser (for TBBlock). Also allocate fragments in chunks.
int32_t tb::TBTextFragment::GetStringWidth | ( | TBFontFace * | font, |
const char * | str, | ||
int | len | ||
) |
Get the stringwidth.
Handles passwordmode, tab, linebreaks etc automatically.