Implemented Get/Set Caret and Insert
git-svn-id: svn://10.0.0.236/trunk@5058 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -61,8 +61,12 @@ PRUint32 nsTextHelper::SetText(const nsString &aText)
|
||||
|
||||
PRUint32 nsTextHelper::InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos)
|
||||
{
|
||||
// NOT IMPLEMENTED
|
||||
return(0);
|
||||
nsString currentText;
|
||||
GetText(currentText, 256);
|
||||
nsString newText(aText);
|
||||
currentText.Insert(newText, aStartPos, aText.Length());
|
||||
SetText(currentText);
|
||||
return(aText.Length());
|
||||
}
|
||||
|
||||
void nsTextHelper::RemoveText()
|
||||
@@ -102,11 +106,18 @@ void nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
|
||||
|
||||
void nsTextHelper::SetCaretPosition(PRUint32 aPosition)
|
||||
{
|
||||
SetSelection(aPosition, aPosition);
|
||||
}
|
||||
|
||||
PRUint32 nsTextHelper::GetCaretPosition()
|
||||
{
|
||||
return(0);
|
||||
PRUint32 start;
|
||||
PRUint32 end;
|
||||
GetSelection(&start, &end);
|
||||
if (start == end) {
|
||||
return start;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user