Files
pip/libs/main/console/piscreenconsole.h
2026-03-07 17:00:45 +03:00

99 lines
3.6 KiB
C++

/*! \file piscreenconsole.h
* \ingroup Console
* \~\brief
* \~english Console-oriented tiles built on top of %PIScreen
* \~russian Консольно-ориентированные тайлы, построенные поверх %PIScreen
*/
/*
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"
//! \ingroup Console
//! \~\brief
//! \~english Reserved tile type for displaying named variables on a screen.
//! \~russian Зарезервированный тип тайла для отображения именованных переменных на экране.
class PIP_CONSOLE_EXPORT TileVars: public PIScreenTile {
public:
//! \~english Constructs a variable-view tile.
//! \~russian Создает тайл просмотра переменных.
TileVars(const PIString & n = PIString());
protected:
//! \~english One variable entry used by the tile layout.
//! \~russian Одна запись переменной, используемая раскладкой тайла.
struct PIP_CONSOLE_EXPORT Variable {
//! \~english Constructs an empty variable descriptor.
//! \~russian Создает пустой дескриптор переменной.
Variable() {
nx = ny = type = offset = bitFrom = bitCount = size = 0;
format = PIScreenTypes::CellFormat();
ptr = 0;
}
//! \~english Returns `true` when the descriptor is not bound to data.
//! \~russian Возвращает `true`, если дескриптор не привязан к данным.
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;
}*/
};
PIVector<Variable> variables;
PIScreenTypes::Alignment alignment;
void sizeHint(int & w, int & h) const override;
void drawEvent(PIScreenDrawer * d) override;
};
//! \ingroup Console
//! \~\brief
//! \~english Minimal base tile for console-oriented screen integrations.
//! \~russian Минимальный базовый тайл для консольно-ориентированных экранных интеграций.
class PIP_CONSOLE_EXPORT PIScreenConsoleTile: public PIScreenTile {
public:
//! \~english Constructs a console-oriented screen integration tile.
//! \~russian Создает тайл консольно-ориентированной экранной интеграции.
PIScreenConsoleTile();
};
#endif // PISCREENCONSOLE_H