home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 Mobile
/
Chip_Mobile_2001.iso
/
palm
/
business
/
printcar
/
printcar.exe
/
src
/
UI
/
List.cc
< prev
next >
Wrap
C/C++ Source or Header
|
2000-06-09
|
1KB
|
67 lines
//
// $Id: List.cc,v 1.3 2000/06/08 21:14:56 sergey Exp $
//
#include <Pilot.h>
#include <KeyMgr.h>
#include "List.h"
#include "Form.h"
namespace UI
{
List::List(Form& parent, Word listID):
ConcreteFormObject<ListPtr, frmListObj>(parent, listID)
{}
List::~List()
{}
// operations
void List::setSelection(int index)
{
LstSetSelection(objectPtr(), index);
LstMakeItemVisible(objectPtr(), index);
}
// attributes
void List::setChoices(const ListChoices& choices)
{
_choices = choices;
LstSetListChoices(objectPtr(), (char**)_choices.textItems(), _choices.count());
}
// event handling
bool List::handleKeyDownEvent(EventType* event)
{
if (event->eType == keyDownEvent)
return processPageKeys();
return false;
}
// implementation
bool List::processPageKeys()
{
DWord state = KeyCurrentState();
if ((state & keyBitPageUp) != 0)
{
LstScrollList(objectPtr(), up, LstGetVisibleItems(objectPtr())-1);
return true;
}
else if ((state & keyBitPageDown) != 0)
{
LstScrollList(objectPtr(), down, LstGetVisibleItems(objectPtr())-1);
return true;
}
return false;
}
}
// namespace UI