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,
bool scrollBar =
false);
58 virtual void resize(
int w,
int h);
61 bool needsRedraw()
override {
return _contentIsDirty || _cursorDirty; }
63 WindowClick isInScrollBar(
int x,
int y)
const;
64 void setScrollBar(
bool enable);
65 void resizeScrollBar(
int w,
int h);
67 void setAutoSelect(
bool enable) { _autoSelect = enable; }
71 void draw(
ManagedSurface *g,
int x,
int y,
int w,
int h,
int xoff,
int yoff);
73 bool draw(
bool forceRedraw =
false)
override;
78 int getInterLinear() {
return _canvas._interLinear; }
79 void setInterLinear(
int interLinear);
80 void setMaxWidth(
int maxWidth);
81 void setDefaultFormatting(uint16 fontId, byte textSlant, uint16 fontSize,
82 uint16 palinfo1, uint16 palinfo2, uint16 palinfo3);
83 const MacFontRun &getDefaultFormatting() {
return _defaultFormatting; }
86 TextAlign getAlign() {
return _canvas._textAlignment; }
88 void setActive(
bool active)
override;
89 void setEditable(
bool editable);
91 void setColors(uint32 fg, uint32 bg)
override;
93 void setTextColor(uint32 color, uint32 line);
94 void setTextColor(uint32 color, uint32 start, uint32 end);
96 void appendText(
const Common::U32String &str,
int fontId = kMacFontSystem,
int fontSize = 12,
int fontSlant = kMacFontRegular,
bool skipAdd =
false);
97 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);
98 void appendText(
const Common::U32String &str,
const Font *font, uint16 r = 0, uint16 g = 0, uint16 b = 0,
bool skipAdd =
false);
100 int getTextFont() {
return _defaultFormatting.fontId; }
101 void enforceTextFont(uint16 fontId);
106 int getTextSize() {
return _defaultFormatting.fontSize; }
107 void setTextSize(
int textSize);
109 int getTextSize(
int start,
int end);
110 void setTextSize(
int textSize,
int start,
int end);
112 uint32 getTextColor() {
return _defaultFormatting.fgcolor; }
113 uint32 getTextColor(
int start,
int end);
115 int getTextFont(
int start,
int end);
116 void setTextFont(
int fontId,
int start,
int end);
118 int getTextSlant() {
return _defaultFormatting.textSlant; }
119 int getTextSlant(
int start,
int end);
120 void setTextSlant(
int textSlant,
int start,
int end);
121 void enforceTextSlant(
int textSlant);
124 int getMouseChar(
int x,
int y);
125 int getMouseWord(
int x,
int y);
126 int getMouseItem(
int x,
int y);
127 int getMouseLine(
int x,
int y);
130 bool setImageArchive(
const Common::Path &name) {
return _canvas._imageArchive.setImageArchive(name); }
134 void setTextChunks(
int start,
int end,
int param,
void (*callback)(
MacFontRun &,
int));
137 void deletePreviousCharInternal(
int *row,
int *col);
138 void insertTextFromClipboard();
143 void appendTextDefault(
const Common::String &str,
bool skipAdd =
false);
145 void removeLastLine();
146 int getLineCount() {
return _canvas._text.size(); }
147 int getLastLineWidth();
148 int getTextHeight() {
return _canvas._textMaxHeight; }
149 int getLineHeight(
int line);
150 int getTextMaxWidth() {
return _canvas._textMaxWidth; }
154 void setFixDims(
bool fixed) { _fixedDims = fixed; }
155 bool getFixDims() {
return _fixedDims; }
157 void deleteSelection();
158 void deletePreviousChar(
int *row,
int *col);
159 void addNewLine(
int *row,
int *col);
160 void insertChar(byte c,
int *row,
int *col);
162 void getChunkPosFromIndex(
int index, uint &lineNum, uint &chunkNum, uint &offset);
163 void getRowCol(
int x,
int y,
int *sx,
int *sy,
int *row,
int *col,
int *chunk_ =
nullptr);
164 void getLineCharacter(
int x,
int y,
int *sx,
int *sy,
int *line,
int *character,
int *chunk_ =
nullptr);
165 Common::U32String getTextChunk(
int startRow,
int startCol,
int endRow,
int endCol,
bool formatted =
false,
bool newlines =
true);
168 uint getSelectionIndex(
bool start);
169 void clearSelection();
171 const SelectedText *getSelectedText() {
return &_selectedText; }
172 bool hasSelection() {
return _selectedText.endY != -1; }
174 int getLineSpacing() {
return _canvas._interLinear; }
181 void setSelection(
int pos,
bool start);
187 void setSelRange(
int selStart,
int selEnd);
189 void scroll(
int delta);
196 void init(uint32 fgcolor, uint32 bgcolor,
int maxWidth,
TextAlign textAlignment,
int interlinear, uint16 textShadow,
bool macFontMode);
201 void drawSelection(
int xoff,
int yoff);
202 void updateCursorPos();
204 void startMarking(
int x,
int y);
205 void updateTextSelection(
int x,
int y);
210 void clearChunkInput();
213 int _cursorX, _cursorY;
215 int _cursorRow, _cursorCol;
249 bool _inTextSelection;
251 bool _selectionIsDirty;
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:147
Definition: mactext-canvas.h:110
Definition: formatinfo.h:28
Definition: macfontmanager.h:106
Definition: macwindowborder.h:80