2018-11-26 11:58:15 +00: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 00:36:25 +00:00
|
|
|
#ifndef __SCREEN_H__
|
|
|
|
#define __SCREEN_H__
|
2018-11-17 02:08:22 +00:00
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
#include "128x64OLED.h"
|
2018-12-16 07:34:39 +00:00
|
|
|
#include "ScreenManager.h"
|
2018-11-17 02:08:22 +00:00
|
|
|
|
2019-06-01 00:18:31 +00: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 20:09:46 +00:00
|
|
|
enum eJUSTIFY {
|
|
|
|
eLeftJustify, eCentreJustify, eRightJustify
|
|
|
|
};
|
2018-11-17 02:08:22 +00:00
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
const int border = 3;
|
|
|
|
const int radius = 4;
|
2019-09-16 22:30:49 +00:00
|
|
|
const int SaveConfirm = 10;
|
2018-11-23 10:34:37 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
class CScreen {
|
|
|
|
protected:
|
2018-12-20 06:29:00 +00:00
|
|
|
int _showOEMerror;
|
2018-11-25 04:45:17 +00:00
|
|
|
C128x64_OLED& _display;
|
2018-11-29 11:11:50 +00:00
|
|
|
CScreenManager& _ScreenManager;
|
2018-12-07 04:18:24 +00: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 13:33:49 +00:00
|
|
|
void _printInverted(int x, int y, const char* str, bool selected, eJUSTIFY justify = eLeftJustify);
|
2018-11-29 20:09:46 +00:00
|
|
|
void _adjustExtents(CRect& rect, eJUSTIFY justify, const char* str);
|
2018-12-08 01:39:41 +00:00
|
|
|
void _drawMenuSelection(CRect extents, const char* str, int border = 3, int radius = 4);
|
2019-07-20 06:08:43 +00:00
|
|
|
void _drawMenuSelection(const CRect& extents, int border, int radius);
|
2019-03-17 07:10:01 +00:00
|
|
|
void _scrollMessage(int y, const char* str, int& charOffset);
|
2018-12-20 06:29:00 +00:00
|
|
|
void _reqOEMWarning();
|
2019-06-02 09:19:08 +00:00
|
|
|
void _drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t color = WHITE, uint16_t bg = 0xffff);
|
2019-07-27 14:28:39 +00:00
|
|
|
void _showTitle(const char* title);
|
2019-07-27 23:07:29 +00:00
|
|
|
void _showConfirmMessage();
|
|
|
|
void _showStoringMessage();
|
2018-11-25 04:45:17 +00:00
|
|
|
public:
|
|
|
|
CScreen(C128x64_OLED& disp, CScreenManager& mgr);
|
|
|
|
virtual ~CScreen();
|
2018-12-08 04:18:37 +00:00
|
|
|
virtual void onSelect();
|
2019-02-28 08:56:13 +00:00
|
|
|
virtual void onExit();
|
2018-12-01 18:25:10 +00:00
|
|
|
virtual bool animate();
|
2019-01-18 23:06:12 +00:00
|
|
|
virtual bool show();
|
|
|
|
virtual bool keyHandler(uint8_t event) { return false; };
|
2018-11-25 04:45:17 +00:00
|
|
|
};
|
2018-11-23 10:34:37 +00:00
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
|
|
|
|
class CTransientFont {
|
2018-11-29 11:11:50 +00:00
|
|
|
C128x64_OLED& _display;
|
|
|
|
public:
|
2018-12-01 00:36:25 +00:00
|
|
|
CTransientFont(C128x64_OLED& disp, const FONT_INFO* pFont);
|
|
|
|
~CTransientFont();
|
2018-11-29 11:11:50 +00:00
|
|
|
};
|
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
#endif // __SCREEN_H__
|