ScummVM API documentation
mactextwindow.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef GRAPHICS_MACGUI_MACTEXTWINDOW_H
23
#define GRAPHICS_MACGUI_MACTEXTWINDOW_H
24
25
#include "graphics/macgui/macfontmanager.h"
26
#include "graphics/macgui/mactext.h"
27
28
namespace
Graphics
{
29
30
class
MacTextWindow
:
public
MacWindow
{
31
public
:
32
MacTextWindow
(
MacWindowManager
*wm,
const
MacFont
*font,
int
fgcolor,
int
bgcolor,
int
maxWidth,
TextAlign
textAlignment,
MacMenu
*menu,
bool
cursorHandler =
true
);
33
MacTextWindow
(
MacWindowManager
*wm,
const
Font
*font,
int
fgcolor,
int
bgcolor,
int
maxWidth,
TextAlign
textAlignment,
MacMenu
*menu,
bool
cursorHandler =
true
);
34
virtual
~
MacTextWindow
();
35
36
virtual
void
resize(
int
w,
int
h)
override
;
37
void
setDimensions(
const
Common::Rect
&r)
override
;
38
39
virtual
bool
processEvent
(
Common::Event
&event)
override
;
40
41
virtual
bool
draw
(
ManagedSurface
*g,
bool
forceRedraw =
false
)
override
;
42
virtual
bool
draw
(
bool
forceRedraw =
false
)
override
;
43
virtual
void
blit(
ManagedSurface
*g,
Common::Rect
&dest)
override
;
44
45
void
setTextWindowFont(
const
MacFont
*macFont);
46
const
MacFont
*getTextWindowFont();
47
48
void
appendText(
const
Common::U32String
&str,
const
MacFont
*macFont =
nullptr
,
bool
skipAdd =
false
);
49
void
appendText(
const
Common::String
&str,
const
MacFont
*macFont =
nullptr
,
bool
skipAdd =
false
);
50
void
clearText();
51
void
setMarkdownText(
const
Common::U32String
&str);
52
53
void
setEditable(
bool
editable) { _editable = editable; _mactext->setEditable(editable); }
54
void
setSelectable(
bool
selectable) { _selectable = selectable; }
55
56
void
undrawCursor();
57
58
const
Common::U32String
&getInput() {
return
_inputText; }
59
void
clearInput();
60
void
appendInput(
const
Common::U32String
&str);
61
void
appendInput(
const
Common::String
&str);
62
63
Common::U32String
getSelection(
bool
formatted =
false
,
bool
newlines =
true
);
64
void
clearSelection();
65
Common::U32String
cutSelection();
66
const
SelectedText
*getSelectedText() {
return
&_selectedText; }
67
int
getTextHeight() {
return
_mactext->getTextHeight(); }
68
int
getMouseLine(
int
x,
int
y);
69
74
void
setTextColorRGB
(uint32 rgb) { _textColorRGB = rgb; }
75
76
private
:
77
void
init(
bool
cursorHandler);
78
bool
isCutAllowed();
79
80
void
scroll(
int
delta);
81
void
calcScrollBar();
82
83
void
undrawInput();
84
void
drawInput();
85
void
drawSelection();
86
void
updateCursorPos();
87
88
void
startMarking(
int
x,
int
y);
89
void
updateTextSelection(
int
x,
int
y);
90
91
public
:
92
int
_cursorX, _cursorY;
93
bool
_cursorState;
94
95
bool
_cursorDirty;
96
Common::Rect
*_cursorRect;
97
bool
_cursorOff;
98
bool
_editable;
99
bool
_selectable;
100
101
int
_scrollPos;
102
103
private
:
104
MacText
*_mactext;
105
const
MacFont
*_font;
106
const
Font
*_fontRef;
107
108
ManagedSurface
*_cursorSurface;
109
110
bool
_inTextSelection;
111
SelectedText
_selectedText;
112
113
int
_maxWidth;
114
Common::U32String
_inputText;
115
uint _inputTextHeight;
116
bool
_inputIsDirty;
117
118
MacMenu
*_menu;
119
120
int
_bgcolor;
121
int
_textColorRGB;
122
};
123
124
}
// End of namespace Graphics
125
126
#endif
Graphics::ManagedSurface
Definition:
managed_surface.h:51
Common::String
Definition:
str.h:59
Graphics::Font
Definition:
font.h:83
Graphics::TextAlign
TextAlign
Definition:
font.h:48
Graphics::MacTextWindow::draw
virtual bool draw(ManagedSurface *g, bool forceRedraw=false) override
Graphics::MacText
Definition:
mactext.h:47
Graphics::MacWindow
Definition:
macwindow.h:192
Graphics::MacTextWindow
Definition:
mactextwindow.h:30
Common::Rect
Definition:
rect.h:144
Graphics::MacWindowManager
Definition:
macwindowmanager.h:149
Graphics::MacTextWindow::processEvent
virtual bool processEvent(Common::Event &event) override
Common::U32String
Definition:
ustr.h:57
Common::Event
Definition:
events.h:199
Graphics
Definition:
formatinfo.h:28
Graphics::MacMenu
Definition:
macmenu.h:94
Graphics::SelectedText
Definition:
mactext.h:29
Graphics::MacFont
Definition:
macfontmanager.h:106
Graphics::MacTextWindow::setTextColorRGB
void setTextColorRGB(uint32 rgb)
Definition:
mactextwindow.h:74
graphics
macgui
mactextwindow.h
Generated on Wed Dec 18 2024 09:23:32 for ScummVM API documentation by
1.8.13