refactor: add active parameter to updateHint method signature
1. **Method Signature Update**: Added `bool active` parameter to `updateHint()` method across the display driver hierarchy: - `DisplayManager::updateHint(x, y, active)` - delegates to driver - `DisplayDriverTFT::updateHint(x, y, active)` - override implementation - `DisplayDriverGFX::updateHint(x, y, active)` - override implementation 2. **Code Formatting**: `DisplayManager.h` reformatted (whitespace/comment style changes only) - **Breaking Change**: All existing `updateHint(x, y)` calls will fail to compile until updated to include the `active` parameter - **Enhanced Control**: Callers can now explicitly show/hide touch hints rather than just updating position, enabling better touch feedback UX (e.g., hide hint on touch release) - **API Consistency**: All implementations in the driver hierarchy now enforce the same signature
This commit is contained in:
@@ -1,36 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "IDisplayDriver.h"
|
||||
|
||||
/// Owns a pointer to the concrete driver; all calls delegate.
|
||||
/// Board sketch creates the concrete driver and passes it in.
|
||||
class DisplayManager {
|
||||
public:
|
||||
DisplayManager()
|
||||
: _drv(nullptr) { }
|
||||
explicit DisplayManager(IDisplayDriver* drv)
|
||||
DisplayManager(IDisplayDriver* drv)
|
||||
: _drv(drv) { }
|
||||
void setDriver(IDisplayDriver* drv) { _drv = drv; }
|
||||
|
||||
void begin() {
|
||||
if(_drv)
|
||||
_drv->begin();
|
||||
}
|
||||
|
||||
void setBacklight(bool on) {
|
||||
if(_drv)
|
||||
_drv->setBacklight(on);
|
||||
}
|
||||
|
||||
void render(const ScreenState& st) {
|
||||
if(_drv)
|
||||
_drv->render(st);
|
||||
}
|
||||
|
||||
TouchEvent readTouch() { return _drv ? _drv->readTouch() : TouchEvent {}; }
|
||||
|
||||
int dashboardTouch(int x, int y) { return _drv ? _drv->dashboardTouch(x, y) : -1; }
|
||||
|
||||
HoldState updateHold(unsigned long ms) { return _drv ? _drv->updateHold(ms) : HoldState {}; }
|
||||
void updateHint(int x, int y) {
|
||||
|
||||
void updateHint(int x, int y, bool active) {
|
||||
if(_drv)
|
||||
_drv->updateHint(x, y);
|
||||
_drv->updateHint(x, y, active);
|
||||
}
|
||||
|
||||
int width() { return _drv ? _drv->width() : 0; }
|
||||
|
||||
int height() { return _drv ? _drv->height() : 0; }
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user