118 lines
3.3 KiB
C++
118 lines
3.3 KiB
C++
|
/*********************************************************************************/
|
||
|
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||
|
/*********************************************************************************/
|
||
|
#include <gui_generated/vehicleconfig_screen/VehicleConfigViewBase.hpp>
|
||
|
#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
|
||
|
#include <touchgfx/Color.hpp>
|
||
|
#include <texts/TextKeysAndLanguages.hpp>
|
||
|
|
||
|
VehicleConfigViewBase::VehicleConfigViewBase() :
|
||
|
updateItemCallback(this, &VehicleConfigViewBase::updateItemCallbackHandler)
|
||
|
{
|
||
|
touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
|
||
|
|
||
|
__background.setPosition(0, 0, 480, 320);
|
||
|
__background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
|
||
|
add(__background);
|
||
|
|
||
|
title.setPosition(15, 15, 450, 37);
|
||
|
title.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
||
|
title.setLinespacing(0);
|
||
|
title.setTypedText(touchgfx::TypedText(T___SINGLEUSE_RWCE));
|
||
|
add(title);
|
||
|
|
||
|
params.setPosition(15, 60, 450, 245);
|
||
|
params.setHorizontal(false);
|
||
|
params.setCircular(false);
|
||
|
params.setEasingEquation(touchgfx::EasingEquations::cubicEaseOut);
|
||
|
params.setSwipeAcceleration(10);
|
||
|
params.setDragAcceleration(10);
|
||
|
params.setNumberOfItems(1);
|
||
|
params.setSelectedItemOffset(0);
|
||
|
params.setDrawableSize(50, 0);
|
||
|
params.setDrawables(paramsListItems, updateItemCallback);
|
||
|
params.animateToItem(0, 0);
|
||
|
add(params);
|
||
|
|
||
|
line1.setPosition(15, 58, 450, 2);
|
||
|
line1Painter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
||
|
line1.setPainter(line1Painter);
|
||
|
line1.setStart(0, 0);
|
||
|
line1.setEnd(450, 0);
|
||
|
line1.setLineWidth(10);
|
||
|
line1.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
|
||
|
add(line1);
|
||
|
}
|
||
|
|
||
|
VehicleConfigViewBase::~VehicleConfigViewBase()
|
||
|
{
|
||
|
touchgfx::CanvasWidgetRenderer::resetBuffer();
|
||
|
}
|
||
|
|
||
|
void VehicleConfigViewBase::setupScreen()
|
||
|
{
|
||
|
params.initialize();
|
||
|
for (int i = 0; i < paramsListItems.getNumberOfDrawables(); i++)
|
||
|
{
|
||
|
paramsListItems[i].initialize();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void VehicleConfigViewBase::handleKeyEvent(uint8_t key)
|
||
|
{
|
||
|
if(22 == key)
|
||
|
{
|
||
|
//SelectPreviousParam
|
||
|
//When hardware button 22 clicked call virtual function
|
||
|
//Call selectPrevParam
|
||
|
selectPrevParam();
|
||
|
|
||
|
}
|
||
|
|
||
|
if(21 == key)
|
||
|
{
|
||
|
//SelectNextParam
|
||
|
//When hardware button 21 clicked call virtual function
|
||
|
//Call selectNextParam
|
||
|
selectNextParam();
|
||
|
|
||
|
}
|
||
|
|
||
|
if(24 == key)
|
||
|
{
|
||
|
//DecreaseParam
|
||
|
//When hardware button 24 clicked call virtual function
|
||
|
//Call decParam
|
||
|
decParam();
|
||
|
|
||
|
}
|
||
|
|
||
|
if(23 == key)
|
||
|
{
|
||
|
//IncreaseParam
|
||
|
//When hardware button 23 clicked call virtual function
|
||
|
//Call incParam
|
||
|
incParam();
|
||
|
|
||
|
}
|
||
|
|
||
|
if(6 == key)
|
||
|
{
|
||
|
//ConfirmParam
|
||
|
//When hardware button 6 clicked call virtual function
|
||
|
//Call confirmParam
|
||
|
confirmParam();
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void VehicleConfigViewBase::updateItemCallbackHandler(touchgfx::DrawableListItemsInterface* items, int16_t containerIndex, int16_t itemIndex)
|
||
|
{
|
||
|
if (items == ¶msListItems)
|
||
|
{
|
||
|
touchgfx::Drawable* d = items->getDrawable(containerIndex);
|
||
|
ConfigItem* cc = (ConfigItem*)d;
|
||
|
paramsUpdateItem(*cc, itemIndex);
|
||
|
}
|
||
|
}
|