# Console window class definition for GDBtk.
# Copyright 1998, 1999 Cygnus Solutions
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License (GPL) as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.


# ----------------------------------------------------------------------
# Implements a console display widget using primitive widgets as the building
# blocks.  
# ----------------------------------------------------------------------

class Console {
  inherit EmbeddedWin

  public {
    #Approximate maximum number of lines allowed in widget
    variable throttle 2000

    method constructor {args}
    method destructor {}   
    method idle {}
    method busy {}
    method insert {line}
    method einsert {line}
    method invoke {}
    method _insertion {args}
    method get_text {}
    method activate {{prompt {}}}
  }

  private {
    variable _twin
    variable _invoking 0
    variable _needNL 1
    variable _history {}
    variable _histElement -1
    variable _partialCommand ""
    variable _saved_insertion ""
    variable _running 0
    variable _saw_tab 0

    method _build_win {}
    method _complete {}
    method _delete {{left 0}}
    method _find_completion {cmd completions}
    method _find_lcp {slist}
    method _first {}
    method _last {}
    method _next {}
    method _paste {{check_primary 1}}
    method _previous {}
    method _reset_tab {}
    method _search_history {}
    method _rsearch_history {}
    method _setprompt {{prompt {}}}
  }
}
