0529-0532.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 378 行
HTML
378 行
<HTML>
<HEAD>
<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:Motif Programming</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311739 //-->
<!-- TITLE=RED HAT LINUX 2ND EDITION //-->
<!-- AUTHOR=DAVID PITTS ET AL //-->
<!-- PUBLISHER=MACMILLAN //-->
<!-- IMPRINT=SAMS PUBLISHING //-->
<!-- PUBLICATION DATE=1998 //-->
<!-- CHAPTER=26 //-->
<!-- PAGES=0529-0544 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch25/0526-0528.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0533-0536.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-529"><P>Page 529</P></A>
<H3><A NAME="ch26_ 1">
CHAPTER 26<BR>
</A></H3>
<H2>
Motif Programming
</H2>
<P><B>by Bill Ball</B>
</P>
<H4><A NAME="ch26_ 2">IN THIS CHAPTER
</A></H4>
<UL>
<LI> What Is Motif?530
<LI> Red Hat Motif Installation532
<LI> A Simple Example of Motif Programming
Concepts534
<LI> Shared and Static Libraries540
<LI> The UIL Compiler541
<LI> Tutorials and Examples541
<LI> Using imake and xmkmf541
<LI> LessTif—An Alternative Motif Clone542
<LI> For More Information543
</UL>
<A NAME="PAGENUM-530"><P>Page 530</P></A>
<P>This chapter introduces you to the OSF/Motif programming libraries. You'll learn about
the different versions of Motif; how to install Red Hat's Motif 2.0.1 distribution; how Motif
programs, or clients, work; how to write and compile a simple Motif client; how to use the
programming utilities imake and xmkmf; and how to possibly save money by using a Motif
clone, LessTif.
</P>
<P>You'll need to have the GNU gcc compiler and associated headers, libraries, and utilities
installed on your system. You'll also need to have X and Motif installed on your system if
you want to run any Motif clients, including mwm. You do not have to run X in order to
program with Motif, although it's a lot more fun to compile, run, and see a program in action.
</P>
<H3><A NAME="ch26_ 3">
What Is Motif?
</A></H3>
<P>First of all, you should understand that unlike the XFree86 distribution of X, Motif is not
free. You must pay for a distribution. There are Motif distributions for Linux on the Intel,
SPARC, or Alpha platforms. If you want to build Motif clients and distribute them, you'll need
to purchase a version for your computer and operating system. And if you want other people
to run your clients, you can build the clients in either shared library or static versions, for
people who either have or don't have Motif.
</P>
<P>If you're on a budget, or object to having to pay for a client license for Motif, don't
despair. Later in this chapter in the section "LessTif—An Alternative Motif Clone," you'll learn
about LessTif, a cost-free alternative to Motif.
</P>
<P>Motif is a toolkit of source headers, libraries, a window manager,
mwm, demonstration programs, and manual pages. Originally announced in 1988, designed by the Open Software
Foundation (OSF) in 1989, and now owned and updated by The Open Group, Motif provides a
rich selection of tools to build cross-platform, graphical-interface applications, or clients.
</P>
<P>The idea behind Motif is to provide the tools to build consistent, usable, and portable
programs for the X Window System. Motif provides functions and system calls to build
client interfaces with the following (and almost anything you need to craft graphical interface <BR>
programs):
</P>
<UL>
<LI> Arrow buttons
<LI> Cascade buttons
<LI> Checkboxes
<LI> Drawn buttons
<LI> File selection dialogs
<LI> List widgets
<LI> Menu bars
<LI> Push buttons
</UL>
<A NAME="PAGENUM-531"><P>Page 531</P></A>
<UL>
<LI> Radio boxes
<LI> Scrollbars
<LI> Toggle buttons
<LI> Dialogs
<LI> Icons
<LI> Drop-down menus
<LI> Pull-down menus
<LI> Tear-off menus
</UL>
<P>In fact, there are more than 600 man pages included with each Motif distribution,
documenting its clients, function calls, libraries, and window manager. Although you can use X
functions to build clients with a Motif look, why not take advantage of all the work put
into Motif?
</P>
<H4><A NAME="ch26_ 4">
Where Do I Get Motif?
</A></H4>
<P>A number of vendors supply Motif for Linux. This book is about Red Hat Linux, so I'll
concentrate on the Red Hat distribution. Because the object, or philosophy, of OSF/Motif is
to provide cross-platform, source-code level compatibility, you should be able to develop
Motif clients on your Intel Linux system that will compile and run on any other computer with
a Motif distribution installed.
</P>
<P>There are a number of distributors selling Motif for Linux besides Red Hat. Some of
these include the following:
</P>
<UL>
<LI> X Inside Corporation
<a href="(http://www.xinside.com)">(http://www.xinside.com)</A>
<LI> Metro Link Incorporated
<a href="(http://www.metrolink.com)">(http://www.metrolink.com)</A>
<LI> InfoMagic
<a href="(http://www.infomagic.com)">(http://www.infomagic.com)</A>
<LI> Linux Systems Labs
<a href="(http://www.lsl.com)">(http://www.lsl.com)</A>
<LI> Caldera
<a href="(http://www.caldera.com)">(http://www.caldera.com)</A>
</UL>
<H4><A NAME="ch26_ 5">
What Version of Motif Should I Use?
</A></H4>
<P>In order to make an intelligent decision regarding which version of Motif to get, you
should know a little about the history and direction of the standard. In 1996, The Open Group
acquired the X Window System from the X Consortium, with the aim of integrating X,
Motif, and the Common Desktop Environment (CDE). CDE represents the future of Motif,
according to The Open Group, and offers graphical interface improvements, support for
multiuser applications, and new networking features.
</P>
<P>The X Consortium acquired the X Window System from the MIT X Consortium in 1993
and was responsible for the last several releases, the last of which is X11R6.3. Broadway, which
is the codename for the next release of the X Window System, is slated to have improvements
in
</P>
<A NAME="PAGENUM-532"><P>Page 532</P></A>
<P>
network communications to support graphics and audio for use in World Wide Web
browsers. The Open Group has pledged to release Broadway under the same terms as the current
X Window System.
</P>
<P>The current version of Motif is 2.1, although the current version of CDE, which is also
2.1, uses Motif 1.2.5, which was released to support CDE (and which contains fixes made to
Motif 1.2 in Motif 2.0). Confused yet? Remember that OSF's aim is to merge X, Motif, and
CDE. But what does this mean to the user, and what does this mean to the programmer?
</P>
<P>For the user, especially the Red Hat Linux user, the choice is up to you! If you want the
Motif 1.2.5 libraries, a drag-and-drop, industry-standard interface, and many other
improvements, then CDE is the way to go. You should know that the Motif window manager,
mwm, goes away in the CDE release, replaced by new terminal managers (based on
dtwm).
</P>
<P>But for the programmer, the choice might not be as clear. According to The Open
Group, although Motif 2.0 and CDE may be used together, and Motif 2.0 is binary-compatible
with Motif 1.2, "All of the important Motif 2.0 developer features…will be available in
CDEnext Motif" (the next version of CDE, to be based on Motif 2.0). This means that The Open
Group recommends that programmers use Motif 2.0 now to get the latest programming features,
which are not currently in CDE 2.1.
</P>
<H3><A NAME="ch26_ 6">
Red Hat Motif Installation
</A></H3>
<P>As mentioned before, because this is Red Hat Linux
Unleashed, this chapter concentrates on the specifics of Red Hat's Motif distribution. Installing Red Hat Motif 2.0.1 is easy. First,
make sure that there's enough room on your hard drive. You'll need about 20 megabytes for a
full installation. If you just want to run just the Motif window manager,
mwm, and other Motif clients, you can save about 15 megabytes and just install the Motif libraries and
mwm.
</P>
<P>There are two ways to install Motif from the Red Hat CD-ROM, but both require you to
mount the disk to a convenient directory with
</P>
<!-- CODE SNIP //-->
<PRE># mount -t iso9660 /dev/cdrom /mnt/cdrom
</PRE>
<!-- END CODE SNIP //-->
<P>You can then launch the installation script with
</P>
<!-- CODE SNIP //-->
<PRE># ./install-motif
</PRE>
<!-- END CODE SNIP //-->
<P>Another way to install the software is to use the
rpm command. The Red Hat folks have assembled the Motif software into the RPM (Red Hat Package Manager) packages discussed
in the following sections.
</P>
<H4><A NAME="ch26_ 7">
motif-devel-2.0.1-1.i386.rpm
</A></H4>
<P>This package contains the static libraries and
#include files, or headers, needed to build Motif clients. You'll also find the Motif User Interface Language compiler,
uil, and the Motif <BR>
function-call manual pages.
</P>
<P><CENTER>
<a href="../ch25/0526-0528.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0533-0536.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?