![]() |
VR-Forces 4.1 Class Documentation
|
The DtSetSpeedAndHeadingMenuItem provides the necessary structure for a DtMenuItem as used by the DtMenuItemBuilder.
/******************************************************************************
** Copyright (c) 2008 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
/******************************************************************************
** $RCSfile: DtSetSpeedAndHeadingMenuItem.h,v $ $Revision: 1.2 $ $State: Exp $
******************************************************************************/
//\file DtSetSpeedAndHeadingMenuItem.h
#pragma once
#include <vrfGuiCoreQt/DtVrfTaskSetMenu.h>
//class DtSetSpeedAndHeadingMenuItem:
//Instances of DtSetSpeedAndHeading are an example of a new kind of set that
//tells an entity to set their current speed and heading.
//As per the the VR Forces GUI architecture (see the BRFFrontEndDevelopersGuide,
//chapter 3 and especially 3.1), the DtSetSpeedAndHeadingMenuItem provides the
//necessary structure for a DtMenuItem as used by the DtMenuItemBuilder.
namespace vrfAddSetExample
{
class DtSetSpeedAndHeadingMenuItem : public makVrf::DtVrfTaskSetMenuItem
{
public:
//\brief: CTOR
DtSetSpeedAndHeadingMenuItem(makVrv::DtDe& de);
//DTOR
virtual ~DtSetSpeedAndHeadingMenuItem();
//Build a menu item (via an action).
virtual QAction* createAction(makVrv::DtDe&, QWidget* parent);
protected:
int myId;
};
}
/******************************************************************************
** Copyright (c) 2008 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
/******************************************************************************
** $RCSfile: DtSetSpeedAndHeadingMenuItem.cxx,v $ $Revision: 1.2 $ $State: Exp $
******************************************************************************/
//\file DtSetSpeedAndHeadingMenuItem.cxx
#include "DtSetSpeedAndHeadingMenuItem.h"
#include "DtSetSpeedAndHeadingDialog.h"
#include "../addSetSim/setSpeedAndHeading.h"
#include <vrfGuiCoreQt/DtVrfTaskSetDialogManager.h>
#include <vrfGuiCore/DtVrfTaskSetManager.h>
using namespace makVrf;
namespace vrfAddSetExample
{
DtSetSpeedAndHeadingMenuItem::DtSetSpeedAndHeadingMenuItem(makVrv::DtDe& de)
: DtVrfTaskSetMenuItem(DtSetSpeedAndHeadingMenuItemIdName, de)
{
//Requests a unique int ID to associate with this set item
myId = DtVrfTaskSetDialogManager::instance(de).nextAvailableId();
//Registers the Dialog Creator with the SetDialogManager, using the unique int ID as an associator
DtVrfTaskSetDialogManager::instance(de).addSetDialogCreator(myId, new DtSetSpeedAndHeadingDialogCreator);
//Registers the new id with the task/set manager
DtVrfTaskSetManager::instance(myDe).addAvailableSet(myId, DtSetSpeedAndHeadingType);
}
DtSetSpeedAndHeadingMenuItem::~DtSetSpeedAndHeadingMenuItem()
{
}
QAction* DtSetSpeedAndHeadingMenuItem::createAction( makVrv::DtDe&, QWidget* parent )
{
//registers the text of the menu item and associates it with myId. The final argument is a string corresponding with a
//graphical icon file, which in this case does not exist
return registerMenuItem(makVrv::DtMenuItem::tr("Speed And Heading..."), parent, myId, "SetSpeedAndHeading");
}
}