OpenWalnut  1.5.0dev
WMTemplateUI.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26 // This is a tutorial on how to create custom views and widgets from within your modules.
27 //
28 // You will need the knowledge of these tutorials before you can go on:
29 // * WMTemplate
30 //
31 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
32 
33 #include <memory>
34 #include <string>
35 
36 #include <boost/bind/bind.hpp>
37 
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"
43 
44 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
45 // All the basic setup ...
46 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
47 
49  : WModule()
50 {
51 }
52 
54 {
55 }
56 
57 std::shared_ptr< WModule > WMTemplateUI::factory() const
58 {
59  // NOTE: Refer to WMTemplate.cpp if you do not understand these commands.
60  return std::shared_ptr< WModule >( new WMTemplateUI() );
61 }
62 
63 const std::string WMTemplateUI::getName() const
64 {
65  // NOTE: Refer to WMTemplate.cpp if you do not understand these commands.
66  return "Template UI";
67 }
68 
69 const std::string WMTemplateUI::getDescription() const
70 {
71  // NOTE: Refer to WMTemplate.cpp if you do not understand these commands.
72  return "Show some custom module UI.";
73 }
74 
76 {
77  // NOTE: Refer to WMTemplate.cpp if you do not understand these commands.
78  // We do not need any connectors. Have a look at WMTemplate.cpp if you want to know what this means.
80 }
81 
83 {
84  // NOTE: Refer to WMTemplate.cpp if you do not understand these commands.
85  m_propCondition = std::shared_ptr< WCondition >( new WCondition() );
86 
87  // We create some dummy preferences here to use in our widgets:
88  m_triggerProp = m_properties->addProperty( "Do it now!", "Trigger Button Text.", WPVBaseTypes::PV_TRIGGER_READY );
89  m_boolProp = m_properties->addProperty( "Enable feature", "Description.", true );
90  m_properties->addProperty( "Number of shape rows", "Number of shape rows.", 10 );
91  m_properties->addProperty( "CLONE!Number of shape rows",
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" ) );
95  m_properties->addProperty( "A filename", "Description.", WPathHelper::getAppPath() );
96  m_properties->addProperty( "A color", "Description.", WColor( 1.0, 0.0, 0.0, 1.0 ) );
97  m_properties->addProperty( "Somewhere", "Description.", WPosition( 0.0, 0.0, 0.0 ) );
98 
100 }
101 
102 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
103 // ATTENTION: now it gets interesting ...
104 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
105 
107 {
108  // We need graphics to draw anything:
109  m_requirements.push_back( new WGERequirement() );
110  // This method is already known from the WMTemplate example. But there is one difference:
111  m_requirements.push_back( new WUIRequirement() );
112  // This tells OpenWalnut, that you need the WUI features. One might assume that this is self-evident but it is not.
113  // What if you use a python based interface to OpenWalnut? If you embed the OpenWalnut library in another tool
114  // without GUI? The requirement ensures that your module can only be used with a working GUI.
115 }
116 
118 {
119  m_moduleState.setResetable( true, true );
121 
122  // Now lets create some widgets. In OpenWalnut, all widgets need to be created using a factory. We can get a factory instance from the
123  // currently running GUI.
125  // The factory works thread-safe. This means, you can ask for widgets from everywhere and any time. Once the create*** function returns, the
126  // widget is visible to the user. In other words, the factory blocks until creation was completed.
127 
128  // Lets create the top-level widget first. The first created widget cannot be nested into other widgets. In the Qt4 gui we deliver along
129  // the OpenWalnut core library, the top-level widget will be a dock window.
130  WUIGridWidget::SPtr widgetGrid = factory->createGridWidget(
131  getName() // All widgets require a title. No need for unique names.
132  );
133  // Thats it. Now we have a widget which itself is empty. It provides simple grid functionality and allows nesting other widgets.
134 
135  // One important thing to remember about titles. Titles are not required to be unique. But ...
136  // 1) You should always add your module name to the title of top-level widgets (getName()). This ensures that the user can distinguish
137  // between different views.
138  // 2) You should ensure unique names inside your own set of modules, at least at the top-level. This might be important to the GUI
139  // to differentiate your widgets and restore their previous state properly.
140 
141  // Lets create a second top-level widget. This time, it is a WUIViewWidget. This basically is an OpenGL render area to be filled by OSG.
142  // Creating view widgets is a bit more complex as the view needs some parameters:
143  WUIViewWidget::SPtr widgetView = factory->createViewWidget(
144  getName() + " - Standalone View", // All widgets require a title. Module-wide uniqueness recommended but not needed.
145  WGECamera::TWO_D, // Specify an initial camera mode.
146  m_shutdownFlag.getValueChangeCondition() // define a condition that, when notified, aborts creation of the view
147  );
148  // Again, the same scheme as above. But there is something interesting here:
149  // * You can specify a condition to abort widget creation.The issue is that creating views might take some time. But if your module is
150  // requested to shut down during this time, the user would need to wait. When specifying your m_shutdownFlag condition, you can ensure
151  // automatic abortion of widget creation.
152 
153  // Let us summarize: we have two top-level widgets. This means, two separate windows, docks whatever (depending on GUI implementation). The
154  // creation is always done using a factory we get from the GUI.
155 
156  // Lets go on and fill the grid. Here is the plan:
157  // We divide the grid in a left and right part.
158  // * The left part will contain two tabbed OSG view widgets.
159  // * The right part contains two vertically placed OSG view widgets and a widget showing our module properties.
160 
161  // Start on the left side. Create a WUITabbedWidget. This widget itself is empty. Similar to WUIGridWidget. It is only useful in conjunction
162  // with other widgets embedded into the tabs. But first things first -> create the widget:
163  WUITabbedWidget::SPtr widgetGridLeftTabs = factory->createTabbedWidget(
164  "Left Side Tabs", // A title as it is required.
165  widgetGrid // specify the parent widget which will contain this WUITabbedWidget.
166  );
167  // This is our first non-top-level widget. This means we want to embed it into another widget. To achieve this, we HAVE TO specify the widget
168  // which will contain this one: called the parent widget. The WUI interface forces us to specify a parent if a widget will be embedded. If
169  // you not specify a parent, you get a top-level widget. Re-parenting (moving a widget to another parent widget) is not possible.
170 
171  // Now we can create the tabbed view widgets. We do this after the WUITabbedWidget creation because? ... we need a parent for the views!
172  WUIViewWidget::SPtr widgetGridLeftTabbedView1 = factory->createViewWidget(
173  getName() + " - Left Tabbed 1",
174  WGECamera::TWO_D,
176  widgetGridLeftTabs // we want to embed the view into the tabbed widget -> so specify it as parent
177  );
178  WUIViewWidget::SPtr widgetGridLeftTabbedView2 = factory->createViewWidget(
179  getName() + " - Left Tabbed 2",
180  WGECamera::TWO_D,
182  widgetGridLeftTabs // we want to embed the view into the tabbed widget -> so specify it as parent
183  );
184 
185  // At this point, we have two views as children of widgetGridLeftTabs. We need to specify which tabs both views will be in:
186  int widgetGridLeftTabbedView1Index = widgetGridLeftTabs->addTab(
187  widgetGridLeftTabbedView1, // The widget to place. This throws an exception if widgetGridLeftTabs is not the parent of
188  // widgetGridLeftTabbedView1!
189  "View Widget 1" // The tab label
190  );
191  int widgetGridLeftTabbedView2Index = widgetGridLeftTabs->addTab( widgetGridLeftTabbedView2, "View Widget 2" );
192  debugLog() << "Index 1 = " << widgetGridLeftTabbedView1Index << " -- Index 2 = " << widgetGridLeftTabbedView2Index;
193  // This adds the views to two tabs. The values returned are the indices of the tabs. They might come in handy later, when modifying the tabs.
194  // You could also have added another grid! Again, remember that container widgets (like WUIGridWidget and WUITabbedWidget) can be nested into
195  // each other too. This gives you a max flexibility for placing widgets.
196  // This being said, we forgot to place the WUITabbedWidget into our top-level grid widget:
197  widgetGrid->placeWidget(
198  widgetGridLeftTabs, // The widget to place. This throws an exception if widgetGrid is not the parent of widgetGridLeftTabs!
199  0, // row coordinate in grid; 0 is top
200  0 // column coordinate in grid; 0 is left
201  );
202 
203  // Now we want to fill the right side of the grid. Please remember that we want to align 2 views and a property widget vertically. To achieve
204  // this, we create a nested grid inside the right-grid cell of widgetGrid -> this can be seen as row/column spanning known from several GUI
205  // frameworks like Qt
206  WUIGridWidget::SPtr widgetGridRightGrid = factory->createGridWidget(
207  "Right Side Grid",
208  widgetGrid // Remember: we need this to be our parent or else we are not able to add this new grid into the top-level grid.
209  );
210  // As done above, we need to place the widgets at the right position:
211  widgetGrid->placeWidget(
212  widgetGridRightGrid, // The widget to place.
213  0, // row coordinate in grid; 0 is top
214  1 // column coordinate in grid; 0 is left
215  );
216 
217  // we now populate the grid with additional views:
218  WUIViewWidget::SPtr widgetGridRightVerticalView1 = factory->createViewWidget(
219  getName() + " - Right Vertical View 1",
220  WGECamera::TWO_D,
222  widgetGridRightGrid // NEVER forget the parent if you want to nest the widgets!
223  );
224  WUIViewWidget::SPtr widgetGridRightVerticalView2 = factory->createViewWidget(
225  getName() + " - Right Vertical View 2",
226  WGECamera::TWO_D,
228  widgetGridRightGrid // And once again: NEVER forget the parent if you want to nest the widgets!
229  );
230 
231  // As done above, we need to place the widgets at the right position:
232  widgetGridRightGrid->placeWidget(
233  widgetGridRightVerticalView1, // The widget to place.
234  0, // row coordinate in grid; 0 is top
235  0 // column coordinate in grid; 0 is left
236  );
237  widgetGridRightGrid->placeWidget(
238  widgetGridRightVerticalView2, // The widget to place.
239  1, // row coordinate in grid; 0 is top
240  0 // column coordinate in grid; 0 is left
241  );
242 
243  // Finally, we add a new property widget. These widgets show the given property group. This can be very handy to provide some additional
244  // controls to your view. In our case, we are lazy and add our own m_properties group (the module properties). Same creation procedure:
245  WUIPropertyGroupWidget::SPtr widgetRightProps = factory->createPropertyGroupWidget(
246  "Control Properties", // Name. As this is not a top-level widget, we can leave getName() out.
247  m_properties, // The properties to show.
248  widgetGridRightGrid // The parent for this widget. We want to add it to the right, vertical grid.
249  );
250 
251  // ... and place the widget:
252  widgetGridRightGrid->placeWidget(
253  widgetRightProps, // The widget to place.
254  3, // row coordinate in grid; 0 is top
255  0 // column coordinate in grid; 0 is left
256  );
257 
258  // We are done. The created several widgets and nested them into others. And it is awesomely easy, isn't it? The scheme is always the same.
259  // First, create the widgets. Second, place them inside the parent.
260 
261  // We can now modify our widgets. The WUI***Widget interface is thread-safe and you can modify your widgets without having to take care about
262  // threads and stuff. Please read the documentation inside the WUI*****Widget classes to find out which further widget modifications and
263  // tools are available.
264  // Here is an example: we want the right side to be smaller than the left side. We can define stretch factors for this. This idea was taken
265  // from Qt initially.
266  widgetGrid->setColumnStretch(
267  0, // the first column (the left one)
268  2 // set a stretch factor. What does it mean? Please go on reading.
269  );
270  widgetGrid->setColumnStretch( 1, 1 ); // the same for the second column
271  // Now we can describe the meaning of the stretch factor. The factor you define is the fraction of space relative to the sum of all stretch
272  // factors.
273 
274  // Let us summarize: we now have created several widgets. By creating and nesting them. But now one question arises: how to interact with the
275  // widgets?
276  // * WUIPropertyGroupWidget: via its properties of course
277  // * WUIViewWidget: via WUIViewEventHandler and OSG!
278 
279  // Here is a very simple view event handler for one of the view widgets. Event handlers are used to be notified about certain events in your
280  // view widget, like clicks, mouse movement or the resize event. For a complete list, please refer to the doc in core/ui/WUIViewEventHandler.h.
281  //
282  // Create the event handler:
283  osg::ref_ptr< WUIViewEventHandler > eh = new WUIViewEventHandler( widgetView );
284 
285  // To get notified about events, there are two possible solutions:
286  // 1) derive from WUIViewEventHandler (not shown here)
287  // 2) subscribe to each event:
288  eh->subscribeMove( boost::bind( &WMTemplateUI::handleMouseMove, this, boost::placeholders::_1 ) );
289  eh->subscribeDrag( boost::bind( &WMTemplateUI::handleMouseDrag, this, boost::placeholders::_1, boost::placeholders::_2 ) );
290  eh->subscribeRelease( boost::bind( &WMTemplateUI::handleButtonRelease, this, boost::placeholders::_1, boost::placeholders::_2 ) );
291  eh->subscribeResize( boost::bind( &WMTemplateUI::handleResize ,
292  this,
293  boost::placeholders::_1,
294  boost::placeholders::_2,
295  boost::placeholders::_3,
296  boost::placeholders::_4 ) );
297  // This binds our member functions handleMouseMove, handleResize, and others to the event handler. You should consider reading the
298  // boost::bind documentation in case you do not completely understand the above lines.
299  // Finally, we add the event handler:
300  widgetView->addEventHandler( eh );
301  // If you now move your mouse around in the view, you will get a lots of debug output.
302 
303  // You can now fill your view with OSG nodes. This is done as shown in WMTemplate. Each WUIViewWidget can deliver its WGEViewer.
304  // The viewer than allows you to add nodes to the scene, modify camera and similar
305  // widgetView->getViewer()->getScene()->insert( myNode );
306  // We want cool backgrounds and stuff for our first view widget. Please note that these settings are defaults only. The user might have
307  // overwritten them.
308  widgetView->getViewer()->setEffectsActiveDefault();
309 
310  // Ok. Now we have a whole bunch of modules, made an event handler and set some default effects. Is there more? Yes! In the next few code
311  // lines you will learn how to customize and add "actions" to your widget.
312 
313  // Let us begin with the viewer settings. If you use our Qt GUI, the you will notice the little cog next to the close button of view widgets.
314  // These settings are visible by default. But sometimes you might want to hide them:
315  widgetGridRightVerticalView1->getViewer()->getProperties()->setHidden();
316  widgetGridRightVerticalView2->getViewer()->getProperties()->setHidden();
317  widgetGridLeftTabbedView1->getViewer()->getProperties()->setHidden();
318  widgetGridLeftTabbedView2->getViewer()->getProperties()->setHidden();
319 
320  // We now disabled the viewer settings of some of the views. But we want to add our own settings now. Simply construct some properties
321  // and add them to a top-level widget:
322  widgetGrid->addAction( m_triggerProp, WGEImage::createFromFile(
323  m_localPath / getMetaInformation()->query< std::string >( "common/settingsIcon" ) ) // loads an icon we
324  // specified in our META file.
325  // NOTE: WGEImage::loadFromFile is
326  // very fault tolerant. It simply
327  // returns a NULL image.
328  );
329  // You can also use WPropBool:
330  widgetGrid->addAction( m_boolProp, WGEImage::createFromFile(
331  m_localPath / "iconWurst.png" ) // or use a hardcoded file path
332  );
333  // The difference between bool and trigger can be seen in WMTemplate (a trigger must be reset by the module).
334  // And even groups are possible:
335  widgetGrid->addAction( m_properties ); // NOTE: the icon is optional but should be used for user convenience!
336  // Now you might ask on how to react on these actions? For this, please refer to WMTemplate, showing this in detail.
337 
338  // Similar to adding actions to widgets, it is possible to define custom camera presets for a WUIViewWidget. This is especially useful when
339  // you define own camera manipulators or view setups. By default, the user gets the usual 6 camera presets (up, down, left, right, front,
340  // back).
341  // You are not required to remove the existing presets. If you do not remove them, our custom presets get appended to the presets list.
342  // ... but ... we do not need the predefines ones. Remove them:
343  widgetView->clearCameraPresets();
344  // Now let us add a preset. You might assume that we have to define a matrix or quaternion here. But this is not the case. In OSG, you
345  // usually control the camera via an CameraManipulator. Depending on the manipulator you use and the camera you have set up, you might want
346  // to implement more complex presets than simply setting a matrix. To achieve this easily in OpenWalnut, we use WPropTrigger for setting
347  // presets. Define a trigger and set it as preset. When the user triggers your property, you can use the notifier (callback mechanism of our
348  // WProp*) to directly apply your changes:
349  WPropTrigger preset(
350  new WPropTrigger::element_type(
351  "A preset",
352  "A new preset for this view.", // name and description
353  WPVBaseTypes::PV_TRIGGER_READY, // default: ready
354  boost::bind( &WMTemplateUI::cameraPresetCallback, this ) // bind a callback
355  )
356  );
357  // Finally, add the property:
358  widgetView->addCameraPreset( preset,
360  m_localPath / getMetaInformation()->query< std::string >( "common/cameraPresetIcon" ) // Icon. You can leave
361  // this out for a default icon.
362  )
363  );
364  // Done :-). Head over to cameraPresetCallback ...
365 
366  // Finally, mark the module as ready.
367  //
368  // ... But wait. Something to keep in mind here. If you remember from WMTemplate, the project file loader in OpenWalnut FIRST initializes the
369  // modules, waits for their ready() signal, and THEN sets the properties from the project file. This means, setting ready() after widget
370  // creation allows you to utilize the properties mechanism with WUIViewerWidget::getViewer()::getProperties to save the configuration of a
371  // certain view if you like. If you consider to NOT save a view's config, please disable the view configuration action as shown above. The
372  // user should never be able to configure the view if he looses his settings all the time.
373  //
374  // Here is an example how:
375  // 1) Create a group for all the properties we'd like to save
376  WPropGroup viewProps = m_properties->addPropertyGroup( "Hidden View Properties", "View properties." );
377  viewProps->setHidden(); // we do not want to show these to the user in our module control panel.
378  // 2) add all the viewer props to the hidden group. This way, they get saved in the project file without cluttering your module's properties.
379  viewProps->addProperty( widgetView->getViewer()->getProperties() );
380 
381  // Now, we can mark the module ready.
382  ready();
383 
384  // Now the remaining module code. In our case, this is empty.
385  while( !m_shutdownFlag() )
386  {
388  if( m_shutdownFlag() )
389  {
390  break;
391  }
392  }
393 
394  // Never miss to clean up. If you miss this step, the shared_ptr might get deleted -> GUI crash
395  debugLog() << "Shutting down ...";
396  widgetGrid->close();
397  widgetView->close();
398 }
399 
400 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
401 // Event Handler
402 // These functions demonstrate how to interact with WUIViewWidgets. Have a look at core/ui/WUIViewEventHandler.h for a list of the possible
403 // handler functions
404 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
405 
407 {
408  // This function just prints the mouse position.
409  debugLog() << "MOUSE MOVED: " << pos;
410 }
411 
413 {
414  // This function just prints the mouse position.
415  debugLog() << "MOUSE DRAG-MOVED: " << pos << " -- Button = " << button;
416 }
417 
418 void WMTemplateUI::handleResize( int /* x */, int /* y */, int width, int height )
419 {
420  // This function just prints the current view size.
421  debugLog() << "RESIZE: " << width << ", " << height;
422 }
423 
424 void WMTemplateUI::handleButtonRelease( WVector2f coords , int button )
425 {
426  debugLog() << "BUTTON RELEASE: " << coords << " -- Button = " << button;
427 }
428 
430 {
431  debugLog() << "Camera preset 1 requested.";
432 
433  // This is the camera preset callback. This is called by our custom camera preset (a WPropTrigger). You can now modify your WUIViewWidget
434  // camera, camera manipulator and stuff like this. But be warned: this callback usually runs in the UI thread. The graphics engine might not!
435  // To circumvent this issue, you should always use OSG's callback mechanism! Always!
436  //
437  // There are two possibilities to inform your osg::NodeCallback:
438  //
439  // 1) You might set a flag here to inform the camera's update callback that the user requested this preset:
440  // m_updateCamToPreset1 = true;
441  //
442  // 2) As you might remember from WMTemplate, you can read the state of a WPropTrigger. The user clicks it, and its value
443  // (m_myPresetTrigger->get()) will change to PV_TRIGGER_TRIGGERED. You can query this in your osg::Camera UpdateCallback, update the
444  // camera and then reset the trigger m_myPresetTrigger->set( WPVBaseTypes::PV_TRIGGER_READY );
445  // This version won't require you to write this callback (WMTemplateUI::cameraPresetCallback) at all.
446  //
447  // Although version two seems more comfortable as you can avoid writing this property callback, it is actually not recommended by us for a
448  // simple reason: re-usability. This method can be used from everywhere within your code and is uncoupled from any property and similar.
449 }
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.
Definition: WCondition.h:42
std::shared_ptr< WCondition > getValueChangeCondition()
Returns the condition denoting a value change.
Definition: WFlag.h:325
static WGEImage::SPtr createFromFile(boost::filesystem::path file)
Load an image from a file.
Definition: WGEImage.cpp:80
This requirement ensures an up and running WGE.
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
Definition: WKernel.cpp:117
std::shared_ptr< WUI > getUI() const
Getter for the associated UI.
Definition: WKernel.cpp:132
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.
Definition: WMTemplateUI.h:157
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.
Definition: WMTemplateUI.h:152
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.
Definition: WMTemplateUI.h:147
A fixed size matrix class.
Definition: WMatrixFixed.h:150
Class representing a single module of OpenWalnut.
Definition: WModule.h:72
boost::filesystem::path m_localPath
The path where the module binary resides in.
Definition: WModule.h:734
Requirements m_requirements
The list of requirements.
Definition: WModule.h:754
virtual void properties()
Initialize properties in this function.
Definition: WModule.cpp:212
wlog::WStreamedLogger debugLog() const
Logger instance for comfortable debug logging.
Definition: WModule.cpp:575
virtual WModuleMetaInformation::ConstSPtr getMetaInformation() const
The meta information of this module.
Definition: WModule.cpp:229
std::shared_ptr< WProperties > m_properties
The property object for the module.
Definition: WModule.h:640
void ready()
Call this whenever your module is ready and can react on property changes.
Definition: WModule.cpp:505
WConditionSet m_moduleState
The internal state of the module.
Definition: WModule.h:703
virtual void connectors()
Initialize connectors in this function.
Definition: WModule.cpp:208
static boost::filesystem::path getAppPath()
The path where the binary file resides in.
Definition: WPathHelper.cpp:93
This only is a 3d double vector.
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
std::shared_ptr< WUIGridWidget > SPtr
Convenience typedef for a std::shared_ptr< WUIGridWidget >.
Definition: WUIGridWidget.h:46
std::shared_ptr< WUIPropertyGroupWidget > SPtr
Convenience typedef for a std::shared_ptr< WUIPropertyGroupWidget >.
This requirement ensures an up and running UI which properly implements the WUI interface.
std::shared_ptr< WUITabbedWidget > SPtr
Convenience typedef for a std::shared_ptr< WUITabbedWidget >.
An event handler for a custom widget which eases interaction with GUIEvents within your module.
std::shared_ptr< WUIViewWidget > SPtr
Abbreviation for a shared pointer on a instance of this class.
Definition: WUIViewWidget.h:72
std::shared_ptr< WUIWidgetFactory > SPtr
Convenience typedef for a std::shared_ptr< WUIWidgetFactory >.
@ PV_TRIGGER_READY
Trigger property: is ready to be triggered (again)