Graphics Reference
In-Depth Information
MainEventLoop : We, as GUI programmers, are users of this function. We can-
not change this function.
GUISystem :: MainEventLoop () {
// This will call the user defined function
(A): SystemInitialization()
(B): loop forever {
// stop and wait for the next event
(C): WaitFor ( GUISystem ::NextEvent) {
(D): switch ( GUISystem ::NextEvent) {
(D1): case GUISystem ::LeftMouseButtonDown:
if (user application registered for this event)
Invoke LeftMouseButtonDownServiceRoutine( currentMousePosition )
else
Execute default GUISystem routine.
(D2): case GUISystem ::LeftMouseButtonDrag:
if (user application registered for this event)
Invoke LeftMouseButtonDragServiceRoutine( currentMousePosition )
else
Execute default GUISystem routine.
(D3): case GUISystem ::LeftMouseButtonUp:
if (user application registered for this event)
Invoke LeftMouseButtonUpServiceRoutine( currentMousePosition )
else
Execute default GUISystem routine.
// There are many other events that do not concern us
.
} // end of switch(GUISystem::NextEvent)
} // end of loop forever
} // end of GUISystem::MainEventLoop() function. Program terminates.
Listing 1.5. MainEventLoop() to which our solution links.
Search WWH ::




Custom Search