Lots of little tweaks and fixes to various things, mostly dialog stuff.

- LED groups now trigger their own click handler in addition to the clicked LED's click handler (provided the latter returns true). If the handler returns false, the click has no effect.
- LED groups now cancel the selection change if their focus handler returns false; this mimics the behaviour when an individual LED's focus handler returns false.
- Move the dialog getResult() definitions inline - since there's only two of them now that I'm using boost::any, having them in a separate file is pointless.
- Changed how the pict choice dialog returns its result - now it returns only whether the user clicked cancel and provides getters to obtain the number and type.
- Pict and string choice dialogs now hide the arrow buttons when there is only one page of options.
- Fix pict choice dialog always returning the initially selected value (similar to how the string choice dialog did before I fixed it)
- When passed an invalid starting selection, the pict choice dialog now always starts with the first icon selected
- Fix wrong bounds for several typs of custom graphics in dialogs
- Fix wrong /source/ bounds for custom 28x36 graphics /everywhere in the game/.
- Fix select PC graphic dialog having a second page with an invalid graphic that can be selected.
This commit is contained in:
2014-12-05 23:48:07 -05:00
parent 4db81f1403
commit 56f73cb156
15 changed files with 128 additions and 107 deletions

View File

@@ -1152,6 +1152,7 @@ bool cDialog::toast(bool triggerFocus){
}
bool cDialog::setFocus(cTextField* newFocus, bool force) {
// TODO: Should check that there IS a currently focused field (which might not be the case if there are no fields at all).
if(!force) {
if(!this->getControl(currentFocus).triggerFocusHandler(*this, currentFocus, true)) return false;
}
@@ -1255,6 +1256,8 @@ std::string cDialog::process_keystroke(cKey keyHit){
}
std::string cDialog::process_click(location where){
// TODO: Return list of all controls whose bounding rect contains the clicked point.
// Then the return value of the click handler can mean "Don't pass this event on to other things below me".
ctrlIter iter = controls.begin();
while(iter != controls.end()){
if(iter->second->isVisible() && iter->second->isClickable() && where.in(iter->second->getBounds())){