| 1 | #include "pioptmenumac.h"
 | 
|---|
| 2 | #include "pippoptmenu.h"
 | 
|---|
| 3 | 
 | 
|---|
| 4 | /* --Methode-- */
 | 
|---|
| 5 | PIOptMenuMac::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-- */
 | 
|---|
| 37 | PIOptMenuMac::~PIOptMenuMac()
 | 
|---|
| 38 | {
 | 
|---|
| 39 | }
 | 
|---|
| 40 | 
 | 
|---|
| 41 | /* --Methode-- */
 | 
|---|
| 42 | void PIOptMenuMac::Process(PIMessage msg, PIMsgHandler* sender, void* data)
 | 
|---|
| 43 | {
 | 
|---|
| 44 | Select((char *)data, UserMsg(msg));  //  Reza 17/10/96 $CHECK$ ???
 | 
|---|
| 45 | ReSend(msg, sender, data);
 | 
|---|
| 46 | }
 | 
|---|
| 47 | 
 | 
|---|
| 48 | void
 | 
|---|
| 49 | PIOptMenuMac::ListenToMessage(MessageT /*inMessage*/, void *)
 | 
|---|
| 50 | {
 | 
|---|
| 51 | //  if (inMessage == msg_Click)
 | 
|---|
| 52 |     mPUMenu->ItemSelected(((LStdPopupMenu*)mPane)->GetValue()-1);
 | 
|---|
| 53 | }
 | 
|---|
| 54 | 
 | 
|---|
| 55 | void
 | 
|---|
| 56 | PIOptMenuMac::Select(char *txt, PIMessage msg)
 | 
|---|
| 57 | { // Ca doit faire quoi ????
 | 
|---|
| 58 | mStext = txt;  mSmsg = msg;
 | 
|---|
| 59 | }
 | 
|---|
| 60 | 
 | 
|---|
| 61 | /* --Methode-- */
 | 
|---|
| 62 | void PIOptMenuMac::SetValueStr(string & s)
 | 
|---|
| 63 | {
 | 
|---|
| 64 | int n;
 | 
|---|
| 65 | n=mPUMenu->FindItemByName((char *)s.c_str());
 | 
|---|
| 66 | if (n < 0)  return;  
 | 
|---|
| 67 | 
 | 
|---|
| 68 | ((LStdPopupMenu*)mPane)->SetValue(n+1);
 | 
|---|
| 69 | mStext = s;
 | 
|---|
| 70 | mSmsg  = mPUMenu->GetMenuItemMsg(n);
 | 
|---|
| 71 | 
 | 
|---|
| 72 | return;
 | 
|---|
| 73 | }
 | 
|---|
| 74 | 
 | 
|---|
| 75 | /* --Methode-- */
 | 
|---|
| 76 | void PIOptMenuMac::SetValue(PIMessage msg)
 | 
|---|
| 77 | {
 | 
|---|
| 78 | int n;
 | 
|---|
| 79 | n=mPUMenu->FindItemByMsg(msg);
 | 
|---|
| 80 | if (n < 0)  return;
 | 
|---|
| 81 |   
 | 
|---|
| 82 | StopListening();
 | 
|---|
| 83 | ((LStdPopupMenu*)mPane)->SetValue(n+1);
 | 
|---|
| 84 | StartListening();
 | 
|---|
| 85 | mStext = mPUMenu->GetMenuItemText(n);
 | 
|---|
| 86 | mSmsg  = msg;
 | 
|---|
| 87 | 
 | 
|---|
| 88 | return;
 | 
|---|
| 89 | }
 | 
|---|
| 90 | 
 | 
|---|