2020-01-18 18:17:52 +01:00
|
|
|
#pragma once
|
2020-08-21 11:55:59 +02:00
|
|
|
|
|
|
|
#include <cstdint>
|
2021-10-13 22:08:35 +02:00
|
|
|
#include "displayapp/TouchEvents.h"
|
2021-07-19 16:26:12 +03:00
|
|
|
#include <lvgl/lvgl.h>
|
2020-01-18 18:17:52 +01:00
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace Applications {
|
2020-02-16 18:32:36 +01:00
|
|
|
class DisplayApp;
|
2023-01-07 21:23:15 +01:00
|
|
|
|
2020-01-18 18:17:52 +01:00
|
|
|
namespace Screens {
|
2021-04-18 20:28:14 +03:00
|
|
|
class Screen {
|
2021-07-19 16:26:12 +03:00
|
|
|
private:
|
|
|
|
virtual void Refresh() {
|
|
|
|
}
|
|
|
|
|
2021-04-24 12:00:45 +03:00
|
|
|
public:
|
2023-02-22 22:05:37 +02:00
|
|
|
explicit Screen() = default;
|
|
|
|
|
2021-04-18 20:28:14 +03:00
|
|
|
virtual ~Screen() = default;
|
2020-02-23 13:44:39 +01:00
|
|
|
|
2021-07-19 16:26:12 +03:00
|
|
|
static void RefreshTaskCallback(lv_task_t* task);
|
|
|
|
|
|
|
|
bool IsRunning() const {
|
|
|
|
return running;
|
|
|
|
}
|
2020-01-18 18:17:52 +01:00
|
|
|
|
2021-04-18 20:28:14 +03:00
|
|
|
/** @return false if the button hasn't been handled by the app, true if it has been handled */
|
|
|
|
virtual bool OnButtonPushed() {
|
|
|
|
return false;
|
|
|
|
}
|
2020-03-15 21:01:24 +01:00
|
|
|
|
2021-04-18 20:28:14 +03:00
|
|
|
/** @return false if the event hasn't been handled by the app, true if it has been handled */
|
2021-07-16 00:07:55 +03:00
|
|
|
// Returning true will cancel lvgl tap
|
2022-12-30 23:31:31 +02:00
|
|
|
virtual bool OnTouchEvent(TouchEvents /*event*/) {
|
2021-04-18 20:28:14 +03:00
|
|
|
return false;
|
|
|
|
}
|
2023-01-07 21:23:15 +01:00
|
|
|
|
2022-12-30 23:31:31 +02:00
|
|
|
virtual bool OnTouchEvent(uint16_t /*x*/, uint16_t /*y*/) {
|
2021-04-18 20:28:14 +03:00
|
|
|
return false;
|
|
|
|
}
|
2021-04-04 03:08:51 +01:00
|
|
|
|
2021-04-24 12:00:45 +03:00
|
|
|
protected:
|
2021-04-18 20:28:14 +03:00
|
|
|
bool running = true;
|
2020-01-18 18:17:52 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|