# gui/implementation/TextBox.tcl

    @implementation TextBox {
      - init {} {
          $super init
          $self hideBorder
          $frame configure -relief sunken -bd 1
          text $frame.text -wrap none -bd 1 -relief flat
          scrollbar $frame.xscroll -orient horizontal \
            -command "$frame.text xview"
          scrollbar $frame.yscroll -orient vertical \
            -command "$frame.text yview"

          grid rowconfigure $frame 0 -weight 1
          grid columnconfigure $frame 0 -weight 1
          grid $frame.text $frame.yscroll -sticky snew -padx 0 -pady 0
          grid $frame.xscroll -sticky snew -padx 0 -pady 0
          $frame.text configure -xscrollcommand "$frame.xscroll set" \
            -yscrollcommand "$frame.yscroll set"
        }

      - text {} {
          return [$frame.text get 0.0 end]
        }
      - text: aText {
          $self clear
          $self insert: $aText
        }

      - insert: aText {
          $frame.text insert end $aText
        }

      - isEditable {} {
          if {"[$frame.text cget -state]" == "normal"} {
            return 1
          } else {
            return 0
          }
        }
      - enable {} {
          $frame.text configure -state normal
        }
      - disable {} {
          $frame.text configure -state disabled
        }

      - clear {} {
          $frame.text delete 0.0 end
        }

      - loadFromFile: aFile {
          if [catch {set f [open $aFile r]} err] {
            return -code error "$self loadFromFile: $aFile ($err)"
          }
          $self text: [read $f]
          close $f
        }

      - dealloc {} {
          catcr {destroy $frame.text}
          return [$super dealloc]
        }

      - background: aColor {
          $frame.text configure -background $aColor
        }

      - width: aWidth {
          $frame.text configure -width $aWidth
        }

      - height: anHeight {
          $frame.text configure -height $anHeight
        }

      - disable {} {
          $frame.text configure -state disabled
        }
      - enable {} {
          $frame.text configure -state normal
        }
    }