The Application Kit is the starting point for all applications. Its classes establish an application as an identifiable entity--one that can cooperate and communicate with other applications (including the Tracker). It lays a foundation for the other kits. Before designing and building your application, you should become comfortably familiar with this basic kit.
There are four parts to the Application Kit:
- Messaging. The kit sets up a mechanism through which an application can easily make itself multithreaded and a messaging service that permits the threads to talk to each other. This same service also delivers messages from one application to another--it's used for both inter- and intra-application communication.
- The messaging mechanism is implemented by a set of collaborating classes: BMessage objects bundle information so that it can be posted to a thread within the same application or sent to a thread in another application. BLooper objects run message loops in threads, getting messages as they arrive and dispatching them to BHandler objects. The BHandler's job is to respond to the message.
- The system employs the messaging mechanism to carry basic input to applications--from the keyboard and mouse, from the Tracker, and from other external sources; system messages drive what most applications do. Every application will be on the receiving end of at least some of these messages and must have handlers ready to respond to them.
- Applications can also use the mechanism to create threads with a messaging interface, arrange communication among the threads, or exchange information with and issue commands to other applications.
- The BApplication class. Every application must have a single instance of the BApplication class--or of a class derived from BApplication. This object provides a number of essential services. Foremost among them is that it establishes a connection to the Application Server. The server is a background process that takes over many of the fundamental tasks common to all applications. It renders images in windows, controls the cursor, reports what the user is doing on the keyboard and mouse, and, in general, keeps track of system resources.
- The BApplication object also runs the application's main message loop, where it receives messages that concern the application as a whole. Externally, this object represents the application to other applications; internally, it's the center where applicationwide services and global information can be found. Because of its pivotal role, it's assigned to a global variable, be_app, to make it easily accessible.
- Other kits--the Interface Kit in particular--won't work until a BApplication object has been constructed.
- The BRoster class. The BRoster object keeps track of all running applications. It can identify applications, launch them, and provide the information needed to set up communications with them.
- The BClipboard class. The BClipboard object provides an interface to the clipboard where cut and copied data can be stored, and from which it can be pasted.
The messaging framework is described in the next section, followed by a discussion of scripting, and the BApplication class beginning on page 29. The other classes follow in alphabetical order.
The Be Book, in lovely HTML, for the BeOS Preview Release.
Copyright © 1997 Be, Inc. All rights reserved.
Be is a registered trademark; BeOS, BeBox, BeWare, GeekPort, the Be logo, and the BeOS logo are trademarks of Be, Inc.
Last modified September 18, 1997.