summaryrefslogtreecommitdiffstats
path: root/ksirc/puke/pframe.cpp
blob: ed58d5a7705c9fdd8d88296f3657f5f7ff518246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "pframe.h"


PObject *
PFrame::createWidget(CreateArgs &ca)
{
  PFrame *pw = new PFrame(ca.parent);
  TQFrame *tf;
  if(ca.parent != 0 &&
     ca.parent->widget()->isWidgetType() == TRUE)
    tf = new TQFrame((TQWidget *) ca.parent->widget());
  else
    tf = new TQFrame();
  pw->setWidget(tf);
  pw->setWidgetId(ca.pwI);
  pw->setPukeController(ca.pc);  
  return pw;
}


PFrame::PFrame( PObject *parent)
  : PWidget(parent)
{
  //  kdDebug(5008) << "PFrame PFrame called" << endl;
  frame = 0;
}

PFrame::~PFrame()
{
  //  kdDebug(5008) << "PFrame: in destructor" << endl;
  /*
  delete frame; // Delete the frame
  frame=0;      // Set it to 0
  setWidget(frame); // Now set all widget() calls to 0.
  */
}

void PFrame::messageHandler(int fd, PukeMessage *pm)
{
  //  kdDebug(5008) << "PFrame handler called" << endl;
  PukeMessage pmRet;
  switch(pm->iCommand){
  case PUKE_QFRAME_SET_FRAME:
    widget()->setFrameStyle(pm->iArg);
    pmRet.iCommand = PUKE_QFRAME_SET_FRAME_ACK;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = widget()->frameStyle();
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_QFRAME_SET_LINEWIDTH:
    widget()->setLineWidth(pm->iArg);
    pmRet.iCommand = PUKE_QFRAME_SET_LINEWIDTH_ACK;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = widget()->lineWidth();
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;
  default:
    PWidget::messageHandler(fd, pm);
  }
}

void PFrame::setWidget(TQObject *w)
{
  if(w != 0 && w->inherits(TQFRAME_OBJECT_NAME_STRING) == FALSE)
  {
    errorInvalidSet(w);
    return;
  }

  frame = (TQFrame *) w;
  PWidget::setWidget((TQWidget *) w);
}


TQFrame *PFrame::widget()
{
  //  kdDebug(5008) << "PFrame widget called" << endl;
  return frame;
}

#include "pframe.moc"