Make debug view scrollable
This commit is contained in:
		@ -8,7 +8,7 @@
 | 
			
		||||
#include <mvp/View.hpp>
 | 
			
		||||
#include <gui/debugview_screen/DebugViewPresenter.hpp>
 | 
			
		||||
#include <touchgfx/widgets/Box.hpp>
 | 
			
		||||
#include <touchgfx/containers/scrollers/ScrollList.hpp>
 | 
			
		||||
#include <touchgfx/containers/scrollers/ScrollWheel.hpp>
 | 
			
		||||
#include <gui/containers/DebugViewLine.hpp>
 | 
			
		||||
#include <touchgfx/widgets/canvas/Line.hpp>
 | 
			
		||||
#include <touchgfx/widgets/canvas/PainterRGB565.hpp>
 | 
			
		||||
@ -24,6 +24,19 @@ public:
 | 
			
		||||
    {
 | 
			
		||||
        // Override and implement this function in DebugView
 | 
			
		||||
    }
 | 
			
		||||
    virtual void handleKeyEvent(uint8_t key);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Virtual Action Handlers
 | 
			
		||||
     */
 | 
			
		||||
    virtual void scrollUp()
 | 
			
		||||
    {
 | 
			
		||||
        // Override and implement this function in DebugView
 | 
			
		||||
    }
 | 
			
		||||
    virtual void scrollDown()
 | 
			
		||||
    {
 | 
			
		||||
        // Override and implement this function in DebugView
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    FrontendApplication& application() {
 | 
			
		||||
@ -34,7 +47,7 @@ protected:
 | 
			
		||||
     * Member Declarations
 | 
			
		||||
     */
 | 
			
		||||
    touchgfx::Box __background;
 | 
			
		||||
    touchgfx::ScrollList list;
 | 
			
		||||
    touchgfx::ScrollWheel list;
 | 
			
		||||
    touchgfx::DrawableListItems<DebugViewLine, 13> listListItems;
 | 
			
		||||
    touchgfx::Line line1;
 | 
			
		||||
    touchgfx::PainterRGB565 line1Painter;
 | 
			
		||||
 | 
			
		||||
@ -17,14 +17,14 @@ DebugViewViewBase::DebugViewViewBase() :
 | 
			
		||||
    list.setPosition(15, 15, 450, 290);
 | 
			
		||||
    list.setHorizontal(false);
 | 
			
		||||
    list.setCircular(true);
 | 
			
		||||
    list.setEasingEquation(touchgfx::EasingEquations::backEaseOut);
 | 
			
		||||
    list.setEasingEquation(touchgfx::EasingEquations::linearEaseOut);
 | 
			
		||||
    list.setSwipeAcceleration(10);
 | 
			
		||||
    list.setDragAcceleration(10);
 | 
			
		||||
    list.setNumberOfItems(1);
 | 
			
		||||
    list.setPadding(0, 0);
 | 
			
		||||
    list.setSnapping(false);
 | 
			
		||||
    list.setSelectedItemOffset(0);
 | 
			
		||||
    list.setDrawableSize(26, 0);
 | 
			
		||||
    list.setDrawables(listListItems, updateItemCallback);
 | 
			
		||||
    list.animateToItem(0, 0);
 | 
			
		||||
    add(list);
 | 
			
		||||
 | 
			
		||||
    line1.setPosition(15, 15, 1, 290);
 | 
			
		||||
@ -69,6 +69,27 @@ void DebugViewViewBase::setupScreen()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DebugViewViewBase::handleKeyEvent(uint8_t key)
 | 
			
		||||
{
 | 
			
		||||
    if(104 == key)
 | 
			
		||||
    {
 | 
			
		||||
        //ScrollUp
 | 
			
		||||
        //When hardware button 104 clicked call virtual function
 | 
			
		||||
        //Call scrollUp
 | 
			
		||||
        scrollUp();
 | 
			
		||||
    
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(108 == key)
 | 
			
		||||
    {
 | 
			
		||||
        //ScrollDown
 | 
			
		||||
        //When hardware button 108 clicked call virtual function
 | 
			
		||||
        //Call scrollDown
 | 
			
		||||
        scrollDown();
 | 
			
		||||
    
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DebugViewViewBase::updateItemCallbackHandler(touchgfx::DrawableListItemsInterface* items, int16_t containerIndex, int16_t itemIndex)
 | 
			
		||||
{
 | 
			
		||||
    if (items == &listListItems)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user