Developing an Application 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<indexterm><primary>desktop</primary><secondary>integration, levels of</secondary></indexterm><indexterm> <primary>integration</primary><secondary>levels of</secondary></indexterm><indexterm> <primary>application development</primary><secondary>levels of integration</secondary></indexterm> Users can run anyX-based applications 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 , for more information.basic integration levels of integrationbasic Recommended Integration—Enables your application to enhance its level of consistency with the desktop. See , for more information. recommended integrationlevels of integrationrecommended Optional Integration—Enables you to leverage services provided by the desktop for achieving specialized tasks. See , for more information.optional integration levels of integrationoptional For more information on all three levels of integration, see the Programmer's Guide. Basic Integration is also discussed in the Advanced User's and System Administrator's Guide. Desktop Naming Conventions<indexterm><primary>desktop</primary><secondary>naming conventions</secondary></indexterm><indexterm> <primary>naming conventions</primary><secondary>desktop</secondary></indexterm><indexterm> <primary>conventions, desktop naming</primary></indexterm><indexterm><primary>application development</primary><secondary>desktop naming conventions <$startrange></secondary></indexterm> 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. lists the desktop naming conventions. Desktop Naming Conventions Name Prefix Example Desktop clients and utilities dt dthelpview Resource names and classes Dt DtNhelpType, DtCHelpType Library names Dt libDtHelp Include references Dt #include <Dt/Help.h> Public function names Dt DtCreateHelpDialog Public data structure names Dt DtHelpDialogCallbackStruct Constant names Dt DtHELP_NEW_WINDOW Environment variables DT DTHELPSEARCHPATH Private desktop symbols (structures, functions, defines) _dt, _Dt, _DT _DtHelpFunction, _DtHELP_DEFINE
lists the exceptions to the preceding naming conventions. Exceptions to Desktop Naming Conventions Name Prefix Example Common Desktop Environment Motif Motif Xm XmCreateLabel dtksh Convenience Functions Dtksh DtkshAddButtons ToolTalk Messaging Service ToolTalk Messaging Service tt (for functions), Tt (for typedefs), TT (for constants) tt_open, Tt_message, TT_NOTICE X11R6.2 X11R6.2 X, Xt XOpenDisplay, XtCreateWidget
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, X11, or Motif code.naming conventionscaution noticedesktop naming conventionsnaming conventionsdesktop conventions, desktop namingapplication developmentdesktop naming conventions <$endrange>
Public and Private Interfaces<indexterm><primary>public interfaces</primary></indexterm><indexterm><primary>private interfaces</primary></indexterm><indexterm><primary>interfaces</primary><secondary>private</secondary></indexterm><indexterm><primary>interfaces</primary><secondary>public</secondary></indexterm><indexterm><primary>application development</primary><secondary>public and private interfaces</secondary></indexterm> 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<indexterm> <primary>guidelines</primary><secondary>database syntax</secondary></indexterm><indexterm> <primary>database</primary><secondary>syntax</secondary></indexterm><indexterm> <primary>syntax, for databases</primary></indexterm><indexterm><primary>application development</primary><secondary>databases, guidelines for</secondary> </indexterm> 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 Programmer's Guide. Application Initialization and libDtSvc<indexterm> <primary>application development</primary><secondary>initialization and libDtSvc</secondary></indexterm><indexterm><primary>desktop</primary><secondary>libDtSvc and application initialization</secondary></indexterm> 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()DtInitialize() or DtAppInitialize() DtAppInitialize(). Refer to the DtInitialize(3) or DtAppInitialize(3) man page for more information. Application Builder<indexterm><primary>application development</primary><secondary>Application Builder <$startrange></secondary></indexterm> 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.Application BuilderApp BuilderApp Builder (Application Builder) App Builder is ideally suited for use if you:Application Builderwhen to use 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 drag and drop,ToolTalk Messaging Service ToolTalk messaging,Session Manager sessioning,Help system help, and internationalization 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 EnvironmentMotif 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 cancompilingan application 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<indexterm><primary>Application Builder</primary><secondary>demo programs</secondary></indexterm><indexterm><primary>demo programs</primary> </indexterm> 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 Application Builder User's Guide.application developmentApplication Builder <$endrange>