API Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
KeyController.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: KeyController
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Event.h>
35#include <NDEVR/SoftwareService.h>
36#include <NDEVR/Dictionary.h>
37#include <NDEVR/INIInterface.h>
38#include <NDEVR/TranslatedString.h>
39#include <NDEVR/UUID.h>
40#include <functional>
41namespace NDEVR
42{
43 class DesignObjectLookup;
44 class Camera;
45
46 /**--------------------------------------------------------------------------------------------------
47 \brief Base class for KeyController, a service which provides functionality based on user key-presses
48
49 **/
51 {
52 public:
53 virtual bool processKeyEvent(const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera) = 0;
54 };
55
56 /**--------------------------------------------------------------------------------------------------
57 \brief An action that can be tied to a specific KeyPress within the software.
58
59 **/
66 /**--------------------------------------------------------------------------------------------------
67 \brief The core class for assigning actions to key-presses and registering them as a program-wide service
68
69 **/
71 {
72 public:
74 NDEVR_BASE_API bool processKeyEvent(const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera) final override;
75 NDEVR_BASE_API virtual bool processKeyEvent(const String& id, const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera) = 0;
79 NDEVR_BASE_API virtual void setKeyOption(const KeyOption& option);
80 NDEVR_BASE_API virtual void getINI(INIFactory& factory) override;
81 NDEVR_BASE_API virtual void addKeyOption(const KeyOption& option);
82 protected:
86 };
87
88 /**--------------------------------------------------------------------------------------------------
89 \brief A high-level controller that stores many sub controllers that can be used to modify behaviors
90 on user key-presses
91 **/
93 {
94 public:
101 NDEVR_BASE_API bool processKeyEvent(const KeyEvent& event, DesignObjectLookup* lookup, Camera* camera) override;
102 //void addHotKey(KeyEvent key, std::function<bool(const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera)> action);
103 //void addRemoveHotKey(const KeyEvent& key);
105 private:
106 Buffer<KeyControllerBase*> m_controllers;
107 Dictionary<UUID, KeyControllerBase*> m_controller_lookup;
108 };
109};//End namespace NDEVR
#define NDEVR_BASE_API
Definition DLLInfo.h:57
The core class for assigning actions to key-presses and registering them as a program-wide service.
Definition KeyController.h:71
virtual void getINI(INIFactory &factory) override
Buffer< KeyOption > m_key_options
Definition KeyController.h:84
bool m_save_ini_on_change_key_option_change
Definition KeyController.h:83
virtual void resetKeyControllerToDefaults()=0
virtual void setKeyOption(const KeyOption &option)
const TranslatedString & keyControllerTitle() const
Definition KeyController.h:77
const Buffer< KeyOption > & currentKeyMaps() const
Definition KeyController.h:78
virtual bool processKeyEvent(const String &id, const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera)=0
virtual void addKeyOption(const KeyOption &option)
BasicKeyController(const TranslatedString &key_controller_title)
bool processKeyEvent(const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera) final override
TranslatedString m_key_controller_title
Definition KeyController.h:85
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:68
Contains methods for easily reading and writing to an INI file including.
Definition INIInterface.h:45
Base class for KeyController, a service which provides functionality based on user key-presses.
Definition KeyController.h:51
virtual bool processKeyEvent(const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera)=0
A high-level controller that stores many sub controllers that can be used to modify behaviors on user...
Definition KeyController.h:93
Buffer< KeyControllerBase * > controllers() const
virtual ~KeyController()
Definition KeyController.h:96
void addController(UUID id, KeyControllerBase *controller)
void removeController(UUID id)
static KeyController & DefaultKeyController()
bool hasController(UUID id) const
bool processKeyEvent(const KeyEvent &event, DesignObjectLookup *lookup, Camera *camera) override
A class which describes a user key press.
Definition Event.h:49
Software Services provide an interface for adding to or changing the software behavior via functional...
Definition SoftwareService.h:9
Software Service Managers take a Software service to modify the behavior of the software.
Definition SoftwareService.h:15
The core String class for the NDEVR API.
Definition String.h:69
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
Definition ACIColor.h:37
An action that can be tied to a specific KeyPress within the software.
Definition KeyController.h:61
TranslatedString display_name
Definition KeyController.h:63
String id
Definition KeyController.h:62
KeyEvent key_event
Definition KeyController.h:64