36 #include <boost/bind/bind.hpp>
38 #include "WMTemplateUI.h"
39 #include "core/common/WPathHelper.h"
40 #include "core/graphicsEngine/WGERequirement.h"
41 #include "core/kernel/WKernel.h"
42 #include "core/ui/WUI.h"
72 return "Show some custom module UI.";
90 m_properties->addProperty(
"Number of shape rows",
"Number of shape rows.", 10 );
92 "A property which gets modified if \"Number of shape rows\" gets modified.", 10 );
93 m_properties->addProperty(
"Shape radii",
"Shape radii.", 20.0 );
94 m_properties->addProperty(
"A string",
"Something.", std::string(
"hello" ) );
96 m_properties->addProperty(
"A color",
"Description.", WColor( 1.0, 0.0, 0.0, 1.0 ) );
144 getName() +
" - Standalone View",
173 getName() +
" - Left Tabbed 1",
179 getName() +
" - Left Tabbed 2",
186 int widgetGridLeftTabbedView1Index = widgetGridLeftTabs->addTab(
187 widgetGridLeftTabbedView1,
191 int widgetGridLeftTabbedView2Index = widgetGridLeftTabs->addTab( widgetGridLeftTabbedView2,
"View Widget 2" );
192 debugLog() <<
"Index 1 = " << widgetGridLeftTabbedView1Index <<
" -- Index 2 = " << widgetGridLeftTabbedView2Index;
197 widgetGrid->placeWidget(
211 widgetGrid->placeWidget(
219 getName() +
" - Right Vertical View 1",
225 getName() +
" - Right Vertical View 2",
232 widgetGridRightGrid->placeWidget(
233 widgetGridRightVerticalView1,
237 widgetGridRightGrid->placeWidget(
238 widgetGridRightVerticalView2,
246 "Control Properties",
252 widgetGridRightGrid->placeWidget(
266 widgetGrid->setColumnStretch(
270 widgetGrid->setColumnStretch( 1, 1 );
293 boost::placeholders::_1,
294 boost::placeholders::_2,
295 boost::placeholders::_3,
296 boost::placeholders::_4 ) );
300 widgetView->addEventHandler( eh );
308 widgetView->getViewer()->setEffectsActiveDefault();
315 widgetGridRightVerticalView1->getViewer()->getProperties()->setHidden();
316 widgetGridRightVerticalView2->getViewer()->getProperties()->setHidden();
317 widgetGridLeftTabbedView1->getViewer()->getProperties()->setHidden();
318 widgetGridLeftTabbedView2->getViewer()->getProperties()->setHidden();
343 widgetView->clearCameraPresets();
350 new WPropTrigger::element_type(
352 "A new preset for this view.",
358 widgetView->addCameraPreset( preset,
376 WPropGroup viewProps =
m_properties->addPropertyGroup(
"Hidden View Properties",
"View properties." );
377 viewProps->setHidden();
379 viewProps->addProperty( widgetView->getViewer()->getProperties() );
409 debugLog() <<
"MOUSE MOVED: " << pos;
415 debugLog() <<
"MOUSE DRAG-MOVED: " << pos <<
" -- Button = " << button;
421 debugLog() <<
"RESIZE: " << width <<
", " << height;
426 debugLog() <<
"BUTTON RELEASE: " << coords <<
" -- Button = " << button;
431 debugLog() <<
"Camera preset 1 requested.";
virtual void wait() const
Wait for the condition.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
Class to encapsulate boost::condition_variable_any.
std::shared_ptr< WCondition > getValueChangeCondition()
Returns the condition denoting a value change.
static WGEImage::SPtr createFromFile(boost::filesystem::path file)
Load an image from a file.
This requirement ensures an up and running WGE.
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
std::shared_ptr< WUI > getUI() const
Getter for the associated UI.
void handleButtonRelease(WVector2f coords, int button)
Handle mouse clicks.
void cameraPresetCallback()
Handle camera presets.
virtual void connectors()
Initialize the connectors this module is using.
void handleMouseDrag(WVector2f pos, int button)
Called on every mouse drag-move event from the custom widget.
WPropTrigger m_triggerProp
A trigger property used in this example.
WMTemplateUI()
Constuctor.
virtual const std::string getDescription() const
Gives back a description of this module.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
virtual void moduleMain()
Entry point after loading the module.
virtual ~WMTemplateUI()
Destructor.
WPropBool m_boolProp
A boolean property used in this example.
void handleResize(int x, int y, int width, int height)
Called on every resize event from the custom widget.
virtual void properties()
Initialize the properties for this module.
virtual void requirements()
Initialize requirements for this module.
virtual const std::string getName() const
Gives back the name of this module.
void handleMouseMove(WVector2f pos)
Called on every mouse move event from the custom widget.
std::shared_ptr< WCondition > m_propCondition
A condition for property updates.
A fixed size matrix class.
Class representing a single module of OpenWalnut.
boost::filesystem::path m_localPath
The path where the module binary resides in.
Requirements m_requirements
The list of requirements.
virtual void properties()
Initialize properties in this function.
wlog::WStreamedLogger debugLog() const
Logger instance for comfortable debug logging.
virtual WModuleMetaInformation::ConstSPtr getMetaInformation() const
The meta information of this module.
std::shared_ptr< WProperties > m_properties
The property object for the module.
void ready()
Call this whenever your module is ready and can react on property changes.
WConditionSet m_moduleState
The internal state of the module.
virtual void connectors()
Initialize connectors in this function.
static boost::filesystem::path getAppPath()
The path where the binary file resides in.
This only is a 3d double vector.
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
This requirement ensures an up and running UI which properly implements the WUI interface.
An event handler for a custom widget which eases interaction with GUIEvents within your module.
@ PV_TRIGGER_READY
Trigger property: is ready to be triggered (again)