Commit d4268bba authored by lealv's avatar lealv
Browse files

FEATURE 14:

- add SimulationTabs
- export mmlcomponent methods

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1795 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 8176ca18
#include "SimulationTabs.h"
#include <QString>
#include <QMessageBox>
#include <QTextStream>
#include <Application.h>
#include <QFrame>
#include <MonitoringDialog.h>
#include <MonitoringGuiManager.h>
#include <Log.h>
using namespace camitk;
// --------------- Constructor -------------------
SimulationTabs::SimulationTabs(ActionExtension * extension) : Action(extension) {
// Setting name, description and input component
setName("SimulationTabs");
setDescription("Display tabs for simulation");
setComponent("MMLComponent");
// Setting classification family and tags
setFamily("Modeling");
}
QWidget* SimulationTabs::getWidget() {
MMLComponent * input = dynamic_cast<MMLComponent *> (getTargets().last());
QWidget * widget;
if( input )
{
widget = input->getMonitoringGuiManager()->getDialog();
}
else
{
CAMITK_ERROR("SimulationTabs", "getWidget", "NULL widget");
widget = NULL;
}
return widget;
}
// --------------- destructor -------------------
SimulationTabs::~SimulationTabs() {
}
// --------------- apply -------------------
Action::ApplyStatus SimulationTabs::apply() {
return SUCCESS;
}
#ifndef SIMULATIONTABS_H
#define SIMULATIONTABS_H
#include <Action.h>
#include <MMLComponent.h>
class SimulationTabs : public camitk::Action {
public:
/// Default Constructor
SimulationTabs(camitk::ActionExtension *);
/// Default Destructor
virtual ~SimulationTabs();
public slots:
/** this method is automatically called when the action is triggered.
* Call getTargets() method to get the list of components to use.
* \note getTargets() is automatically filtered so that it only contains compatible components,
* i.e., instances of SimulationTabs (or a subclass).
*/
virtual ApplyStatus apply();
virtual QWidget * getWidget();
private:
};
#endif // SIMULATIONTABS_H
#include "SimulationTabsExtension.h"
// include generated actions headers
#include "SimulationTabs.h"
// --------------- declare the extension -------------------
Q_EXPORT_PLUGIN2(simulationtabsextension, SimulationTabsExtension);
// --------------- getActions -------------------
void SimulationTabsExtension::init() {
// Creating and registering the instance of SimulationTabs
registerNewAction(SimulationTabs);
}
#ifndef SIMULATIONTABSEXTENSION_H
#define SIMULATIONTABSEXTENSION_H
#include <ActionExtension.h>
class SimulationTabsExtension : public camitk::ActionExtension {
Q_OBJECT
Q_INTERFACES(camitk::ActionExtension);
public:
/// Constructor
SimulationTabsExtension() : ActionExtension() {};
/// Destructor
virtual ~SimulationTabsExtension() {};
/// Method returning the action extension name
virtual QString getName() {
return "SimulationTabsExtension";
};
/// Method returning the action extension descrption
virtual QString getDescription() {
return "Display";
};
/// initialize all the actions
virtual void init();
};
#endif // SIMULATIONTABSEXTENSION_H
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// ----- MMLComponentAPI.h
#ifndef MMLCOMPONENT_API_H
#define MMLCOMPONENT_API_H
// -----------------------------------------------------------------------
//
// MMLCOMPONENT_API
//
// -----------------------------------------------------------------------
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the COMPILE_CAMITK_API
// flag defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// CAMITK_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#if defined(_WIN32) // MSVC and mingw
#ifdef COMPILE_MMLCOMPONENT_API
#define MMLCOMPONENT_API __declspec(dllexport)
#else
#define MMLCOMPONENT_API __declspec(dllimport)
#endif
#else
// for all other platforms CAMITK_API is defined to be "nothing"
#ifndef MMLCOMPONENT_API
#define MMLCOMPONENT_API
#endif
#endif // MSVC and mingw
// -----------------------------------------------------------------------
// It seems that MSVC does not understand exception specification
// If I understand it well, when _declspec() is used, there is a default
// nothrow attribute.
// I did not find the throw attribute. It seems that msvc is therefore ignoring the
// specification of the type of the exception.
// The compiler therefore issues a warning.
// The following line is to avoid this particular warning.
// The best would be to ask msvc not only to take the exception into account, but also
// its type. Anyway, I did not find how to do that anywhere, and I am not sure this is
// possible...
#if defined(_WIN32) && !defined(__MINGW32__) // MSVC only
#pragma warning( disable : 4290 )
#endif // MSVC only
#endif // MMLCOMPONENT_API_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment