source: Sophya/trunk/Poubelle/PI/pioptmenumac.cc@ 222

Last change on this file since 222 was 222, checked in by ansari, 26 years ago

Creation module DPC/PI Reza 09/04/99

File size: 2.2 KB
Line 
1#include "pioptmenumac.h"
2#include "pippoptmenu.h"
3
4/* --Methode-- */
5PIOptMenuMac::PIOptMenuMac(PIContainerGen* par, PIPUMenu *pdm,
6 int sx, int sy, int px, int py)
7: PIOptMenuGen(par, pdm, sx, sy, px, py), mPUMenu(pdm)
8{
9 delete mPane;
10 //LStr255 titre(Nom().c_str());
11 LStr255 titre("");
12
13 StTextState textState;
14 ::TextFont(systemFont);
15 ::TextSize(12);
16 ::TextFace(0);
17 int titleWidth = ::StringWidth(titre);
18
19 //mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1);
20 mPane = new PIPPOptMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1);
21 //macMenu = ((LStdPopupMenu*)mPane)->GetMacMenuH();
22
23 // On va changer la resource de menu au passage...
24// InsertMenu(pdm->GetMacMenuHandle(), hierMenu);
25// PopupPrivateDataHandle dataH =
26//// (PopupPrivateDataHandle) (**((LStdPopupMenu*)mPane)->GetMacControl()).contrlData;
27// (**dataH).mHandle = pdm->GetMacMenuHandle();
28// (**dataH).mID = pdm->GetMacMenuID();
29
30 ((PIPPOptMenu*)mPane)->SetMenu(pdm);
31 ((LStdPopupMenu*)mPane)->AddListener(this);
32
33 Manage();
34}
35
36/* --Methode-- */
37PIOptMenuMac::~PIOptMenuMac()
38{
39}
40
41/* --Methode-- */
42void PIOptMenuMac::Process(PIMessage msg, PIMsgHandler* sender, void* data)
43{
44Select((char *)data, UserMsg(msg)); // Reza 17/10/96 $CHECK$ ???
45ReSend(msg, sender, data);
46}
47
48void
49PIOptMenuMac::ListenToMessage(MessageT /*inMessage*/, void *)
50{
51// if (inMessage == msg_Click)
52 mPUMenu->ItemSelected(((LStdPopupMenu*)mPane)->GetValue()-1);
53}
54
55void
56PIOptMenuMac::Select(char *txt, PIMessage msg)
57{ // Ca doit faire quoi ????
58mStext = txt; mSmsg = msg;
59}
60
61/* --Methode-- */
62void PIOptMenuMac::SetValueStr(string & s)
63{
64int n;
65n=mPUMenu->FindItemByName((char *)s.c_str());
66if (n < 0) return;
67
68((LStdPopupMenu*)mPane)->SetValue(n+1);
69mStext = s;
70mSmsg = mPUMenu->GetMenuItemMsg(n);
71
72return;
73}
74
75/* --Methode-- */
76void PIOptMenuMac::SetValue(PIMessage msg)
77{
78int n;
79n=mPUMenu->FindItemByMsg(msg);
80if (n < 0) return;
81
82StopListening();
83((LStdPopupMenu*)mPane)->SetValue(n+1);
84StartListening();
85mStext = mPUMenu->GetMenuItemText(n);
86mSmsg = msg;
87
88return;
89}
90
Note: See TracBrowser for help on using the repository browser.