VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Heading and Speed Logic

The DtSetSpeedAndHeadingMenuItem provides the necessary structure for a DtMenuItem as used by the DtMenuItemBuilder.


Header file:

/******************************************************************************
** 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/vrfTaskSetMenu.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;
   };
}


Implementation:

/******************************************************************************
** 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/vrfTaskSetDialogManager.h>
#include <vrfGuiCore/vrfTaskSetManager.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 (GUI)..."), parent, myId, "SetSpeedAndHeading");
   }
}


Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)