declare function TO_KeyAddChar(gad as _Gadget ptr,c as string)as integer
declare function TO_KeyBackspace(gad as _Gadget ptr)as integer
declare function TO_KeyDelete(gad as _Gadget ptr)as integer
declare function TO_KeyReturn(gad as _Gadget ptr)as integer

declare function TO_SetCursor overload(gad as _Gadget ptr,l as integer,p as integer)as integer
declare function TO_SetCursor(gad as _Gadget ptr,l as Textline ptr,p as integer)as integer
declare function TO_CursorUp(gad as _Gadget ptr)as integer
declare function TO_CursorDown(gad as _Gadget ptr)as integer
declare function TO_CursorLeft(gad as _Gadget ptr)as integer
declare function TO_CursorRight(gad as _Gadget ptr)as integer
'added by MilkFreeze, modified by Muttonhead :)
declare function TO_CursorKeyPos1(gad as _Gadget ptr)as integer
declare function TO_CursorKeyEnd(gad as _Gadget ptr)as integer

declare function TO_GetCursorLine(gad as _Gadget ptr) as integer
declare function TO_GetCursorPosition(gad as _Gadget ptr) as integer
declare function TO_GetLines (gad as _Gadget ptr) as integer
declare function TO_GetLineAddr(gad as _Gadget ptr,i as integer) as TextLine ptr
declare function TO_GetLineIndex(gad as _Gadget ptr,r as TextLine ptr) as integer
declare function TO_GetLongestLine(gad as _Gadget ptr) as integer

declare function TO_LoadText (gad as _Gadget ptr,s as string,linebreak as string=chr(13,10)) as integer
declare function TO_SetText (gad as _Gadget ptr,s as string,linebreak as string=chr(13,10)) as integer

declare function TO_SaveText (gad as _Gadget ptr,filename as string, linebreak as string=chr(13,10))as integer
declare function TO_GetText (gad as _Gadget ptr,linebreak as string=chr(13,10)) as string
declare function TO_GetLineContent overload(gad as _Gadget ptr,i as integer) as string
declare function TO_GetLineContent (gad as _Gadget ptr,l as TextLine ptr) as string
declare function TO_SetLineContent overload(gad as _Gadget ptr,i as integer,t as string)as integer
declare function TO_SetLineContent (gad as _Gadget ptr,l as TextLine ptr,t as string)as integer
declare function TO_AppendLine (gad as _Gadget ptr,t as string) as integer
declare function TO_ClearText (gad as _Gadget ptr) as integer

function TO_KeyAddChar(gad as _Gadget ptr,c as string)as integer
  function=0
  if gad->texto then
    gad->texto->KeyAddChar(c)
    function=1
  end if
end function



function TO_KeyBackspace(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->KeyBackspace
    function=1
  end if
end function


function TO_KeyDelete(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->KeyDelete
    function=1
  end if
end function



function TO_KeyReturn(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->KeyReturn
    function=1
  end if
end function



function TO_SetCursor overload(gad as _Gadget ptr,l as integer,p as integer)as integer
  function=0
  if gad->texto then
    gad->texto->SetCursor(l,p)
    function=1
  end if
end function



function TO_SetCursor(gad as _Gadget ptr,l as Textline ptr,p as integer)as integer
  function=0
  if gad->texto then
    gad->texto->SetCursor(l,p)
    function=1
  end if
end function



function TO_CursorUp(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->CursorUp
    function=1
  end if
end function



function TO_CursorDown(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->CursorDown
    function=1
  end if
end function



function TO_CursorLeft(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->CursorLeft
    function=1
  end if
end function



function TO_CursorRight(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->CursorRight
    function=1
  end if
end function



function TO_CursorKeyPos1(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->CursorKeyPos1
    function=1
  end if
end function



function TO_CursorKeyEnd(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->CursorKeyEnd
    function=1
  end if
end function



function TO_GetCursorLine(gad as _Gadget ptr) as integer
  function=0
  if gad->texto then function=gad->texto->GetCursorLine
end function



function TO_GetCursorPosition(gad as _Gadget ptr) as integer
  function=0
  if gad->texto then function=gad->texto->GetCursorPosition
end function



function TO_GetLines (gad as _Gadget ptr) as integer
  function=0
  if gad->texto then function=gad->texto->GetLines
end function



function TO_GetLineAddr(gad as _Gadget ptr,i as integer) as TextLine ptr
  function=0
  if gad->texto then function=gad->texto->GetLineAddr(i)
end function



function TO_GetLineIndex(gad as _Gadget ptr,l as TextLine ptr) as integer
  function=0
  if gad->texto then function=gad->texto->GetLineIndex(l)
end function



function TO_GetLongestLine(gad as _Gadget ptr) as integer
  function=0
  if gad->texto then function=gad->texto->GetLongestLine
end function



function TO_LoadText(gad as _Gadget ptr,filename as string,linebreak as string=chr(13,10)) as integer
  function=0
  if gad->texto then
    gad->texto->LoadText(filename,linebreak)
    function=1
  end if
end function



function TO_SetText(gad as _Gadget ptr,s as string,linebreak as string=chr(13,10)) as integer
  function=0
  if gad->texto then
    gad->texto->SetText (s,linebreak)
    function=1
  end if
end function



function TO_SaveText (gad as _Gadget ptr,filename as string, linebreak as string=chr(13,10)) as integer
  function=0
  if gad->texto then
    gad->texto->SaveText (filename, linebreak)
    function=1
  end if
end function



function TO_GetText (gad as _Gadget ptr,linebreak as string=chr(13,10)) as string
  function=""
  if gad->texto then function=gad->texto->GetText(linebreak)
end function



function TO_GetLineContent (gad as _Gadget ptr,i as integer) as string
  function=""
  if gad->texto then function=gad->texto->GetLineContent (i)
end function



function TO_GetLineContent (gad as _Gadget ptr,l as TextLine ptr) as string
  function=""
  if gad->texto then function=gad->texto->GetLineContent (l)
end function



function TO_SetLineContent (gad as _Gadget ptr,i as integer,t as string)as integer
  function=0
  if gad->texto then
    gad->texto->SetLineContent(i,t)
    function=1
  end if
end function



function TO_SetLineContent (gad as _Gadget ptr,l as TextLine ptr,t as string)as integer
  function=0
  if gad->texto then
    gad->texto->SetLineContent(l,t)
    function=1
  end if
end function



function TO_AppendLine (gad as _Gadget ptr,t as string) as integer
  function=0
  if gad->texto then
    gad->texto->AppendLine (t)
    function=1
  end if
end function


function TO_ClearText(gad as _Gadget ptr)as integer
  function=0
  if gad->texto then
    gad->texto->ClearText
    function=1
  end if
end function
