Common Desktop Environment: Programmer's Overview

# 3 Developing an Application

Contents of Chapter:

Levels of Desktop Integration

Desktop Naming Conventions

Public and Private Interfaces

Guidelines for Common Desktop Environment Databases

Application Initialization and libDtSvc

Application Builder
  Demo Programs

This chapter presents information specific to developing a Common Desktop Environment application, such as naming conventions and other guidelines. It introduces levels of integration, which are the guidelines for determining the desktop functionality to incorporate into your application to make it increasingly integrated with the desktop. It also provides an overview of the Application Builder, a tool to simplify Common Desktop Environment application development.

## Levels of Desktop Integration

Users can run any X11-based application from a shell command line in the Common Desktop Environment. If you want to integrate your application into the desktop, however, there are guidelines for you to follow. The Common Desktop Environment defines three levels of integration to give you maximum flexibility in designing your application or porting an existing application:

- Basic Integration --Enables your application to be launched from the desktop. You do not need to change your application code to perform basic integration. See Chapter 5, "Basic Application Integration," for more information.

- Recommended Integration --Enables your application to enhance its level of consistency with the desktop. See Chapter 6, "Recommended Integration," for more information.

- Optional Integration --Enables you to leverage services provided by the desktop for achieving specialized tasks. See Chapter 7, "Optional Integration," for more information.

For more information on all three levels of integration, see the CDE Programmer's Guide . Basic Integration is also discussed in the CDE Advanced User's and System Administrator's Guide .

## Desktop Naming Conventions

The Common Desktop Environment uses naming conventions similar to those used by X and Motif. Desktop clients, desktop libraries, and other desktop components share a common prefix for externally visible names: `dt` , `Dt` , or `DT` . Private desktop structures, functions, and defines (found in the Common Desktop Environment code; not for developer use) have an `_dt` , `_Dt` , or `_DT` prefix. Table 3-1 lists the desktop naming conventions.

Table 3-1 Desktop Naming Conventions

Table 3-2 lists the exceptions to the preceding naming conventions.

Table 3-2 Exceptions to Desktop Naming Conventions

Caution: Do not use the prefixes `dt` , `Dt` , `DT` , `_dt` , `_Dt` , `_DT` , `Xm` , `tt` , `Tt` , `TT` , `X` , or `Xt` to define new symbols in your application code . If you do, you might define one that has already been defined--or might be defined in the future--in the Common Desktop Environment, ToolTalk, X11R5, or Motif code.

## Public and Private Interfaces

If a Common Desktop Environment interface is documented in the man pages or the Common Desktop Environment documentation set, you can assume that the interface is public unless otherwise stated. An interface is not necessarily public just because it has a header file associated with it. Interfaces that are not documented are private to the Common Desktop Environment and are subject to change without notice.

## Guidelines for Common Desktop Environment Databases

You can find the syntax for the desktop databases, such as those used for actions and data types, in man pages located in the `/usr/dt/man/man4` directory.

For more information on databases, see the CDE Programmer's Guide.

## Application Initialization and libDtSvc

If your application uses any of the `libDtSvc` APIs (for actions, data typing, drag and drop, Session Manager, or Workspace Manager), it must first initialize the `libDtSvc` library by calling either `DtInitialize()` or `DtAppInitialize()` . Refer to the `DtInitialize(3)` or `DtAppInitialize(3)` man page for more information.

## Application Builder

Application Builder (App Builder) is a tool that enables you to easily create the graphical user interface (GUI) for Common Desktop Environment applications, without having to write code to call the desktop application program interfaces (APIs). It abstracts the Motif toolkit into simple object palettes and object property sheets. You can use App Builder to construct a wide range of applications, from simple GUI-based programs to complex, integrated systems. It supports User Interface Language (UIL) file import and export to enable you to migrate your application among other Motif-based tools and products.

App Builder is ideally suited for use if you:

- Are not an expert Motif programmer

- Are not familiar with the Common Desktop Environment Motif widgets

- Are not familiar with the desktop services (for example, drag and drop, ToolTalk messaging, sessioning, help, and internationalization)

- Want to build your application user interface quickly and be able to change it easily

- Are working collaboratively with other people to build a single application

In fact, even if you do not fit into any of the preceding categories, you will likely find App Builder to be appropriate and helpful for your application development.

Using App Builder, you can:

- Lay out the user interface for an application, constructing it piece-by-piece from a collection of objects from the Common Desktop Environment Motif toolkit

- Define connections between objects to provide application GUI behavior, then use the test mode that enables connections to be tested

- Add some of the desktop services functionality to your application

- Edit applications that were previously created using App Builder

- Merge automatically generated code with hand-generated code

- Generate C-language source code and associated project files (for example, message catalogs) for the application

You can compile and invoke your application from within App Builder. You can execute the build, run, and debug cycles all from a common environment without having to exit and restart App Builder.

### Demo Programs

You can find the App Builder example programs in `/usr/dt/examples/dtbuilder`. Read the `README` file for detailed information on these programs.

##### Related Documentation

For more information on Application Builder, see the appropriate man pages, the App Builder help volume, and the

Generated with CERN WebMaker