unleashed-firmware/lib/app-scened-template/view-modules/dialog-ex-vm.cpp
SG 0b14db4fb3
C++ apps: templated scene controller (#517)
* 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
2021-06-15 14:01:56 +03:00

61 lines
1.6 KiB
C++

#include "dialog-ex-vm.h"
DialogExVM::DialogExVM() {
dialog_ex = dialog_ex_alloc();
}
DialogExVM::~DialogExVM() {
dialog_ex_free(dialog_ex);
}
View* DialogExVM::get_view() {
return dialog_ex_get_view(dialog_ex);
}
void DialogExVM::clean() {
set_result_callback(NULL);
set_context(NULL);
set_header(NULL, 0, 0, AlignLeft, AlignBottom);
set_text(NULL, 0, 0, AlignLeft, AlignBottom);
set_icon(-1, -1, I_ButtonCenter_7x7);
set_left_button_text(NULL);
set_center_button_text(NULL);
set_right_button_text(NULL);
}
void DialogExVM::set_result_callback(DialogExResultCallback callback) {
dialog_ex_set_result_callback(dialog_ex, callback);
}
void DialogExVM::set_context(void* context) {
dialog_ex_set_context(dialog_ex, context);
}
void DialogExVM::set_header(
const char* text,
uint8_t x,
uint8_t y,
Align horizontal,
Align vertical) {
dialog_ex_set_header(dialog_ex, text, x, y, horizontal, vertical);
}
void DialogExVM::set_text(const char* text, uint8_t x, uint8_t y, Align horizontal, Align vertical) {
dialog_ex_set_text(dialog_ex, text, x, y, horizontal, vertical);
}
void DialogExVM::set_icon(int8_t x, int8_t y, IconName name) {
dialog_ex_set_icon(dialog_ex, x, y, name);
}
void DialogExVM::set_left_button_text(const char* text) {
dialog_ex_set_left_button_text(dialog_ex, text);
}
void DialogExVM::set_center_button_text(const char* text) {
dialog_ex_set_center_button_text(dialog_ex, text);
}
void DialogExVM::set_right_button_text(const char* text) {
dialog_ex_set_right_button_text(dialog_ex, text);
}