mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-18 20:14:12 -04:00
* EGD-3229 [FIX] UTF8 fixed uint32_t range error * EGD-3229 [util] gui::Item Navigation switch case moved to function Needed to not copy senslessly NavigationDirection enum switch case * gui::Item Navigation switch case moved to function * added NavigationDirection::None enum value * cleaned up Navigation.hpp/cpp * EGD-3229 [util] gui: InputEvent - str() for logging added & is...() check methods * EGD-3229 [util] removed notorious log on unknown glyph * EGD-3229 [util] InputMode - added is(Mode) method, input Profile added default definition * is() method addded to check instead of `==` comparison * added default to Profile instead of `== 0` use * [FIX] ARM GCC 10.1.0 - build fixed fixed include in wrong place * PR style fix * Review applied
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
#include "InputEvent.hpp"
|
|
#include <string>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
#include <map>
|
|
namespace gui
|
|
{
|
|
|
|
class KeyProfile
|
|
{
|
|
public:
|
|
static const uint32_t none_key; /// defaults to 0
|
|
uint32_t keyCode = none_key;
|
|
bool cyclic = false;
|
|
;
|
|
std::vector<uint32_t> chars;
|
|
std::vector<uint32_t> timeouts;
|
|
|
|
KeyProfile();
|
|
virtual ~KeyProfile();
|
|
|
|
void addCharacters(const std::string &s);
|
|
void addTimeouts(const std::string &s);
|
|
};
|
|
|
|
class Profile
|
|
{
|
|
std::string name;
|
|
std::map<uint32_t, KeyProfile *> keys = {};
|
|
|
|
void addCharacters(KeyProfile *pk, const std::string &s);
|
|
void addTimeouts(KeyProfile *pk, const std::string &s);
|
|
void addKeyProfile(KeyProfile *pk);
|
|
void setName(std::string name)
|
|
{
|
|
this->name = name;
|
|
};
|
|
const KeyProfile *getKeyProfile(uint32_t keyCode);
|
|
|
|
public:
|
|
void clear()
|
|
{
|
|
this->keys.clear();
|
|
};
|
|
Profile() = default;
|
|
Profile(const std::string &name);
|
|
Profile(Profile &&p);
|
|
virtual ~Profile();
|
|
|
|
std::string getName()
|
|
{
|
|
return name;
|
|
};
|
|
bool load(std::string filename);
|
|
|
|
uint32_t get(bsp::KeyCodes code, uint32_t times);
|
|
};
|
|
|
|
} /* namespace gui */
|