Documentation ¶
Overview ¶
Package event provides classes and interfaces to implement event senders and receivers.
There are also some types of events, but these only serve as examples and are not thought through.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseEvt ¶
type CloseEvt struct {
Evt
}
A CloseEvt is sent before the window is closed, so that a user may take some action before it is closed finally.
type DisplayRequest ¶
type DisplayRequest struct {
Sender string
}
DisplayRequest is an event that is sended, whenever a widget wants to be displayed on the screen. In most cases this would be to update it's representation.
func (*DisplayRequest) String ¶
func (d *DisplayRequest) String() string
type Event ¶
type Event interface { // Sender of the event. This is implemented as a string, // because it's great for debugging and possible network // implementations. Sender() string }
Event is the basic interface for all events.
type Evt ¶
type Evt struct {
SenderId string
}
Evt is an implementation of the event interface. It's main purpose is to simplify the creation of other types of events.
type ExposeEvt ¶
An ExposeEvt is sent when the window is shown to the user (open window, resize, show after hide).
type PointerEvt ¶
type PointerEvt struct { Evt Type PointerEvtType State PointerState X int Y int }
PointerEvt represents a typical pointer event. The idea is that a programmer should not worry about what kind of pointer device is being used. When thinking of pointers the mouse immediately comes to the mind of most people, but there are many other kinds of pointer devices:
- Human finger
- Foot mouse
- Graphics tablet
- Trackball
- Roll bar mouse
- Eye tracker
- Remote control for smart TV
- Electronic gun in combat simulation area.
Unfortunately there are always some clever programmers around who try to utilize mouse events for special purposes. This often messes up user experience for non mouse users. The result may be some poor pilot shooting down a jumbo jet by accident.
type PointerEvtType ¶
type PointerEvtType int
const ( PointerMoveEvt PointerEvtType = iota PointerTouchEvt PointerUntouchEvt )
type PointerState ¶
type PointerState int
const ( PointerStateNone PointerState = iota PointerStateTouch )
type Receiver ¶
type Receiver interface { ListenTo(sender Sender) UnlistenTo(sender Sender) ReceiveEvent(evt interface{}) SetEvtHandler(handler func(evt interface{})) SetEvtChanHandler(handler func(evtChan <-chan interface{})) }
Receiver is the basic interface that every event receiver must satisfy.
Received events are handled by an event handler function, that gets the events directly through it's argument, or through a channel of events.
func NewReceiver ¶
func NewReceiver() Receiver