handleCharRight:
Code: Select all
String text = this->getText();
int triggerSize = this->getFont()->getColourTrigger().size()+8;
int jump = 1;
int lastChar = text.size();
size_t pos = text.rfind(this->getFont()->getColourTrigger());
while (pos > d_caratPos)
{
if (pos == d_caratPos+1)
jump = triggerSize+1;
if (pos == text.size()-triggerSize)
lastChar = text.size()-triggerSize-1;
pos = text.rfind(this->getFont()->getColourTrigger(), pos-triggerSize);
}
if (d_caratPos < lastChar)
{
setCaratIndex(d_caratPos + jump);
}
if (sysKeys & Shift)
{
setSelection(d_caratPos, d_dragAnchorIdx);
}
else
{
clearSelection();
}
handleCharLeft:
Code: Select all
String text = this->getText();
int triggerSize = this->getFont()->getColourTrigger().size()+8;
int jump = 1;
int firstChar = 0;
size_t pos = text.find_first_of(this->getFont()->getColourTrigger());
while (pos < d_caratPos)
{
if (pos == d_caratPos-triggerSize)
jump = triggerSize+1;
if (pos == 0)
firstChar = triggerSize;
pos = text.find_first_of(this->getFont()->getColourTrigger(), pos+triggerSize);
}
if (d_caratPos > firstChar)
{
setCaratIndex(d_caratPos - jump);
}
if (sysKeys & Shift)
{
setSelection(d_caratPos, d_dragAnchorIdx);
}
else
{
clearSelection();
}
Change this in both CEGUIEditbox.cpp and MultiLineEditbox.cpp.
I have to change also handleWordLeft and handleWordRight as well as the method that is called when I click with the mouse in the widget.
I'm having some problems realising how to different styles in a text. Is it easier to do it in CEGUIFont or to create a new widget? if I do it in CEGUIFont I'll have to have a glyph for each style right?
thanks