/* Copyright (C) 1996,1997 Robert H”hne, see COPYING.RH for details */
/* This file is part of RHIDE. */
#define Uses_TEvent
#define Uses_TKeys
#define Uses_TGroup

#define Uses_TEnterListBox
#define Uses_tvutilCommands
#include <libtvuti.h>

void TEnterListBox::focusItem(ccIndex item)
{
  TListBox::focusItem(item);
  message(owner,evBroadcast,cmListItemFocused,this);
}

void TEnterListBox::handleEvent(TEvent &event)
{
  TListBox::handleEvent(event);
  if (!(state & sfSelected)) return;
  switch (event.what)
  {
    case evKeyDown:
      switch (event.keyDown.keyCode)
      {
        case kbEnter:
          if (range > 0) selectItem(focused);
          clearEvent(event);
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }
}
