blob: 7ca4ddee40d965bdb3dd828cd5fdb134eb638a77 (
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
|
#include "pmenudta.h"
#include "pobject.h"
#include <tqpopupmenu.h>
PMenuData::PMenuData(PObject *_child)
: PObject()
{
child = _child;
connect(this, TQT_SIGNAL(outputMessage(int, PukeMessage*)),
child, TQT_SIGNAL(outputMessage(int, PukeMessage*)));
}
PMenuData::~PMenuData()
{
// We don't nuke anything since we're kind of abstract and we let the tqparent take care of it
}
void PMenuData::messageHandler(int , PukeMessage *)
{
// We don't do anything since we should never ben involked directly
}
bool PMenuData::menuMessageHandler(int fd, PukeMessage *pm)
{
PukeMessage pmRet;
int id = 0;
switch(pm->iCommand){
case PUKE_MENUDATA_INSERT_TEXT:
{
TQPopupMenu *widget = (TQPopupMenu *) child->widget();
id = widget->insertItem(pm->cArg);
if(pm->iArg > 0){
widget->setAccel(pm->iArg, id);
}
pmRet.iCommand = PUKE_MENUDATA_INSERT_TEXT_ACK;
pmRet.iWinId = pm->iWinId;
pmRet.iArg = id;
pmRet.cArg = 0;
emit outputMessage(fd, &pmRet);
break;
}
case PUKE_MENUDATA_INSERT_PIXMAP:
{
TQPopupMenu *widget = (TQPopupMenu *) child->widget();
id = widget->insertItem(TQPixmap(pm->cArg));
if(pm->iArg > 0){
widget->setAccel(pm->iArg, id);
}
pmRet.iCommand = PUKE_MENUDATA_INSERT_PIXMAP_ACK;
pmRet.iWinId = pm->iWinId;
pmRet.iArg = id;
pmRet.cArg = 0;
emit outputMessage(fd, &pmRet);
break;
}
case PUKE_MENUDATA_REMOVE_ITEM:
{
TQPopupMenu *widget = (TQPopupMenu *) child->widget();
widget->removeItem(pm->iArg);
pmRet.iCommand = PUKE_MENUDATA_REMOVE_ITEM_ACK;
pmRet.iWinId = pm->iWinId;
pmRet.iArg = pm->iArg;
pmRet.cArg = 0;
emit outputMessage(fd, &pmRet);
break;
}
default:
return FALSE;
}
return TRUE;
}
#include "pmenudta.moc"
|