Implement scrollbars

- They work almost as you'd expect, though holding the mouse down on an arrow only scrolls once, and it's a little jerky
- Add an additional refresh option to redraw_screen, currently only partially implemented
- Scrollbars now have a page size in addition to pos and max
- cControl::handleClick() now takes the location clicked as a parameter, though the default implementation doesn't use it
- cControl::handleClick() is no longer responsible for redrawing the control when there is no parent dialog
- Fix cTextMsg not allowing retrieval of frame style
This commit is contained in:
2014-04-17 11:32:43 -04:00
parent b960139d6b
commit 369c7f9f93
13 changed files with 194 additions and 146 deletions

View File

@@ -178,18 +178,14 @@ void cControl::setActive(bool active) {
depressed = active;
}
bool cControl::handleClick(){
bool cControl::handleClick(location where){
sf::Event e;
bool done = false, clicked = false;
inWindow->setActive();
depressed = true;
while(!done){
// If there's no parent dialog, we're not responsible for redrawing
if(parent) parent->draw();
else {
// TODO: This only redraws this one control; should probably redraw the entire dialog? But what if there is no dialog?
draw();
inWindow->display();
}
if(!inWindow->pollEvent(e)) continue;
if(e.type == sf::Event::MouseButtonReleased){
done = true;
@@ -207,11 +203,6 @@ bool cControl::handleClick(){
}
else sf::sleep(time_in_ticks(14));
if(parent) parent->draw();
else {
// TODO: This only redraws this one control; should probably redraw the entire dialog? But what if there is no dialog?
draw();
inWindow->display();
}
return clicked;
}