My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

alert_dialog_box.cpp 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /************************
  2. * alert_dialog_box.cpp *
  3. ************************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  7. * *
  8. * This program is free software: you can redistribute it and/or modify *
  9. * it under the terms of the GNU General Public License as published by *
  10. * the Free Software Foundation, either version 3 of the License, or *
  11. * (at your option) any later version. *
  12. * *
  13. * This program is distributed in the hope that it will be useful, *
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU General Public License for more details. *
  17. * *
  18. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #if ENABLED(TOUCH_UI_FTDI_EVE)
  23. #include "screens.h"
  24. #include "screen_data.h"
  25. using namespace FTDI;
  26. using namespace Theme;
  27. void AlertDialogBox::onEntry() {
  28. BaseScreen::onEntry();
  29. sound.play(screen_data.AlertDialogBox.isError ? sad_trombone : twinkle, PLAY_ASYNCHRONOUS);
  30. }
  31. void AlertDialogBox::onRedraw(draw_mode_t what) {
  32. if (what & FOREGROUND) {
  33. drawOkayButton();
  34. }
  35. }
  36. template<typename T>
  37. void AlertDialogBox::show(const T message) {
  38. drawMessage(message);
  39. storeBackground();
  40. screen_data.AlertDialogBox.isError = false;
  41. GOTO_SCREEN(AlertDialogBox);
  42. }
  43. template<typename T>
  44. void AlertDialogBox::showError(const T message) {
  45. drawMessage(message);
  46. storeBackground();
  47. screen_data.AlertDialogBox.isError = true;
  48. GOTO_SCREEN(AlertDialogBox);
  49. }
  50. void AlertDialogBox::hide() {
  51. if (AT_SCREEN(AlertDialogBox))
  52. GOTO_PREVIOUS();
  53. }
  54. template void AlertDialogBox::show(const char *);
  55. template void AlertDialogBox::show(const progmem_str);
  56. template void AlertDialogBox::showError(const char *);
  57. template void AlertDialogBox::showError(const progmem_str);
  58. #endif // TOUCH_UI_FTDI_EVE