API Documentation
Loading...
Searching...
No Matches
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 *-----------------------------------------------------------------------------------------------**/
50 {
51 public:
52 virtual bool processKeyEvent(const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera) = 0;
53 };
54
55 /**--------------------------------------------------------------------------------------------------
56 \brief An action that can be tied to a specific KeyPress within the software.
57 *-----------------------------------------------------------------------------------------------**/
64 /**--------------------------------------------------------------------------------------------------
65 \brief The core class for assigning actions to key-presses and registering them as a program-wide service
66 *-----------------------------------------------------------------------------------------------**/
68 {
69 public:
71 NDEVR_BASE_API bool processKeyEvent(const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera) final override;
72 NDEVR_BASE_API virtual bool processKeyEvent(const String& id, const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera) = 0;
76 NDEVR_BASE_API virtual void setKeyOption(const KeyOption& option);
77 NDEVR_BASE_API virtual void getINI(INIFactory& factory) override;
78 NDEVR_BASE_API virtual void addKeyOption(const KeyOption& option);
79 protected:
83 };
84
85 /**--------------------------------------------------------------------------------------------------
86 \brief A high-level controller that stores many sub controllers that can be used to modify behaviors
87 on user key-presses
88 *-----------------------------------------------------------------------------------------------**/
90 {
91 public:
98 NDEVR_BASE_API bool processKeyEvent(const KeyEvent& event, DesignObjectLookup* lookup, Camera* camera) override;
99 //void addHotKey(KeyEvent key, std::function<bool(const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera)> action);
100 //void addRemoveHotKey(const KeyEvent& key);
102 private:
103 Buffer<KeyControllerBase*> m_controllers;
104 Dictionary<UUID, KeyControllerBase*> m_controller_lookup;
105 };
106};//End namespace NDEVR
#define NDEVR_BASE_API
Definition DLLInfo.h:78
The core class for assigning actions to key-presses and registering them as a program-wide service.
Definition KeyController.h:68
Buffer< KeyOption > m_key_options
Definition KeyController.h:81
NDEVR_BASE_API bool processKeyEvent(const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera) final override
bool m_save_ini_on_change_key_option_change
Definition KeyController.h:80
NDEVR_BASE_API BasicKeyController(const TranslatedString &key_controller_title)
virtual NDEVR_BASE_API void getINI(INIFactory &factory) override
virtual NDEVR_BASE_API bool processKeyEvent(const String &id, const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera)=0
virtual NDEVR_BASE_API void addKeyOption(const KeyOption &option)
virtual NDEVR_BASE_API void resetKeyControllerToDefaults()=0
virtual NDEVR_BASE_API void setKeyOption(const KeyOption &option)
NDEVR_BASE_API const Buffer< KeyOption > & currentKeyMaps() const
Definition KeyController.h:75
NDEVR_BASE_API const TranslatedString & keyControllerTitle() const
Definition KeyController.h:74
TranslatedString m_key_controller_title
Definition KeyController.h:82
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:59
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.
Definition Dictionary.h:59
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:64
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:50
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.
Definition KeyController.h:90
NDEVR_BASE_API void removeController(UUID id)
NDEVR_BASE_API bool hasController(UUID id) const
NDEVR_BASE_API void addController(UUID id, KeyControllerBase *controller)
virtual NDEVR_BASE_API ~KeyController()
Definition KeyController.h:93
NDEVR_BASE_API Buffer< KeyControllerBase * > controllers() const
static NDEVR_BASE_API KeyController & DefaultKeyController()
NDEVR_BASE_API KeyController()
NDEVR_BASE_API bool processKeyEvent(const KeyEvent &event, DesignObjectLookup *lookup, Camera *camera) override
A class which describes a user key press.
Definition Event.h:47
Software Services provide an interface for adding to or changing the software behavior.
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 software.
Definition String.h:47
Any text displayed to the user should be defined as a TranslatedString which allows the.
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:62
Definition ACIColor.h:37
An action that can be tied to a specific KeyPress within the software.
Definition KeyController.h:59
TranslatedString display_name
Definition KeyController.h:61
String id
Definition KeyController.h:60
KeyEvent key_event
Definition KeyController.h:62