2018-11-26 12:58:15 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the "bluetoothheater" distribution
|
|
|
|
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-12-01 01:36:25 +01:00
|
|
|
#ifndef __SCREEN_H__
|
|
|
|
#define __SCREEN_H__
|
2018-11-17 03:08:22 +01:00
|
|
|
|
2018-12-01 01:36:25 +01:00
|
|
|
#include "128x64OLED.h"
|
2018-12-16 08:34:39 +01:00
|
|
|
#include "ScreenManager.h"
|
2018-11-17 03:08:22 +01:00
|
|
|
|
2019-06-01 02:18:31 +02:00
|
|
|
struct BITMAP_INFO {
|
|
|
|
uint8_t width;
|
|
|
|
uint8_t height;
|
|
|
|
const uint8_t* pBitmap;
|
|
|
|
BITMAP_INFO(uint8_t w, uint8_t h, const uint8_t* pBmp) {
|
|
|
|
width = w;
|
|
|
|
height = h;
|
|
|
|
pBitmap = pBmp;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-11-29 21:09:46 +01:00
|
|
|
enum eJUSTIFY {
|
|
|
|
eLeftJustify, eCentreJustify, eRightJustify
|
|
|
|
};
|
2018-11-17 03:08:22 +01:00
|
|
|
|
2018-12-01 01:36:25 +01:00
|
|
|
const int border = 3;
|
|
|
|
const int radius = 4;
|
2019-09-17 00:30:49 +02:00
|
|
|
const int SaveConfirm = 10;
|
2018-11-23 11:34:37 +01:00
|
|
|
|
2018-11-25 05:45:17 +01:00
|
|
|
class CScreen {
|
|
|
|
protected:
|
2018-12-20 07:29:00 +01:00
|
|
|
int _showOEMerror;
|
2018-11-25 05:45:17 +01:00
|
|
|
C128x64_OLED& _display;
|
2018-11-29 12:11:50 +01:00
|
|
|
CScreenManager& _ScreenManager;
|
2018-12-07 05:18:24 +01:00
|
|
|
void _printMenuText(int x, int y, const char* str, bool selected = false, eJUSTIFY justify = eLeftJustify, int border = 3, int radius = 4);
|
2018-11-30 14:33:49 +01:00
|
|
|
void _printInverted(int x, int y, const char* str, bool selected, eJUSTIFY justify = eLeftJustify);
|
2018-11-29 21:09:46 +01:00
|
|
|
void _adjustExtents(CRect& rect, eJUSTIFY justify, const char* str);
|
2018-12-08 02:39:41 +01:00
|
|
|
void _drawMenuSelection(CRect extents, const char* str, int border = 3, int radius = 4);
|
2019-07-20 08:08:43 +02:00
|
|
|
void _drawMenuSelection(const CRect& extents, int border, int radius);
|
2020-04-07 23:51:52 +02:00
|
|
|
void _scrollMessage(int y, const char* str, int& charOffset, bool centred=true);
|
2018-12-20 07:29:00 +01:00
|
|
|
void _reqOEMWarning();
|
2019-06-02 11:19:08 +02:00
|
|
|
void _drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t color = WHITE, uint16_t bg = 0xffff);
|
2019-07-27 16:28:39 +02:00
|
|
|
void _showTitle(const char* title);
|
2019-07-28 01:07:29 +02:00
|
|
|
void _showConfirmMessage();
|
|
|
|
void _showStoringMessage();
|
2018-11-25 05:45:17 +01:00
|
|
|
public:
|
|
|
|
CScreen(C128x64_OLED& disp, CScreenManager& mgr);
|
|
|
|
virtual ~CScreen();
|
2018-12-08 05:18:37 +01:00
|
|
|
virtual void onSelect();
|
2019-02-28 09:56:13 +01:00
|
|
|
virtual void onExit();
|
2018-12-01 19:25:10 +01:00
|
|
|
virtual bool animate();
|
2019-01-19 00:06:12 +01:00
|
|
|
virtual bool show();
|
|
|
|
virtual bool keyHandler(uint8_t event) { return false; };
|
2018-11-25 05:45:17 +01:00
|
|
|
};
|
2018-11-23 11:34:37 +01:00
|
|
|
|
2018-12-01 01:36:25 +01:00
|
|
|
|
|
|
|
class CTransientFont {
|
2018-11-29 12:11:50 +01:00
|
|
|
C128x64_OLED& _display;
|
|
|
|
public:
|
2018-12-01 01:36:25 +01:00
|
|
|
CTransientFont(C128x64_OLED& disp, const FONT_INFO* pFont);
|
|
|
|
~CTransientFont();
|
2018-11-29 12:11:50 +01:00
|
|
|
};
|
|
|
|
|
2018-12-01 01:36:25 +01:00
|
|
|
#endif // __SCREEN_H__
|