2 Copyright 2005 Brian Walton
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
25 WTextbox::WTextbox(const char* takeText):
26 foreColour(DrawStyle::LIGHTTEXT)
28 // int fontHeight = Surface::getFontHeight();
29 //setDimensions(70, fontHeight);
30 //setDimensions(100,100);
38 if (takeText) setText(takeText);
41 void WTextbox::setParaMode(bool mode)
46 void WTextbox::setText(const char* takeText)
51 void WTextbox::setForegroundColour(const DrawStyle& fcolour)
61 if (paraMode) rem_scroll_line = drawPara(text.c_str(), textX, textY, foreColour, cur_scroll_line);
62 else drawText(text.c_str(), textX, textY, foreColour);
66 void WTextbox::setTextPos(int x, int y)
72 int WTextbox::handleCommand(int command)
78 if (cur_scroll_line > 0)
86 return 4; // Signal return control to parent
91 if (rem_scroll_line > 0)
112 bool WTextbox::mouseAndroidScroll(int x, int y, int /* sx */, int sy)
114 if ( (x - getRootBoxOffsetX()) >= 0
115 && (y - getRootBoxOffsetY()) >= 0
116 && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
117 && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
120 int change = -sy /120;
123 int rel_change = min(cur_scroll_line, -change);
124 cur_scroll_line-=rel_change;
125 rem_scroll_line+=rel_change;
129 int rel_change = min(rem_scroll_line, change);
130 cur_scroll_line += rel_change;
131 rem_scroll_line -= rel_change;