# Console window class definition for GDBtk.
# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
#
# 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.  
# ----------------------------------------------------------------------

itcl::class Console {
  inherit EmbeddedWin GDBEventHandler

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

    method constructor {args}
    method destructor {}   
    method insert {line {tag ""}}
    method invoke {{controld 0}}
    method _insertion {args}
    method activate {{prompt {}}}
    method test {args}
    method gets {}

    #
    # GDB Events
    #
    method busy {event}
    method idle {event}
  }

  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
    variable _pendingHistElement -1
    variable _input_mode 0
    variable _input_result ""
    variable _input_error 0

    method _build_win {}
    method _cancel {}
    method _complete {}
    method _delete {{left 0}}
    method _find_completion {cmd completions}
    method _find_lcp {slist}
    method _first {}
    method _last {}
    method _next {}
    method _operate_and_get_next {}
    method _paste {{check_primary 1}}
    method _previous {}
    method _reset_tab {}
    method _search_history {}
    method _rsearch_history {}
    method _setprompt {{prompt {}}}
    method _set_wrap {wrap}
    method _update_option {name value}
  }
}
