Refactor inputhook to allow easy extension

Not ready for merge

Prompted by #5645, @minrk suggested that we should provide an extension mechanism for input hooks, so that that code (which we don't use, test or maintain very much) can be maintained outside IPython. This is a prototype of that.

To define a new GUI integration, you register a class like this:

```python
from IPython.lib.inputhook import register, InputHookBase

@register('clutter')
class ClutterInputHook(InputHookBase):
    def enable(self, app=None):
        self.manager.set_inputhook(inputhook_clutter)
```

It can also define a `disable()` method, but only one of the 7 we include needs that. Once this code has run (e.g. by importing a module or using `%load_ext`), the user should be able to do `%gui clutter`.

To do:

- [x] Similar mechanisms for the kernel event loop
- [x] Docs

A deprecation is fine, if we can figure it out. Some further explanation: this key is only defined because `enable_matplotlib('foo')` implies `enable_gui('foo')`. Nothing needs to be done for OS X eventloop integration, but the key needs to be defined in order for `enable_matplotlib('osx')` to pass. If there's a better way to express 'this matplotlib backend doesn't actually need eventloop integration' beyond a null function in the dict, then that would be fine, too. But `enable_matplotlib('osx')` does need to work, and it doesn't, currently.