summaryrefslogtreecommitdiffstats
path: root/ksirc/puke/plabel.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /ksirc/puke/plabel.cpp
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/puke/plabel.cpp')
-rw-r--r--ksirc/puke/plabel.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/ksirc/puke/plabel.cpp b/ksirc/puke/plabel.cpp
new file mode 100644
index 00000000..17ca851d
--- /dev/null
+++ b/ksirc/puke/plabel.cpp
@@ -0,0 +1,127 @@
+#include <qmovie.h>
+
+
+#include <kdebug.h>
+
+#include "plabel.h"
+
+PObject *
+PLabel::createWidget(CreateArgs &ca)
+{
+ PLabel *pw = new PLabel(ca.parent);
+ QLabel *le;
+ if(ca.fetchedObj != 0 && ca.fetchedObj->inherits("QLabel") == TRUE){
+ le = (QLabel *) ca.fetchedObj;
+ pw->setDeleteAble(FALSE);
+ }
+ else if(ca.parent != 0 && ca.parent->widget()->isWidgetType() == TRUE)
+ le = new QLabel((QWidget *) ca.parent->widget());
+ else
+ le = new QLabel((QWidget *)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(QPixmap(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(QMovie(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(QObject *_l)
+{
+ if(_l != 0 && _l->inherits("QLabel") == FALSE)
+ {
+ errorInvalidSet(_l);
+ return;
+ }
+
+ label = (QLabel *) _l;
+ PWidget::setWidget(_l);
+
+}
+
+
+QLabel *PLabel::widget()
+{
+ return label;
+}
+
+bool PLabel::checkWidget(){
+ if(widget() == 0){
+ kdDebug(5008) << "PLabel: No Widget set" << endl;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+#include "plabel.moc"
+