Allow changing displayed fields in DriverView

This commit is contained in:
2023-03-20 23:31:28 +01:00
parent c8ee51a78f
commit 0d7cc03e02
28 changed files with 603 additions and 68 deletions

View File

@ -33,19 +33,6 @@ FrontendApplicationBase::FrontendApplicationBase(Model& m, FrontendHeap& heap)
* Screen Transition Declarations
*/
// MissionSelect
void FrontendApplicationBase::gotoMissionSelectScreenNoTransition()
{
transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoMissionSelectScreenNoTransitionImpl);
pendingScreenTransitionCallback = &transitionCallback;
}
void FrontendApplicationBase::gotoMissionSelectScreenNoTransitionImpl()
{
touchgfx::makeTransition<MissionSelectView, MissionSelectPresenter, touchgfx::NoTransition, Model >(&currentScreen, &currentPresenter, frontendHeap, &currentTransition, &model);
}
// AMI
void FrontendApplicationBase::gotoAMIScreenNoTransition()

View File

@ -0,0 +1,58 @@
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/containers/DriverViewFieldSelectionBase.hpp>
#include <touchgfx/Color.hpp>
#include <texts/TextKeysAndLanguages.hpp>
DriverViewFieldSelectionBase::DriverViewFieldSelectionBase()
{
setWidth(160);
setHeight(26);
bg.setPosition(0, 0, 160, 25);
bg.setColor(touchgfx::Color::getColorFromRGB(34, 34, 34));
add(bg);
name.setPosition(0, 0, 160, 25);
name.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
name.setLinespacing(0);
name.setTypedText(touchgfx::TypedText(T___SINGLEUSE_PNKR));
add(name);
line1.setPosition(0, 25, 160, 1);
line1Painter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
line1.setPainter(line1Painter);
line1.setStart(0, 0);
line1.setEnd(160, 0);
line1.setLineWidth(10);
line1.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(line1);
line2.setPosition(0, 0, 1, 26);
line2Painter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
line2.setPainter(line2Painter);
line2.setStart(0, 0);
line2.setEnd(0, 26);
line2.setLineWidth(10);
line2.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(line2);
line2_1.setPosition(159, 0, 1, 26);
line2_1Painter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
line2_1.setPainter(line2_1Painter);
line2_1.setStart(0, 0);
line2_1.setEnd(0, 26);
line2_1.setLineWidth(10);
line2_1.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(line2_1);
}
DriverViewFieldSelectionBase::~DriverViewFieldSelectionBase()
{
}
void DriverViewFieldSelectionBase::initialize()
{
}

View File

@ -7,7 +7,8 @@
#include <images/BitmapDatabase.hpp>
#include <texts/TextKeysAndLanguages.hpp>
DriverViewViewBase::DriverViewViewBase()
DriverViewViewBase::DriverViewViewBase() :
updateItemCallback(this, &DriverViewViewBase::updateItemCallbackHandler)
{
touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
@ -101,6 +102,20 @@ DriverViewViewBase::DriverViewViewBase()
field3.setXY(320, 0);
add(field3);
fieldTypeSelection.setPosition(0, 80, 160, 240);
fieldTypeSelection.setHorizontal(false);
fieldTypeSelection.setCircular(true);
fieldTypeSelection.setEasingEquation(touchgfx::EasingEquations::backEaseOut);
fieldTypeSelection.setSwipeAcceleration(10);
fieldTypeSelection.setDragAcceleration(10);
fieldTypeSelection.setNumberOfItems(1);
fieldTypeSelection.setSelectedItemOffset(94);
fieldTypeSelection.setDrawableSize(26, 0);
fieldTypeSelection.setDrawables(fieldTypeSelectionListItems, updateItemCallback);
fieldTypeSelection.animateToItem(0, 0);
fieldTypeSelection.setVisible(false);
add(fieldTypeSelection);
}
DriverViewViewBase::~DriverViewViewBase()
@ -117,4 +132,67 @@ void DriverViewViewBase::setupScreen()
field1.initialize();
field2.initialize();
field3.initialize();
fieldTypeSelection.initialize();
for (int i = 0; i < fieldTypeSelectionListItems.getNumberOfDrawables(); i++)
{
fieldTypeSelectionListItems[i].initialize();
}
}
void DriverViewViewBase::handleKeyEvent(uint8_t key)
{
if(22 == key)
{
//SelectPreviousField
//When hardware button 22 clicked call virtual function
//Call selectPrevField
selectPrevField();
}
if(21 == key)
{
//SelectNextField
//When hardware button 21 clicked call virtual function
//Call selectNextField
selectNextField();
}
if(24 == key)
{
//SelectPreviousFieldType
//When hardware button 24 clicked call virtual function
//Call selectPrevFieldType
selectPrevFieldType();
}
if(23 == key)
{
//SelectNextFieldType
//When hardware button 23 clicked call virtual function
//Call selectNextFieldType
selectNextFieldType();
}
if(6 == key)
{
//ConfirmFieldType
//When hardware button 6 clicked call virtual function
//Call confirmFieldType
confirmFieldType();
}
}
void DriverViewViewBase::updateItemCallbackHandler(touchgfx::DrawableListItemsInterface* items, int16_t containerIndex, int16_t itemIndex)
{
if (items == &fieldTypeSelectionListItems)
{
touchgfx::Drawable* d = items->getDrawable(containerIndex);
DriverViewFieldSelection* cc = (DriverViewFieldSelection*)d;
fieldTypeSelectionUpdateItem(*cc, itemIndex);
}
}