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::setText(const std::string& takeText)
56 void WTextbox::setForegroundColour(const DrawStyle& fcolour)
66 if (paraMode) rem_scroll_line = drawPara(text.c_str(), textX, textY, foreColour, cur_scroll_line);
67 else drawText(text.c_str(), textX, textY, foreColour);
71 void WTextbox::setTextPos(int x, int y)
77 int WTextbox::handleCommand(int command)
83 if (cur_scroll_line > 0)
91 return 4; // Signal return control to parent
96 if (rem_scroll_line > 0)
117 bool WTextbox::mouseAndroidScroll(int x, int y, int /* sx */, int sy)
119 if ( (x - getRootBoxOffsetX()) >= 0
120 && (y - getRootBoxOffsetY()) >= 0
121 && (x - getRootBoxOffsetX()) <= toi4(area.w)
122 && (y - getRootBoxOffsetY()) <= toi4(area.h)
125 int change = -sy /120;
128 int rel_change = min(cur_scroll_line, -change);
129 cur_scroll_line-=rel_change;
130 rem_scroll_line+=rel_change;
134 int rel_change = min(rem_scroll_line, change);
135 cur_scroll_line += rel_change;
136 rem_scroll_line -= rel_change;