Webmaster  |  Imprint 
Platinum
Platinum C++ Framework
Main  |  License  |  Documentation  |  Download  |  Support 

Application Class Reference

An interface that can be implemented by application classes that want to provide an event loop for applications with or without a GUI. More...

#include <Pt/Gui/Application.h>

Inheritance diagram for Application:

Connectable

List of all members.

Public Member Functions

 Application ()
 Initializes this application.
 ~Application ()
 Deletes the platform specific Application object.
ApplicationImpl & impl ()
 Returns a reference to the platform specific Application object.
void commitEvent (const Pt::Event &event)
void queueEvent (const Pt::Event &event)
void processEvents ()
int run ()
void exit ()
void dispatchEvent (const Pt::Event &ev) const
 Receives GUI events for widgets and delivers them to the widget.

Public Attributes

Signal< const Pt::Event & > event
 The signal to which slots can register themselves to listen for any event that is committed to this application's event loop.


Detailed Description

This interface provides methods for running and stopping the application, for adding and processing of events and a signal (event) to which slots can be connected to listen for events that are sent to the event queue.

A class that implements this interface may contain a main event loop, where event sources can be registered and events from those sources are dispatched to listeners, that were registered to the event loop. Events may for example be operating system events (timer, file system changes) or gui-specific events (like repaint, mouse events).

The application and therefore the event loop is started with a call to run() and can be exited with a call to exit(). After calling exit() the application should terminate.

Events can be committed by calling commitEvent(). Long running operations can call processEvents() to keep the application responsive.


Constructor & Destructor Documentation

Application (  ) 

Creates the platform specific Application object and stores it in _impl. Connects the event signal to dispatchEvent().


Member Function Documentation

void dispatchEvent ( const Pt::Event ev  )  const

General events which are sent to the 'event' signal of ptv::Application are passed to this method. If the event is a GUI event, it is sent to the method Widget::event(). From there it may be dispatched to more specific event handling methods. If the event is not a GUI event, it is ignored.

Parameters:
event An event that will be dispatched to the corresponding widget.

Copyright © 2003-2007 The Pt Development Team
Pt 1.0