Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBTextFragment Class Reference

The textfragment baseclass for TBStyleEdit. More...

#include <tb_style_edit.h>

Inheritance diagram for tb::TBTextFragment:
tb::TBLinkOf< TBTextFragment > tb::TBLink

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 Attributes

int16_t xpos
 
int16_t ypos
 
uint16_t ofs
 
uint16_t len
 
uint16_t line_ypos
 
uint16_t line_height
 
TBBlockblock
 
TBTextFragmentContentcontent
 

Detailed Description

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.

Member Function Documentation

int32_t tb::TBTextFragment::GetStringWidth ( TBFontFace font,
const char *  str,
int  len 
)

Get the stringwidth.

Handles passwordmode, tab, linebreaks etc automatically.


The documentation for this class was generated from the following files: