Select one of the symbols to view example projects that use it.
 
Outline
#include <gui/main_menu_screen/MainMenuView.hpp>
#include <BitmapDatabase.hpp>
#define GFX_DEMO_SIGNATURE_B
#include "stm32f4xx.h"
MainMenuView::MainMenuView()
MainMenuView::~MainMenuView()
MainMenuView::setSelectedDemoScreen(int)
MainMenuView::gotoSelectedDemoScreen()
MainMenuView::toggleButtonPressedHandler(const AbstractButton &)
MainMenuView::stMenuButtonPressedHandler(const AbstractButton &)
Files
loading...
CodeScopeSTM32 Libraries and SamplesTouchGFXGui/gui/src/main_menu_screen/MainMenuView.cpp
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * This file is part of the TouchGFX 4.10.0 distribution. * * @attention * * Copyright (c) 2018 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ #include <gui/main_menu_screen/MainMenuView.hpp> #include <BitmapDatabase.hpp> #ifndef SIMULATOR #define GFX_DEMO_SIGNATURE_B 0x5AA55BBB extern "C" { #include "stm32f4xx.h" }extern "C" { ... } /* ... */#endif MainMenuView::MainMenuView() : selectedDemoScreenIndex(0), onToggleButtonPressed(this, &MainMenuView::toggleButtonPressedHandler), onStMenuButtonPressed(this, &MainMenuView::stMenuButtonPressedHandler) { // ToggleMenuButton must be added by the specialized menu view (to get correct z-order) toggleMenuButton.setBitmaps(Bitmap(BITMAP_MENU_TOGGLE_BUTTON_ID), Bitmap(BITMAP_MENU_TOGGLE_BUTTON_PRESSED_ID)); toggleMenuButton.setXY(35, 26); toggleMenuButton.setAction(onToggleButtonPressed); stMenuButton.setBitmaps(Bitmap(BITMAP_ST_MENU_BUTTON_ID), Bitmap(BITMAP_ST_MENU_BUTTON_PRESSED_ID)); stMenuButton.setXY(HAL::DISPLAY_WIDTH - stMenuButton.getWidth()-35, 26); stMenuButton.setAction(onStMenuButtonPressed); // MCULoad must be added by the specialized menu view (to get correct z-order) mcuLoadTxt.setXY(35, 82); mcuLoadTxt.setColor(Color::getColorFrom24BitRGB(0xFF, 0xFF, 0xFF)); mcuLoadValueTxt.setPosition(mcuLoadTxt.getRect().right()-4, mcuLoadTxt.getY(), 50, 30); mcuLoadValueTxt.setColor(mcuLoadTxt.getColor()); }{ ... } MainMenuView::~MainMenuView() { }{ ... } void MainMenuView::setSelectedDemoScreen(int demoIndex) { selectedDemoScreenIndex = demoIndex; }{ ... } void MainMenuView::gotoSelectedDemoScreen() { presenter->setSelectedDemoScreenIndex(selectedDemoScreenIndex); switch (demoIDs[selectedDemoScreenIndex]) { case MainMenuView::PRODUCT_PRESENTER: static_cast<FrontendApplication*>(Application::getInstance())->gotoProductPresenterScreen(); break;case MainMenuView::PRODUCT_PRESENTER: case MainMenuView::GAME2048: static_cast<FrontendApplication*>(Application::getInstance())->gotoGame2048Screen(); break;case MainMenuView::GAME2048: case MainMenuView::GAME2D: static_cast<FrontendApplication*>(Application::getInstance())->gotoGame2DScreen(); break;case MainMenuView::GAME2D: case MainMenuView::CUSTOM_CONTROLS: static_cast<FrontendApplication*>(Application::getInstance())->gotoCustomControlsScreen(); break;case MainMenuView::CUSTOM_CONTROLS: case MainMenuView::GRAPH: static_cast<FrontendApplication*>(Application::getInstance())->gotoGraphScreen(); break;case MainMenuView::GRAPH: case MainMenuView::NO_DEMO_SCREEN: break;case MainMenuView::NO_DEMO_SCREEN: default: break;default }switch (demoIDs[selectedDemoScreenIndex]) { ... } }{ ... } void MainMenuView::toggleButtonPressedHandler(const AbstractButton& button) { // Clear the previous selected menu that is used for returning from // a demo screen to the menu. But when toggling between menus this // is not needed. presenter->setPreviousSelectedMenuType(MainMenuPresenter::NO_MENU); presenter->setSelectedDemoScreenIndex(0); toggleMenu(); }{ ... } void MainMenuView::stMenuButtonPressedHandler(const AbstractButton& button) { #ifndef SIMULATOR *(uint32_t *)(0x40024000) = GFX_DEMO_SIGNATURE_B; NVIC_SystemReset(); /* ... */ #endif }{ ... }