44 mMouseLeftPressed(false),
47 mModeMultiline(false),
52 mOverflowToTheLeft(false),
226 while (iterBack != text.
rend())
228 if (((*iterBack) < 265) && (ispunct(*iterBack) || isspace(*iterBack)))
233 while (iterForw != text.
end())
235 if (((*iterForw) < 265) && (ispunct(*iterForw) || isspace(*iterForw)))
703 void EditBox::frameEntered(
float _frame)
733 mouse.
left -= view.left;
734 mouse.top -= view.top;
870 void EditBox::resetSelect()
880 void EditBox::commandPosition(
size_t _undo,
size_t _redo,
size_t _length,
VectorChangeInfo* _info)
882 if (_info !=
nullptr)
883 _info->push_back(TextCommandInfo(_undo, _redo, _length));
886 void EditBox::commandMerge()
895 for (VectorChangeInfo::iterator iter = info.begin(); iter != info.end(); ++iter)
901 bool EditBox::commandUndo()
916 UString text = getRealString();
919 for (VectorChangeInfo::reverse_iterator iter = info.rbegin(); iter != info.rend(); ++iter)
922 text.erase((*iter).start, (*iter).text.size());
924 text.insert((*iter).start, (*iter).text);
946 bool EditBox::commandRedo()
961 UString text = getRealString();
964 for (VectorChangeInfo::iterator iter = info.begin(); iter != info.end(); ++iter)
967 text.insert((*iter).start, (*iter).text);
969 text.erase((*iter).start, (*iter).text.size());
994 if (_info ==
nullptr)
1014 size_t end = _start + _count;
1023 bool need_colour =
true;
1041 else if (pos == _start)
1050 else if (pos == end)
1062 void EditBox::_setTextColour(
size_t _start,
size_t _count,
const Colour& _colour,
bool _history)
1070 size_t end = _start + _count;
1079 while (iterator.moveNext())
1082 size_t pos = iterator.getPosition();
1085 iterator.getTagColour(colour);
1092 else if (pos == _start)
1093 iterator.setTagColour(_colour);
1097 iterator.clearTagColour();
1100 else if (pos == end)
1102 iterator.setTagColour(colour);
1110 commandPosition(_start, _start + _count,
mTextLength, history);
1115 saveInHistory(history);
1120 commandResetHistory();
1123 setRealString(iterator.getText());
1126 void EditBox::setTextSelectColour(
const Colour& _colour,
bool _history)
1134 _setTextColour(start, end - start, _colour, _history);
1171 commandResetHistory();
1174 void EditBox::setText(
const UString& _caption,
bool _history)
1211 saveInHistory(history);
1216 commandResetHistory();
1219 setRealString(iterator.getText());
1245 TextIterator iterator(getRealString(), history);
1251 bool need_colour = ( (_text.size() > 6) && (_text[0] == L
'#') && (_text[1] != L
'#') );
1254 while (iterator.moveNext())
1257 size_t pos = iterator.getPosition();
1261 iterator.getTagColour(colour);
1270 iterator.setTagColour(colour);
1292 commandPosition(_start, _start +
mTextLength - old, old, history);
1297 saveInHistory(history);
1302 commandResetHistory();
1305 setRealString(iterator.getText());
1328 TextIterator iterator(getRealString(), history);
1333 size_t end = _start + _count;
1334 bool need_colour =
false;
1337 while (iterator.moveNext())
1340 size_t pos = iterator.getPosition();
1346 iterator.getTagColour(colour);
1351 else if (pos == _start)
1354 if (!colour.empty())
1360 iterator.getTagColour(colour);
1361 iterator.saveStartPoint();
1368 iterator.getTagColour(colour);
1372 else if (pos == end)
1375 if (!colour.empty())
1377 if (iterator.getTagColour(colour))
1378 need_colour =
false;
1386 iterator.eraseFromStart();
1389 iterator.setTagColour(colour);
1392 commandPosition(_start + _count, _start,
mTextLength, history);
1401 saveInHistory(history);
1406 commandResetHistory();
1409 setRealString(iterator.getText());
1417 void EditBox::commandCut()
1434 void EditBox::commandCopy()
1443 void EditBox::commandPast()
1462 const UString& EditBox::getRealString()
1472 void EditBox::setRealString(
const UString& _caption)
1497 void EditBox::updateEditState()
1553 setText(_value,
false);
1558 return getRealString();
1561 void EditBox::updateSelectText()
1633 point.
top = _position;
1639 point.
left = _position;
1652 int offset = point.
top;
1660 else if (offset > (
int)
mVRange)
1663 if (offset != point.
top)
1674 int offset = point.
left;
1682 else if (offset > (
int)
mHRange)
1685 if (offset != point.
left)
1687 point.
left = offset;
1733 updateCursorPosition();
1737 void EditBox::updateCursorPosition()
1758 if (!view.
inside(cursor))
1788 else if (cursor.
top < view.
top)
1790 delta = - (view.
top - cursor.
top);
1796 offset.
top = point.
top + delta;
1801 if (offset != point)
1812 void EditBox::setContentPosition(
const IntPoint& _point)
1818 IntSize EditBox::getViewSize()
1825 IntSize EditBox::getContentSize()
1832 size_t EditBox::getVScrollPage()
1839 size_t EditBox::getHScrollPage()
1846 IntPoint EditBox::getContentPosition()
1853 Align EditBox::getContentAlign()
1862 _setTextColour(_start, _count, _colour,
false);
1887 setTextSelectColour(_colour,
false);
1924 commandResetHistory();
1933 setText(getRealString(),
false);
1941 commandResetHistory();
1960 if (!_value.
empty())
2022 point.
left = _index;
2044 if (_key ==
"CursorPosition")
2048 else if (_key ==
"TextSelect")
2052 else if (_key ==
"ReadOnly")
2056 else if (_key ==
"Password")
2060 else if (_key ==
"MultiLine")
2064 else if (_key ==
"PasswordChar")
2068 else if (_key ==
"MaxTextLength")
2072 else if (_key ==
"OverflowToTheLeft")
2076 else if (_key ==
"Static")
2080 else if (_key ==
"VisibleVScroll")
2084 else if (_key ==
"VisibleHScroll")
2088 else if (_key ==
"WordWrap")
2092 else if (_key ==
"TabPrinting")
2096 else if (_key ==
"InvertSelected")
2203 void EditBox::commandResetRedo()
2208 void EditBox::commandResetHistory()