|
|
|
#include <tqmovie.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <kdebug.h>
|
|
|
|
|
|
|
|
#include "plabel.h"
|
|
|
|
|
|
|
|
PObject *
|
|
|
|
PLabel::createWidget(CreateArgs &ca)
|
|
|
|
{
|
|
|
|
PLabel *pw = new PLabel(ca.parent);
|
|
|
|
TQLabel *le;
|
|
|
|
if(ca.fetchedObj != 0 && ca.fetchedObj->inherits("TQLabel") == TRUE){
|
|
|
|
le = (TQLabel *) ca.fetchedObj;
|
|
|
|
pw->setDeleteAble(FALSE);
|
|
|
|
}
|
|
|
|
else if(ca.parent != 0 && ca.parent->widget()->isWidgetType() == TRUE)
|
|
|
|
le = new TQLabel((TQWidget *) ca.parent->widget());
|
|
|
|
else
|
|
|
|
le = new TQLabel((TQWidget *)0L);
|
|
|
|
pw->setWidget(le);
|
|
|
|
pw->setWidgetId(ca.pwI);
|
|
|
|
return pw;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PLabel::PLabel(PObject *parent)
|
|
|
|
: PFrame(parent)
|
|
|
|
{
|
|
|
|
// kdDebug(5008) << "PLabel PLabel called" << endl;
|
|
|
|
label = 0;
|
|
|
|
setWidget(label);
|
|
|
|
}
|
|
|
|
|
|
|
|
PLabel::~PLabel()
|
|
|
|
{
|
|
|
|
// kdDebug(5008) << "PLabel: in destructor" << endl;
|
|
|
|
/*
|
|
|
|
delete widget(); // Delete the frame
|
|
|
|
label=0; // Set it to 0
|
|
|
|
setWidget(label); // Now set all widget() calls to 0.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
void PLabel::messageHandler(int fd, PukeMessage *pm)
|
|
|
|
{
|
|
|
|
PukeMessage pmRet;
|
|
|
|
switch(pm->iCommand){
|
|
|
|
case PUKE_LABEL_SETTEXT:
|
|
|
|
if(!checkWidget())
|
|
|
|
return;
|
|
|
|
|
|
|
|
widget()->setText(pm->cArg);
|
|
|
|
pmRet.iCommand = - pm->iCommand;
|
|
|
|
pmRet.iWinId = pm->iWinId;
|
|
|
|
pmRet.iArg = 0;
|
|
|
|
pmRet.cArg = 0;
|
|
|
|
emit outputMessage(fd, &pmRet);
|
|
|
|
break;
|
|
|
|
case PUKE_LABEL_SETPIXMAP:
|
|
|
|
if(!checkWidget())
|
|
|
|
return;
|
|
|
|
|
|
|
|
widget()->setPixmap(TQPixmap(pm->cArg));
|
|
|
|
pmRet.iCommand = - pm->iCommand;
|
|
|
|
pmRet.iWinId = pm->iWinId;
|
|
|
|
pmRet.iArg = 0;
|
|
|
|
pmRet.cArg = 0;
|
|
|
|
emit outputMessage(fd, &pmRet);
|
|
|
|
break;
|
|
|
|
case PUKE_LABEL_SETMOVIE:
|
|
|
|
if(!checkWidget())
|
|
|
|
return;
|
|
|
|
|
|
|
|
widget()->setMovie(TQMovie(pm->cArg));
|
|
|
|
pmRet.iCommand = - pm->iCommand;
|
|
|
|
pmRet.iWinId = pm->iWinId;
|
|
|
|
pmRet.iArg = 0;
|
|
|
|
pmRet.cArg = 0;
|
|
|
|
emit outputMessage(fd, &pmRet);
|
|
|
|
break;
|
|
|
|
case PUKE_LABEL_SETALIGNMENT:
|
|
|
|
if(!checkWidget())
|
|
|
|
return;
|
|
|
|
|
|
|
|
widget()->setAlignment(pm->iArg);
|
|
|
|
pmRet.iCommand = - pm->iCommand;
|
|
|
|
pmRet.iWinId = pm->iWinId;
|
|
|
|
pmRet.iArg = 0;
|
|
|
|
pmRet.cArg = 0;
|
|
|
|
emit outputMessage(fd, &pmRet);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
PFrame::messageHandler(fd, pm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PLabel::setWidget(TQObject *_l)
|
|
|
|
{
|
|
|
|
if(_l != 0 && _l->inherits("TQLabel") == FALSE)
|
|
|
|
{
|
|
|
|
errorInvalidSet(_l);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
label = (TQLabel *) _l;
|
|
|
|
PWidget::setWidget(_l);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQLabel *PLabel::widget()
|
|
|
|
{
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PLabel::checkWidget(){
|
|
|
|
if(widget() == 0){
|
|
|
|
kdDebug(5008) << "PLabel: No Widget set" << endl;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "plabel.moc"
|
|
|
|
|