Todays slow svn makes it somewhat difficult for me to check for recent changes to the gui, but I checked my local version here and stumpled upon something which would be easy to change, but all gui-element files would have to be checked.
Nearly all guielements have the following common functionality in OnEvent.
1. In the first lines they check if they are enabled. Usually like that:
Code: Select all
if (!IsEnabled)
return Parent ? Parent->OnEvent(event) : false;
2. As last line they pass the event to the parent like:
Code: Select all
return Parent ? Parent->OnEvent(event) : false;
Well, actually a few elements still miss the first step. Those are: CGUIColorSelectDialog, CGUIComboBox, CGUIFileOpenDialog, CGUIListBox, CGUIMessageBox, CGUIModalScreen (which should also ignore events when !IsVisible), CGUIScrollBar, CGUISpinBox (my fault...), CGUIToolBar (but not sure if it would be needed there), CGUIWindow (a little tricky because of focus things).It's btw. ok in CGUIEditBox and CGUITable as it's checked there later on and the check is just done the other way round in CGUICheckBox.
But the exact same check is also done in IGUIElement. And I think it would generally be the cleaner way to replace those lines in all(!) gui-elements (including CGUIEnvironment) by the following (which is already done in some elements):
Code: Select all
// do first check only in those elements which care about IsEnabled
if (!IsEnabled)
return IGUIElement::OnEvent(event);
// ... event stuff
return IGUIElement::OnEvent(event);
That way we can even add further code to IGUIElement::OnEvent and can be sure it's called (unless explicitly forbidden). Which is actually the functionality which I had needed and why I stumpled upon this ;-)
edit: forgot one thing (which I also didn't fix in my local version yet). Probably the same call should be done in all places where return false is currently use - not just at the start and end of OnEvent.