mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-23 00:19:31 -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
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
/*
|
|
* Navigation.cpp
|
|
*
|
|
* Created on: 15 mar 2019
|
|
* Author: robert
|
|
*/
|
|
|
|
#include "Navigation.hpp"
|
|
#include "Item.hpp"
|
|
|
|
namespace gui
|
|
{
|
|
|
|
void Navigation::setDirectionItem(NavigationDirection direction, Item *item)
|
|
{
|
|
switch (direction) {
|
|
case NavigationDirection::LEFT:
|
|
left = item;
|
|
break;
|
|
case NavigationDirection::UP:
|
|
up = item;
|
|
break;
|
|
case NavigationDirection::RIGHT:
|
|
right = item;
|
|
break;
|
|
case NavigationDirection::DOWN:
|
|
down = item;
|
|
break;
|
|
case NavigationDirection::NONE:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void Navigation::clearDirection(const NavigationDirection direction)
|
|
{
|
|
switch (direction) {
|
|
case (NavigationDirection::LEFT):
|
|
left = nullptr;
|
|
break;
|
|
case (NavigationDirection::UP):
|
|
up = nullptr;
|
|
break;
|
|
case (NavigationDirection::RIGHT):
|
|
right = nullptr;
|
|
break;
|
|
case (NavigationDirection::DOWN):
|
|
down = nullptr;
|
|
break;
|
|
case NavigationDirection::NONE:
|
|
break;
|
|
}
|
|
}
|
|
|
|
Item *Navigation::getDirectionItem(const NavigationDirection direction) const
|
|
{
|
|
switch (direction) {
|
|
case (NavigationDirection::LEFT):
|
|
return left;
|
|
case (NavigationDirection::UP):
|
|
return up;
|
|
case (NavigationDirection::RIGHT):
|
|
return right;
|
|
case (NavigationDirection::DOWN):
|
|
return down;
|
|
case NavigationDirection::NONE:
|
|
break;
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
Navigation::~Navigation()
|
|
{
|
|
left = up = right = down = nullptr;
|
|
}
|
|
|
|
} /* namespace gui */
|