AGX Dynamics  2.35.0.1
KeyEvent.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXIO_KEYEVENT_H
18 #define AGXIO_KEYEVENT_H
19 
20 
21 #include <agxIO/Events.h>
22 #include <agx/Object.h>
23 #include <agx/Task.h>
24 
25 namespace agxIO
26 {
29  {
30  public:
31  static KeyEvent *load(agx::TiXmlElement *eKey, agx::Device *device);
32  virtual void configure(agx::TiXmlElement *eKey) override;
33 
34  public:
37 
38  public:
39  KeyEvent(const agx::String& key, const agx::String& scope = "");
40 
41  void addTrigger(agx::Task *task);
42  void removeTrigger(agx::Task *task);
43 
44  virtual void rebind() override;
45  virtual agx::Object *getResourceImpl(const agx::Path& path, agx::Model *model) override;
46  protected:
47  virtual ~KeyEvent();
48  void keyCallback(int key, agxIO::EventType type);
49 
50  private:
51  agx::String m_scope;
52  InputEvent::CallbackType m_keyCallback;
53  agx::TaskRefVector m_tasks;
54  };
55 
56 }
57 
58 #endif /* _AGXIO_KEYEVENT_H_ */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXCORE_EXPORT
KeyEvent(const agx::String &key, const agx::String &scope="")
void addTrigger(agx::Task *task)
virtual void configure(agx::TiXmlElement *eKey) override
void keyCallback(int key, agxIO::EventType type)
virtual void rebind() override
agxData::Val< bool > downState
Definition: KeyEvent.h:35
void removeTrigger(agx::Task *task)
virtual agx::Object * getResourceImpl(const agx::Path &path, agx::Model *model) override
agxData::Val< bool > toggleState
Definition: KeyEvent.h:36
virtual ~KeyEvent()
static KeyEvent * load(agx::TiXmlElement *eKey, agx::Device *device)
Templated callback with two arguments.
Definition: Callback.h:140
An agx::Device is an abstract representation of a device on which data can be stored and processed.
Definition: Device.h:58
A model is an abstract representation of the class of an agx::Object.
Definition: Model.h:41
agx::Object is a refcounted object with a name.
Definition: Object.h:60
Representation of a path, a list of name components.
Definition: Path.h:34
A representation of a generic task.
Definition: Task.h:58
The agxIO namespace contains classes for reading, writing and finding files.
Definition: Material.h:42
EventType
Definition: Events.h:38