home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
VISBUILD
/
RAPSHEET
/
SUSCNRMH.CPP
< prev
next >
Wrap
Text File
|
1995-05-12
|
5KB
|
132 lines
//****************************************************************************
// Additional Member Functions for ISuspectCnrView - (suscnrmh.cpp) *
// *
// COPYRIGHT: Copyright (C) International Business Machines Corp., 1994,1995 *
// *
// DISCLAIMER OF WARRANTIES: *
// The following [enclosed] code is sample code created by IBM *
// Corporation. This sample code is not part of any standard IBM product *
// and is provided to you solely for the purpose of assisting you in the *
// development of your applications. The code is provided "AS IS", *
// without warranty of any kind. IBM shall not be liable for any damages *
// arising out of your use of the sample code, even if they have been *
// advised of the possibility of such damages. *
//****************************************************************************
//NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
//
#ifndef _ITRACE_
#include <itrace.hpp>
#endif
#include <istring.hpp>
#ifndef _IVSEQ_
#include <ivseq.h>
#endif
#ifndef _IPOPMENU_
#include <ipopmenu.hpp>
#endif
#ifndef _ISUSPECTCNRVIEW_
#include <sspctcnr.hpp>
#endif
#ifndef _ISUSPECT_
#include <isuspect.hpp>
#endif
#include "suscnrmh.hpp" //ISuspectCnrMenuHandler
//***************************************************************************
// Class: ISuspectCnrMenuHandler
//
// Purpose: Provides popup menu support for the suspect container view,
// ISuspectCnrView, which supports extended selection.
//
//***************************************************************************
//*******************************************************************
// Manager Member Functions (Not Part Actions)
//*******************************************************************
ISuspectCnrMenuHandler :: ISuspectCnrMenuHandler(
IVBContainerControl< ISuspect *,
IVSequence<ISuspect *>,
ISuspectCnrViewSuspectCnrCnrObj > * aVBCnr,
IPopUpMenu * aSuspectCnrMenu,
IVSequence<ISuspect *> *aSuspectCollection) : ICnrMenuHandler(),
iCurrentMenu (none)
{
iCnr = aVBCnr;
iPopupMenu = aSuspectCnrMenu;
iTargetCollection = aSuspectCollection;
}
ISuspectCnrMenuHandler :: ~ISuspectCnrMenuHandler()
{
}
Boolean ISuspectCnrMenuHandler::makePopUpMenu(IMenuEvent& menuEvent)
{
IFUNCTRACE_DEVELOP();
ISuspectCnrViewSuspectCnrCnrObj *pPopupObject = (ISuspectCnrViewSuspectCnrCnrObj *)popupMenuObject();
if (pPopupObject) //a popup menu was requested for a container object
{
if (iCurrentMenu != element)
{
iPopupMenu->deleteItem(WND_ISuspectCnrView_NewMenuItem);
iPopupMenu->deleteItem(WND_ISuspectCnrView_FindMenuItem);
if (iCurrentMenu == cnr)
{
iPopupMenu->addText(WND_ISuspectCnrView_OpenMenuItem, VBSTRINGRC(STRRC_ISuspectCnrView_OpenMenuItem_text));
iPopupMenu->addText(WND_ISuspectCnrView_DeleteMenuItem, VBSTRINGRC(STRRC_ISuspectCnrView_DeleteMenuItem_text));
}
iCurrentMenu = element;
} /* endif */
/**************************************************************************
* Determine if the popup menu object was selected. If it isn't, then
* the real element that maps to it is the only target element. If it is,
* prime the collection with the list of selected elements.
**************************************************************************/
try
{
if (iCnr->isSelected(pPopupObject))
{
iCnr->selectedElements(*iTargetCollection);
ITRACE_DEVELOP("Number of elements the popup menu applies to: " +
IString(iTargetCollection->numberOfElements()));
}
else
{
if (!iTargetCollection->isEmpty())
iTargetCollection->removeAll();
iTargetCollection->add(((ISuspectCnrViewSuspectCnrCnrObj *)(pPopupObject))->realObject());
ITRACE_DEVELOP("Number of elements the popup menu applies to: 1");
}
}
catch (IException& exc) {};
}
else //a popup menu was requested for the container itself
{
if (iCurrentMenu != cnr)
{
iPopupMenu->deleteItem(WND_ISuspectCnrView_OpenMenuItem);
iPopupMenu->deleteItem(WND_ISuspectCnrView_DeleteMenuItem);
if (iCurrentMenu == element)
{
iPopupMenu->addText(WND_ISuspectCnrView_NewMenuItem, VBSTRINGRC(STRRC_ISuspectCnrView_NewMenuItem_text));
iPopupMenu->addText(WND_ISuspectCnrView_FindMenuItem, VBSTRINGRC(STRRC_ISuspectCnrView_FindMenuItem_text));
}
iCurrentMenu = cnr;
} /* endif */
}
return false; //call VB handler (to show the menu at the mouse position)
}