Another slight nitpick, but since you're refactoring : call it setFocus(bool focused) if it takes an argument, or focus() if it doesn't, and assumes focused = yes (in which case you need an "unfocus" that assumes focused = false).