22 #ifndef GRAPHICS_MACGUI_MACTEXT_H 23 #define GRAPHICS_MACGUI_MACTEXT_H 25 #include "graphics/macgui/mactext-canvas.h" 32 int startRow, startCol;
38 startRow = startCol = -1;
43 return startX != endX || startY != endY;
49 MacText(
MacWidget *parent,
int x,
int y,
int w,
int h,
MacWindowManager *wm,
const Common::U32String &s,
const MacFont *font, uint32 fgcolor, uint32 bgcolor,
int maxWidth,
TextAlign textAlignment =
kTextAlignLeft,
int interlinear = 0, uint16 border = 0, uint16 gutter = 0, uint16 boxShadow = 0, uint16 textShadow = 0,
bool fixedDims =
true);
58 virtual void resize(
int w,
int h);
61 bool needsRedraw()
override {
return _contentIsDirty || _cursorDirty; }
65 void draw(
ManagedSurface *g,
int x,
int y,
int w,
int h,
int xoff,
int yoff);
67 bool draw(
bool forceRedraw =
false)
override;
72 int getInterLinear() {
return _canvas._interLinear; }
73 void setInterLinear(
int interLinear);
74 void setMaxWidth(
int maxWidth);
75 void setDefaultFormatting(uint16 fontId, byte textSlant, uint16 fontSize,
76 uint16 palinfo1, uint16 palinfo2, uint16 palinfo3);
77 const MacFontRun &getDefaultFormatting() {
return _defaultFormatting; }
80 TextAlign getAlign() {
return _canvas._textAlignment; }
82 void setActive(
bool active)
override;
83 void setEditable(
bool editable);
85 void setColors(uint32 fg, uint32 bg)
override;
87 void setTextColor(uint32 color, uint32 line);
88 void setTextColor(uint32 color, uint32 start, uint32 end);
90 void appendText(
const Common::U32String &str,
int fontId = kMacFontSystem,
int fontSize = 12,
int fontSlant = kMacFontRegular,
bool skipAdd =
false);
91 void appendText(
const Common::U32String &str,
int fontId = kMacFontSystem,
int fontSize = 12,
int fontSlant = kMacFontRegular, uint16 r = 0, uint16 g = 0, uint16 b = 0,
bool skipAdd =
false);
92 void appendText(
const Common::U32String &str,
const Font *font, uint16 r = 0, uint16 g = 0, uint16 b = 0,
bool skipAdd =
false);
94 int getTextFont() {
return _defaultFormatting.fontId; }
95 void enforceTextFont(uint16 fontId);
98 int getTextSize() {
return _defaultFormatting.fontSize; }
99 void setTextSize(
int textSize);
101 int getTextSize(
int start,
int end);
102 void setTextSize(
int textSize,
int start,
int end);
104 uint32 getTextColor() {
return _defaultFormatting.fgcolor; }
105 uint32 getTextColor(
int start,
int end);
107 int getTextFont(
int start,
int end);
108 void setTextFont(
int fontId,
int start,
int end);
110 int getTextSlant(
int start,
int end);
111 void setTextSlant(
int textSlant,
int start,
int end);
112 void enforceTextSlant(
int textSlant);
115 int getMouseChar(
int x,
int y);
116 int getMouseWord(
int x,
int y);
117 int getMouseItem(
int x,
int y);
118 int getMouseLine(
int x,
int y);
121 bool setImageArchive(
const Common::Path &name) {
return _canvas._imageArchive.setImageArchive(name); }
125 void setTextChunks(
int start,
int end,
int param,
void (*callback)(
MacFontRun &,
int));
128 void deletePreviousCharInternal(
int *row,
int *col);
129 void insertTextFromClipboard();
134 void appendTextDefault(
const Common::String &str,
bool skipAdd =
false);
136 void removeLastLine();
137 int getLineCount() {
return _canvas._text.size(); }
138 int getLastLineWidth();
139 int getTextHeight() {
return _canvas._textMaxHeight; }
140 int getLineHeight(
int line);
141 int getTextMaxWidth() {
return _canvas._textMaxWidth; }
145 void setFixDims(
bool fixed) { _fixedDims = fixed; }
146 bool getFixDims() {
return _fixedDims; }
148 void deleteSelection();
149 void deletePreviousChar(
int *row,
int *col);
150 void addNewLine(
int *row,
int *col);
151 void insertChar(byte c,
int *row,
int *col);
153 void getChunkPosFromIndex(
int index, uint &lineNum, uint &chunkNum, uint &offset);
154 void getRowCol(
int x,
int y,
int *sx,
int *sy,
int *row,
int *col,
int *chunk_ =
nullptr);
155 Common::U32String getTextChunk(
int startRow,
int startCol,
int endRow,
int endCol,
bool formatted =
false,
bool newlines =
true);
158 uint getSelectionIndex(
bool start);
159 void clearSelection();
161 const SelectedText *getSelectedText() {
return &_selectedText; }
163 int getLineSpacing() {
return _canvas._interLinear; }
170 void setSelection(
int pos,
bool start);
176 void setSelRange(
int selStart,
int selEnd);
178 void scroll(
int delta);
185 void init(uint32 fgcolor, uint32 bgcolor,
int maxWidth,
TextAlign textAlignment,
int interlinear, uint16 textShadow,
bool macFontMode);
190 void drawSelection(
int xoff,
int yoff);
191 void updateCursorPos();
193 void startMarking(
int x,
int y);
194 void updateTextSelection(
int x,
int y);
199 void clearChunkInput();
202 int _cursorX, _cursorY;
204 int _cursorRow, _cursorCol;
235 bool _inTextSelection;
Definition: managed_surface.h:51
TextAlign
Definition: font.h:48
Align the text to the left.
Definition: font.h:51
Definition: mactext-canvas.h:32
Definition: macwindowmanager.h:149
Definition: mactext-canvas.h:110
Definition: formatinfo.h:28
Definition: macfontmanager.h:106