VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Set Encumbrance Menu Item

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


Header file:

/*******************************************************************************
** Copyright (c) 2016 VT MAK, Inc.
** All rights reserved.
*******************************************************************************/
//\file DtSetEncumbranceMenuItem.h
#pragma once
//As per the the VR Forces GUI architecture (see the BRFFrontEndDevelopersGuide,
//chapter 3 and especially 3.1), the DtSetEncumbranceMenuItem provides the
//necessary structure for a DtMenuItem as used by the DtMenuItemBuilder.
namespace vrfAddSetEncumbranceExample
{
class DtSetEncumbranceMenuItem : public makVrf::DtVrfTaskSetMenuItem
{
public:
//\brief: CTOR
//DTOR
//Build a menu item (via an action).
virtual QAction* createAction(makVrv::DtDe&, QWidget* parent);
protected:
int myId;
};
}

Implementation:

/*******************************************************************************
** Copyright (c) 2016 VT MAK, Inc.
** All rights reserved.
*******************************************************************************/
//\file DtSetEncumbranceMenuItem.cxx
#include "../addSetEncumbranceSim/setEncumbranceRequest.h"
using namespace makVrf;
namespace vrfAddSetEncumbranceExample
{
DtSetEncumbranceMenuItem::DtSetEncumbranceMenuItem(makVrv::DtDe& 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 DtSetEncumbranceDialogCreator);
//Registers the new id with the task/set manager
DtVrfTaskSetManager::instance(myDe).addAvailableSet(myId, DtSetEncumbranceType);
}
DtSetEncumbranceMenuItem::~DtSetEncumbranceMenuItem()
{
}
{
//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("Encumbrance..."), parent, myId, "SetEncumbrance");
}
}

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)