126 lines
3.8 KiB
C++
126 lines
3.8 KiB
C++
//! \file piscreenconsole.h
|
||
//! \ingroup Console
|
||
//! \brief
|
||
//! \~english Tile for PIScreen with PIConsole API
|
||
//! \~russian Тайл для PIScreen с API PIConsole
|
||
//! \details
|
||
//! \~english Provides tiles for displaying variable data and console-like content.
|
||
//! \~russian Обеспечивает тайлы для отображения данных переменных и консольного контента.
|
||
/*
|
||
PIP - Platform Independent Primitives
|
||
Tile for PIScreen with PIConsole API
|
||
Andrey Bychkov work.a.b@yandex.ru
|
||
|
||
This program is free software: you can redistribute it and/or modify
|
||
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
|
||
|
||
You should have received a copy of the GNU Lesser General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
*/
|
||
|
||
#ifndef PISCREENCONSOLE_H
|
||
#define PISCREENCONSOLE_H
|
||
|
||
#include "pip_console_export.h"
|
||
#include "piscreentiles.h"
|
||
|
||
/// NOTE: incomplete class
|
||
/// TODO: write TileVars
|
||
|
||
//! \brief
|
||
//! \~english Tile for displaying variable data
|
||
//! \~russian Тайл для отображения данных переменных
|
||
|
||
//! \addtogroup Console
|
||
//! \{
|
||
|
||
//! \brief
|
||
//! \~english Tile for displaying variable data
|
||
//! \~russian Тайл для отображения данных переменных
|
||
class PIP_CONSOLE_EXPORT TileVars: public PIScreenTile {
|
||
public:
|
||
//! \brief
|
||
//! \~english Constructs TileVars
|
||
//! \~russian Создает TileVars
|
||
//! \param n Tile name / Имя тайла
|
||
explicit TileVars(const PIString & n = PIString());
|
||
|
||
protected:
|
||
//! \brief Variable data structure
|
||
struct PIP_CONSOLE_EXPORT Variable {
|
||
Variable() {
|
||
nx = ny = type = offset = bitFrom = bitCount = size = 0;
|
||
format = PIScreenTypes::CellFormat();
|
||
ptr = 0;
|
||
}
|
||
|
||
//! \brief
|
||
//! \~english Checks if variable is empty
|
||
//! \~russian Проверяет, пустая ли переменная
|
||
bool isEmpty() const { return (ptr == 0); }
|
||
PIString name;
|
||
PIScreenTypes::CellFormat format;
|
||
int nx;
|
||
int ny;
|
||
int type;
|
||
int offset;
|
||
int bitFrom;
|
||
int bitCount;
|
||
int size;
|
||
const void * ptr;
|
||
/*void operator =(const Variable & src) {
|
||
name = src.name;
|
||
format = src.format;
|
||
nx = src.nx;
|
||
ny = src.ny;
|
||
type = src.type;
|
||
offset = src.offset;
|
||
bitFrom = src.bitFrom;
|
||
bitCount = src.bitCount;
|
||
size = src.size;
|
||
ptr = src.ptr;
|
||
}*/
|
||
};
|
||
|
||
//! \brief
|
||
//! \~english Returns variables
|
||
//! \~russian Возвращает переменные
|
||
PIVector<Variable> variables;
|
||
PIScreenTypes::Alignment alignment;
|
||
|
||
//! \brief
|
||
//! \~english Calculates tile size hint
|
||
//! \~russian Вычисляет рекомендуемый размер тайла
|
||
void sizeHint(int & w, int & h) const override;
|
||
|
||
//! \brief
|
||
//! \~english Draws tile content
|
||
//! \~russian Рисует содержимое тайла
|
||
void drawEvent(PIScreenDrawer * d) override;
|
||
};
|
||
|
||
|
||
//! \brief
|
||
//! \~english Console-style tile for PIScreen
|
||
//! \~russian Консольный тайл для PIScreen
|
||
|
||
//! \brief
|
||
//! \~english Console-style tile for PIScreen
|
||
//! \~russian Консольный тайл для PIScreen
|
||
class PIP_CONSOLE_EXPORT PIScreenConsoleTile: public PIScreenTile {
|
||
public:
|
||
//! \brief
|
||
//! \~english Constructs PIScreenConsoleTile
|
||
//! \~russian Создает PIScreenConsoleTile
|
||
explicit PIScreenConsoleTile();
|
||
};
|
||
|
||
#endif // PISCREENCONSOLE_H
|