Restructured handling of gui events

Button clicks etc. are now handled with the GuiEvents class, which
contains a GuiEvent for every GuiElement that has any actions attached
to it.