Example #1
0
void Cursor::addAtCursor(const QByteArray &data, bool only_latin)
{
    if (m_insert_mode == Replace) {
        replaceAtCursor(data, only_latin);
    } else {
        insertAtCursor(data, only_latin);
    }
}
Example #2
0
void Cursor::addAtCursor(const QByteArray &data)
{
    if (m_insert_mode == Replace) {
        replaceAtCursor(data);
    } else {
        insertAtCursor(data);
    }
}
Example #3
0
	void Editable::onKeyPressed(const KeyEvent &e) {
		UIElement::onKeyPressed(e);
		if(e.isPrintable())
			insertAtCursor(e.getCharacter());
		else {
			size_t oldPos;
			switch(e.getKeyCode()) {
				case VK_DELETE:
					removeNext();
					break;
				case VK_BACKSP:
					removeLast();
					break;
				case VK_LEFT:
					if(_cursor > 0)
						moveCursor(-1);
					if(e.isShiftDown())
						changeSelection(_cursor,_cursor + 1,DIR_LEFT);
					else if(_selStart != -1)
						clearSelection();
					break;
				case VK_RIGHT:
					if(_cursor < _str.length())
						moveCursor(1);
					if(e.isShiftDown())
						changeSelection(_cursor,_cursor - 1,DIR_RIGHT);
					else if(_selStart != -1)
						clearSelection();
					break;
				case VK_HOME:
					oldPos = _cursor;
					if(_cursor != 0)
						moveCursorTo(0);
					if(e.isShiftDown())
						changeSelection(_cursor,oldPos,DIR_LEFT);
					else if(_selStart != -1)
						clearSelection();
					break;
				case VK_END:
					oldPos = _cursor;
					if(_cursor != _str.length())
						moveCursorTo(_str.length());
					if(e.isShiftDown())
						changeSelection(_cursor,oldPos,DIR_RIGHT);
					else if(_selStart != -1)
						clearSelection();
					break;
			}
		}
		repaint();
	}
Example #4
0
	void Editable::insertAtCursor(char c) {
		char str[] = {c,'\0'};
		insertAtCursor(str);
	}
Example #5
0
 long insertAtCursor(TextData* d) {
     return insertAtCursor(d->getAmount(0, d->getLength()), d->getLength());
 }
Example #6
0
 long insertAtCursor(const String& s) {
     return insertAtCursor((const byte*) s.toCString(), s.getLength());
 }