 0b14db4fb3
			
		
	
	
		0b14db4fb3
		
			
		
	
	
	
	
		
			
			* C++ apps: templated scene controller * templated app: fix type names * templated app: text store component * Applications: add "Templated Scene" application * templated app: refractoring * Gui module byte input: fix docs * templated app: new byte input scene * templated app: dialog ex view module * templated app: popup view module * templated app: dialog-ex view module, fix docs * templated app: text input view module * Gui module text input: fix docs * Furi: duplicated include * templated app: record holder (controller) class * templated app: view modules can now be accessed via cast * templated app: remove unused includes * templated app: fix return code
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "scened-app-scene-byte-input.h"
 | |
| 
 | |
| void ScenedAppSceneByteInput::on_enter(ScenedApp* app, bool need_restore) {
 | |
|     ByteInputVM* byte_input = app->view_controller;
 | |
|     auto callback = cbc::obtain_connector(this, &ScenedAppSceneByteInput::result_callback);
 | |
| 
 | |
|     byte_input->set_result_callback(callback, NULL, app, data, 4);
 | |
|     byte_input->set_header_text("Enter the key");
 | |
| 
 | |
|     app->view_controller.switch_to<ByteInputVM>();
 | |
| }
 | |
| 
 | |
| bool ScenedAppSceneByteInput::on_event(ScenedApp* app, ScenedApp::Event* event) {
 | |
|     bool consumed = false;
 | |
| 
 | |
|     if(event->type == ScenedApp::EventType::ByteEditResult) {
 | |
|         app->scene_controller.switch_to_previous_scene();
 | |
|         consumed = true;
 | |
|     }
 | |
| 
 | |
|     return consumed;
 | |
| }
 | |
| 
 | |
| void ScenedAppSceneByteInput::on_exit(ScenedApp* app) {
 | |
|     app->view_controller.get<ByteInputVM>()->clean();
 | |
| }
 | |
| 
 | |
| void ScenedAppSceneByteInput::result_callback(void* context, uint8_t* bytes, uint8_t bytes_count) {
 | |
|     ScenedApp* app = static_cast<ScenedApp*>(context);
 | |
|     ScenedApp::Event event;
 | |
| 
 | |
|     event.type = ScenedApp::EventType::ByteEditResult;
 | |
| 
 | |
|     app->view_controller.send_event(&event);
 | |
| }
 |