Q3270
A Qt-based 3270 Terminal Emulator
Loading...
Searching...
No Matches
Cell.h
1/*
2 * Q3270 Terminal Emulator
3 *
4 * Copyright (c) 2020–2025 Andy Styles
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * This file is part of Q3270.
8 * See the LICENSE file in the project root for full license information.
9 */
10
11#ifndef CELL_H
12#define CELL_H
13
14#include "Q3270.h"
15#include "Models/Colours.h"
16
17class Cell
18{
19
20public:
21 Cell();
22
23 void setChar(const uchar ebcdic);
24
25 // Inline getters, for speed
26 uchar getEBCDIC() const { return ebcdic; }
27 bool isFieldStart() const { return fieldStart; }
28 bool isAutoSkip() const { return prot & num; }
29 bool isNumeric() const { return num; }
30 bool isGraphic() const { return graphic; }
31 bool isMdtOn() const { return mdt; }
32 bool isPenSelect() const { return pen; }
33 bool isIntensify() const { return intensify; }
34 bool isExtended() const { return extended; }
35
36 bool isUScore() const { return getHighlight() == Q3270::Underscore; }
37 bool isReverse() const { return getHighlight() == Q3270::Reverse; }
38 bool isBlink() const { return getHighlight() == Q3270::Blink; }
39
40 Q3270::Highlight getHighlight() const;
41
42 Q3270::Colour getColour() const;
43
44 bool isProtected() const;
45 bool isDisplay() const;
46
47 Cell* getField();
48
49 bool hasCharAttrs(const Q3270::CharAttr) const;
50
51 // Setters
52 void setField(Cell *c);
53 void setColour(const Q3270::Colour col);
54 void setFieldStart(const bool fs);
55 void setNumeric(const bool num);
56 void setGraphic(const bool ge);
57 void setMDT(const bool mdt);
58 void setProtected(const bool prot);
59 void setDisplay(const bool display);
60 void setPenSelect(const bool pensel);
61 void setIntensify(const bool intens);
62 void setExtended(const bool extend);
63 void setHighlight(const Q3270::Highlight h);
64
65 void setCharAttrs(Q3270::CharAttr, bool);
66 void resetCharAttrs();
67
68 void copy(const Cell &);
69
70 void reset();
71
72private:
73
74 // EBCDIC code for this character
75 uchar ebcdic;
76
77 // Is this a GE character?
78 bool graphic;
79
80 // Is this a field start?
81 bool fieldStart;
82
83 // Field position
84 Cell *field;
85
86 // Field attributes
87 bool num;
88 bool mdt;
89 bool prot;
90 bool display;
91 bool pen;
92 bool intensify;
93
94 /* Extended Attributes */
95 bool extended;
96 Q3270::Highlight highlight;
97
98 /* Character Attributes in effect */
99 bool charAttrExtended;
100 bool charAttrColour;
101 bool charAttrCharSet;
102 bool charAttrTransparency;
103
104 // Colour of glyph
105 Q3270::Colour colNum;
106};
107
108#endif // CELL_H
Definition Cell.h:18
void setMDT(const bool mdt)
Cell::setMDT - switch the MDT flag on or off.
Definition Cell.cpp:191
void setField(Cell *c)
Cell::setField - set this cell's field pointer.
Definition Cell.cpp:278
void setColour(const Q3270::Colour col)
Cell::setColour - set the cell to colour specified.
Definition Cell.cpp:101
void setPenSelect(const bool pensel)
Cell::setPenSelect - set the lightpen-selectable on or off for the cell.
Definition Cell.cpp:238
Q3270::Highlight getHighlight() const
Cell::getHighlight - return the highlight status of this cell.
Definition Cell.cpp:336
Cell()
Cell represents a single character cell on the display matrix and all the attributes that go with tha...
Definition Cell.cpp:33
void setNumeric(const bool num)
Cell::setNumeric - set the cell to be numeric input only.
Definition Cell.cpp:167
void setDisplay(const bool display)
Cell::setDisplay - switch display on or offf for this cell.
Definition Cell.cpp:223
void setFieldStart(const bool fs)
Cell::setFieldStart - set the 'Field' flag to show whether this cell is the start of a field.
Definition Cell.cpp:128
bool isDisplay() const
Cell::isProtected - is this cell protected?
Definition Cell.cpp:66
void setProtected(const bool prot)
Cell::setProtected - switch protection on or off for this cell.
Definition Cell.cpp:211
void setExtended(const bool extend)
Cell::setExtended - set the extended field status.
Definition Cell.cpp:262
void setGraphic(const bool ge)
Cell::setGraphic - set the 'graphic escape' flag.
Definition Cell.cpp:179
void copy(const Cell &)
Cell::copy - copy pertinent parts from another Cell.
Definition Cell.cpp:420
void setCharAttrs(Q3270::CharAttr, bool)
Cell::setCharAttrs - set the characater attribute.
Definition Cell.cpp:356
void setIntensify(const bool intens)
Cell::setIntensify - set the intensity of the cell.
Definition Cell.cpp:250
void resetCharAttrs()
Cell::resetCharAttrs - switch off all character attributes.
Definition Cell.cpp:405
void setHighlight(const Q3270::Highlight h)
Cell::setHighlight - set the highlight of the cell to the specified value.
Definition Cell.cpp:81
bool isProtected() const
Cell::isProtected - return whether this field is protected or not.
Definition Cell.cpp:312
bool hasCharAttrs(const Q3270::CharAttr) const
Cell::hasCharAttrs - return the status of the specified character attribute.
Definition Cell.cpp:381
void setChar(const uchar ebcdic)
Cell::setChar - set the cell to the character specified.
Definition Cell.cpp:90
void reset()
Cell::reset - reset the cell to default values.
Definition Cell.cpp:43
Cell * getField()
Cell::getField - get the address of the field cell that owns this one.
Definition Cell.cpp:291