home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 Mobile
/
Chip_Mobile_2001.iso
/
palm
/
business
/
printcar
/
printcar.exe
/
src
/
PrintStatusForm.cc
< prev
next >
Wrap
C/C++ Source or Header
|
2000-06-06
|
2KB
|
97 lines
//
// $Id: PrintStatusForm.cc,v 1.1 2000/06/06 09:30:50 sergey Exp $
//
#include <Pilot.h>
#include "PrintStatusForm.h"
#include "Util/Assert.h"
#include "PrintCardRes.h"
PrintStatusForm::PrintStatusForm(Word formID):
UI::Form(formID),
_packetCount(0)
{}
// operations
void PrintStatusForm::create()
{
UI::Form::create();
// static "thunk" for the form' event handler
static UI::FormEventHandler<PrintStatusForm> eventHandler;
eventHandler.init(this);
display();
}
// IR callback implementation
void PrintStatusForm::connected()
{
setConnectedStatus();
}
void PrintStatusForm::disconnected()
{
setDisconnectedStatus();
}
void PrintStatusForm::dataSendReady()
{
setPrintingStatus();
}
void PrintStatusForm::dataReceived(const Byte*, int)
{}
void PrintStatusForm::statusChanged(Status status)
{
if (status == NoProgressStatus)
setNoProgressStatus();
else if (status == LineOkStatus)
setConnectedStatus();
}
// implementation
void PrintStatusForm::setConnectedStatus()
{
_packetCount = 0;
updateStatusLabel("Connected");
}
void PrintStatusForm::setDisconnectedStatus()
{
_packetCount = 0;
updateStatusLabel("Disconnected");
}
void PrintStatusForm::setNoProgressStatus()
{
_packetCount = 0;
updateStatusLabel("No progress");
}
void PrintStatusForm::setPrintingStatus()
{
if (_packetCount++ == 0)
updateStatusLabel("Printing...");
if (_packetCount%2 == 0)
showObject(ID_PRINT_INDICATOR_BITMAP);
else
hideObject(ID_PRINT_INDICATOR_BITMAP);
}
void PrintStatusForm::updateStatusLabel(const char* text)
{
assert(text != 0);
hideObject(ID_PRINT_STATUS_LABEL);
FrmCopyLabel(formPtr(), ID_PRINT_STATUS_LABEL, (Char*)text);
showObject(ID_PRINT_STATUS_LABEL);
}