3002 lines
122 KiB
Plaintext
3002 lines
122 KiB
Plaintext
<!-- $XConsortium: ch07.sgm /main/13 1996/10/30 14:50:13 rws $ -->
|
|
<!-- (c) Copyright 1995 Digital Equipment Corporation. -->
|
|
<!-- (c) Copyright 1995 Hewlett-Packard Company. -->
|
|
<!-- (c) Copyright 1995 International Business Machines Corp. -->
|
|
<!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
|
|
<!-- (c) Copyright 1995 Novell, Inc. -->
|
|
<!-- (c) Copyright 1995 FUJITSU LIMITED. -->
|
|
<!-- (c) Copyright 1995 Hitachi. -->
|
|
<Chapter Id="PG.widgs.div.1">
|
|
<Title Id="PG.widgs.mkr.1">Common Desktop Environment Motif Widgets</Title>
|
|
<Para>The Common Desktop Environment includes the Motif toolkit.<IndexTerm>
|
|
<Primary>Motif libraries</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>libraries</Primary>
|
|
<Secondary>Motif</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widgets</Primary>
|
|
<Secondary>Motif</Secondary>
|
|
</IndexTerm>
|
|
In addition, the
|
|
Common Desktop Environment provides four custom widgets you can use to
|
|
provide certain<IndexTerm>
|
|
<Primary>OPEN LOOK compatibility</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>compatibility</Primary>
|
|
<Secondary>OPEN LOOK</Secondary>
|
|
</IndexTerm>
|
|
OPEN LOOK™ and<IndexTerm>
|
|
<Primary>MW-windows compatibility</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>compatibility</Primary>
|
|
<Secondary>MW-windows</Secondary>
|
|
</IndexTerm>
|
|
Microsoft® Windows functionality. This
|
|
chapter describes these Motif custom widgets.</Para>
|
|
<InformalTable Id="PG.widgs.itbl.1" Frame="All">
|
|
<TGroup Cols="1">
|
|
<ColSpec Colname="1" Colwidth="4.0 in">
|
|
<TBody>
|
|
<Row Rowsep="1">
|
|
<Entry><Para><!--Original XRef content: ''--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.2">
|
|
<!--Original XRef content: 'Using Common Desktop Environment Motif70'--><XRef Role="JumpText" Linkend="PG.widgs.mkr.2"></Para></Entry>
|
|
</Row>
|
|
<Row Rowsep="1">
|
|
<Entry><Para><!--Original XRef content: 'Text Field and Arrow Button Widget (DtSpinBox)73'--><XRef Role="JumpText" Linkend="PG.widgs.mkr.3"></Para></Entry>
|
|
</Row>
|
|
<Row Rowsep="1">
|
|
<Entry><Para><!--Original XRef content: 'Text Field and List Box Widget (DtComboBox)82'--><XRef Role="JumpText" Linkend="PG.widgs.mkr.8"></Para></Entry>
|
|
</Row>
|
|
<Row Rowsep="1">
|
|
<Entry><Para><!--Original XRef content: 'Menu Button Widget (DtMenuButton)89'--><XRef Role="JumpText" Linkend="PG.widgs.mkr.13"></Para></Entry>
|
|
</Row>
|
|
<Row Rowsep="1">
|
|
<Entry><Para><!--Original XRef content: 'Text Editor Widget (DtEditor)94'--><XRef Role="JumpText" Linkend="PG.widgs.mkr.17"></Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</InformalTable>
|
|
<Para>The<IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>library</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary>widget</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>libDtWidget<Default Para Font> library</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary><Filename>libDtWidget<Default Para Font></Secondary>
|
|
</IndexTerm>
|
|
widget library, <Command>libDtWidget</Command>, contains two widgets that have now been superseded by Motif 2.1 widgets,
|
|
and two widgets that enhance functionality of Motif 2.1 widgets:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command><IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font> widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>DtSpinBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>text field and arrow button</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>text field and arrow button widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>arrow button and text field widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>arrow button and text field</Secondary>
|
|
</IndexTerm>DtSpinBox</Command> combines a text field and arrow buttons in a control that can
|
|
increment or decrement numeric or text values.
|
|
It has been superseded by <Command>XmSimpleSpinBox</Command>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font> widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font>,widget</Secondary>
|
|
<Tertiary>text field and list box</Tertiary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>list box and text field</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>list box and text field widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>text field and list box widget</Primary>
|
|
</IndexTerm>DtComboBox</Command> combines a text field and a list box in a control that displays
|
|
one of the many valid choices for the text field.
|
|
It has been superseded by <Command>XmComboBox</Command></Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command><IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font> widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>menu widget, pop-up</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>pop-up menu widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>pop-up menu</Secondary>
|
|
</IndexTerm>DtMenuButton</Command> provides<IndexTerm>
|
|
<Primary>menu cascading functionality</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>cascading menu functionality</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>functionality</Primary>
|
|
<Secondary>cascading menu</Secondary>
|
|
</IndexTerm>
|
|
menu-cascading functionality outside of the menu
|
|
bar.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command><IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font> widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>text editor</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>text editor widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>editor widget</Primary>
|
|
</IndexTerm>DtEditor</Command> incorporates such single text editor functions as cut and paste.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>These widgets provide common functionality across all Common Desktop
|
|
Environment applications. None of these widgets support subclassing.</Para>
|
|
<Para>The Custom Widgets library depends directly on the following libraries:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>Xm</Command> library for the Motif superclass support</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>Xt</Command> library for creation and manipulation of widgets</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>X11</Command> Library for the base X Window System</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtSvc</Command> for desktop support utilized by <Command>DtEditor</Command></Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Sect1 Id="PG.widgs.div.2">
|
|
<Title Id="PG.widgs.mkr.2">Using Motif in the Common Desktop Environment</Title>
|
|
<Para>The<IndexTerm>
|
|
<Primary>CDE Motif toolkit</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>Motif toolkit</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>toolkit, Motif</Primary>
|
|
</IndexTerm>
|
|
The Common Desktop Environment includes Motif 2.1, plus
|
|
four custom widgets. The custom widgets are described in detail in this
|
|
chapter.</Para>
|
|
<Para>The Common Desktop Environment is source and binary compatible with
|
|
Motif 1.2 applications. Existing Motif 1.2 applications will compile using
|
|
Motif 2.1 include files. Existing Motif 1.2 binaries will run without
|
|
modification using Motif 2.1 libraries.</Para>
|
|
<Sect2 Id="PG.widgs.div.3">
|
|
<Title>Motif Libraries<IndexTerm>
|
|
<Primary>Motif libraries</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary>Motif</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>Use the Motif 2.1 and X11R6.2 libraries to develop a
|
|
Common Desktop Environment Motif-compliant application for the X Window
|
|
System.</Para>
|
|
<Sect3 Id="PG.widgs.div.4">
|
|
<Title>Motif Library (libXm)</Title>
|
|
<Para>Common Desktop Environment provides all the<IndexTerm>
|
|
<Primary>Motif header files</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>header files</Primary>
|
|
<Secondary>Motif</Secondary>
|
|
</IndexTerm>
|
|
Motif 2.1 header files.</Para>
|
|
</Sect3>
|
|
<Sect3 Id="PG.widgs.div.5">
|
|
<Title>Motif UIL Library (libUil)<IndexTerm>
|
|
<Primary>Motif UIL library</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary>Motif UIL</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary><Filename>libUil<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>libUil<Default Para Font></Primary>
|
|
</IndexTerm></Title>
|
|
<Para>The Motif User Interface Language (UIL) is a specification language for
|
|
describing the initial state of a Motif application's user interface.</Para>
|
|
<Para>Include the<IndexTerm>
|
|
<Primary>header files</Primary>
|
|
<Secondary>Motif UIL library</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>Motif UIL library</Primary>
|
|
<Secondary>header file</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>UilDef.h<Default Para Font>header files</Primary>
|
|
<Secondary><Filename>Uil.Def.h<Default Para Font></Secondary>
|
|
</IndexTerm>
|
|
<Filename>uil/UilDef.h</Filename> header file to access UIL.</Para>
|
|
</Sect3>
|
|
<Sect3 Id="PG.widgs.div.6">
|
|
<Title>Motif Resource Manager Library (libMrm)<IndexTerm>
|
|
<Primary>Motif resource manager library</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary>Motif resource manager</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary><Filename>libMrm<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>libMrm<Default Para Font> library</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>The Motif Resource Manager (MRM) creates widgets based on definitions
|
|
contained in User Interface Definition (UID) files created by the UIL compiler.
|
|
MRM interprets the output of the UIL compiler and generates the appropriate
|
|
argument lists for widget creation functions. Use <Command>libMrm</Command> to access the Motif
|
|
Resource Manager.</Para>
|
|
<Para>Include the<IndexTerm>
|
|
<Primary>Motif resource manager header file</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>MrmPublic.h<Default Para Font> header file</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>header files<Filename>MrmPublic.h<Default Para Font></Primary>
|
|
</IndexTerm>
|
|
<Filename>Mrm/MrmPublic.h</Filename> header files to access <Command>libMrm</Command> in your
|
|
application.</Para>
|
|
</Sect3>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.8">
|
|
<Title>Usability Enhancements<IndexTerm>
|
|
<Primary>usability enhancements</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>enhancements</Primary><Secondary>usability</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>Motif 2.1 contains minor enhancements
|
|
to enable better usability by OPEN LOOK and Microsoft Windows
|
|
users. The usability enhancements include:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para>Enabling button two on a three-button mouse to be used to extend the
|
|
current selection. This functionality is equivalent to the<IndexTerm>
|
|
<Primary>OPEN LOOK</Primary>
|
|
<Secondary>mouse functionality</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>mouse functionality, OPEN LOOK</Primary>
|
|
</IndexTerm>
|
|
OPEN LOOK
|
|
ADJUST mouse button.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Enabling<IndexTerm>
|
|
<Primary>tab navigation</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>navigation, tab</Primary>
|
|
</IndexTerm>
|
|
Tab to be used to move through a group of <Command>PushButton</Command> widgets
|
|
and gadgets, <Command>ArrowButton</Command> widgets and gadgets, and <Command>DrawnButton</Command>
|
|
widgets.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Enabling button 3 to activate a <Command>CascadeButton</Command> menu.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Providing three new resources (<Command>pathMode, fileFilterStyle,</Command> and <Command>dirTextLabelString</Command>) for the <Command><IndexTerm>
|
|
<Primary><Filename>XmFileSelectionBox<Default Para Font> widget resources</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>resources</Primary>
|
|
<Secondary><Filename>XmFileSelectionBox<Default Para Font> widget</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>XmFileSelectionBox<Default Para Font></Secondary>
|
|
</IndexTerm>XmFileSelectionBox</Command> widget, which
|
|
gives it a new look and feel. See the <Emphasis>Common Desktop Environment:
|
|
Programmer's Overview</Emphasis> for details about the new <Command>XmFileSelectionBox</Command>
|
|
resources.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Enabling interoperability with Microsoft Windows and OPEN LOOK by
|
|
providing multiple key bindings for Motif virtual keys.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>Each of the preceding enhancements can be controlled by a resource: either a
|
|
widget resource (for <Command>XmFileSelectionBox</Command>) or an application-wide resource
|
|
(all other cases). The default values for this resource provide behavior and an
|
|
API that is identical to that of Motif 1.2. For information on these
|
|
enhancements and resources, see the <Filename>XmDisplay(3x)</Filename> and <Command>XmFileSelectionBox(3x)</Command> man pages.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.9">
|
|
<Title>Visual Enhancements<IndexTerm>
|
|
<Primary>Motif visual enhancements</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>visual enhancements, Motif</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>enhancements, visual Motif</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>Common Desktop Environment changes the default Motif look in the
|
|
following ways:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>RadioBox</Command> fill color is changed to show state more clearly.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>RadioBox</Command> shape is changed from diamond to circular.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>A check glyph is added to the <Command>CheckBox</Command> to show state more clearly.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>CascadeButtons</Command> and menu items are changed to have an etched-in border
|
|
when active.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Thumb is removed from the read-only Scale to distinguish it from the Scale.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Default shadow thickness is changed to 1 pixel.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Default highlight thickness is changed to 1 pixel.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Default <Command>PushButton</Command> visual draws the highlight inside the button's default
|
|
shadow.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>An application-wide resource can control each of these enhancements. The
|
|
default Motif 2.1 values for these resources provide behavior and an API that is identical
|
|
to that of Motif 1.2.</Para>
|
|
<Para>For information on these enhancements, see the <Filename MoreInfo="RefEntry">XmDisplay</Filename>(3),
|
|
<Filename MoreInfo="RefEntry">XmPushButton</Filename>(3), <Filename MoreInfo="RefEntry">XmPushButtonGadget</Filename>(3), <Filename MoreInfo="RefEntry">XmToggleButton</Filename>(3),
|
|
<Filename MoreInfo="RefEntry">XmToggleButtonGadget</Filename>(3), and <Filename MoreInfo="RefEntry">XmScale</Filename>(3) man pages.</Para>
|
|
</Sect2>
|
|
</Sect1>
|
|
<Sect1 Id="PG.widgs.div.10">
|
|
<Title Id="PG.widgs.mkr.3">Text Field and Arrow Button Widget (DtSpinBox<Filename>)</Filename><IndexTerm>
|
|
<Primary>text field and arrow button widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>text field and arrow button</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>arrow button and text field</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget<Filename>DtSpinBox<Default Para Font></Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font> widget</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>Use the <Command>DtSpinBox</Command> for<IndexTerm>
|
|
<Primary>cycle widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>cycle</Secondary>
|
|
</IndexTerm>
|
|
cycling through a list of text items or incrementing and
|
|
decrementing a numeric entry. <Command>DtSpinBox</Command> is a subclass of the <Command>XmManager</Command>
|
|
class and is used to display a text field and two arrows.</Para>
|
|
<Para>The <Command>DtSpinBox</Command> widget is a user interface control used to<IndexTerm>
|
|
<Primary>increment/decrement widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>increment/decrement</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>decrement/increment widget</Primary>
|
|
</IndexTerm>
|
|
increment and
|
|
decrement an arbitrary text or numeric field. You can use it, for example, to
|
|
cycle through the months of the year or days of the month.
|
|
<!--Original XRef content: 'Figure 7‐1'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.4"> shows
|
|
examples of the <Command>DtSpinBox</Command> widget.</Para>
|
|
<Figure>
|
|
<Title Id="PG.widgs.mkr.4">Examples of the DtSpinBox widget<IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font> widget, illustration</Primary>
|
|
</IndexTerm></Title>
|
|
<Graphic Entityref="PG.widgs.fig.1" Id="PG.widgs.grph.1"></Graphic>
|
|
</Figure>
|
|
<Sect2 Id="PG.widgs.div.11">
|
|
<Title>Library and Header Files<IndexTerm>
|
|
<Primary>header file</Primary>
|
|
<Secondary><Filename>Dt/SpinBox.h<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>Dt/SpinBox.h<Default Para Font> header file</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary><Filename>libDtWidget<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>libDtWidget<Default Para Font> library</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtSpinBox</Command> widget is in the <Command><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>libDtWidget<Default Para Font> library</Secondary>
|
|
</IndexTerm>libDtWidget</Command> library. The header file is
|
|
<Filename>Dt/SpinBox.h</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.12">
|
|
<Title>Demo Program<IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>demo program</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>demo program</Primary>
|
|
<Secondary>widgets</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>A demo containing an example of the <Command>DtSpinBox</Command> widget is in
|
|
<Filename>/usr/dt/examples/dtwidget/controls.c</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.13">
|
|
<Title>Moving to XmSimpleSpinBox<IndexTerm>
|
|
<Primary>compatibility</Primary>
|
|
<Secondary>Motif 2.1 <Filename>XmSimpleSpinBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font>, compatibility with Motif 2.1</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>To use the Motif 2.1 <Command>DtSimpleSpinBox</Command> widget, change the <Command>Dt</Command> names for the class, types, and
|
|
creation routines to <Command>Xm</Command>, and change <Command>SpinBox</Command> to <Command>SimpleSpinBox</Command>. For example, change all occurrences of <Command>DtSpinBox</Command> to
|
|
<Command>XmSimpleSpinBox</Command> in your code. Alternatively, you can compile
|
|
your existing code with <Symbol>-DDT_USE_XM_SSPINBOX</Symbol>.
|
|
This information is supplied in case you choose to
|
|
revise your CDE 1.0 application to use the Motif 2.1 widget.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.14">
|
|
<Title>Convenience Functions<IndexTerm>
|
|
<Primary>convenience functions</Primary>
|
|
<Secondary><Filename>DtSpinBox<Default Para Font> widget</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font></Primary>
|
|
<Secondary>convenience functions</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><!--Original XRef content: 'Table 7‐1'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.5"> lists the convenience functions for the <Command>DtSpinBox</Command> widget. See the
|
|
<Filename MoreInfo="RefEntry">DtSpinBox</Filename>(3) man page for more information.</Para>
|
|
<Table Id="PG.widgs.tbl.1" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.5">DtSpinBox Convenience Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="2.0 in">
|
|
<ColSpec Colname="2" Colwidth="3.0 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Filename>DtCreateSpinBox()</Filename></Para></Entry>
|
|
<Entry><Para>Creates a SpinBox widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Filename>DtSpinBoxAddItem()</Filename></Para></Entry>
|
|
<Entry><Para>Adds an item into a <Command>DtSpinBox</Command> widget at a
|
|
specified location.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Filename>DtSpinBoxDeletePos()</Filename></Para></Entry>
|
|
<Entry><Para>Deletes a specified item from a <Command>DtSpinBox</Command>
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Filename>DtSpinBoxSetItem()</Filename></Para></Entry>
|
|
<Entry><Para>Sets the current item in a <Command>DtSpinBox</Command> widget.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.15">
|
|
<Title>Classes<IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font></Primary>
|
|
<Secondary>classes</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>classes</Primary>
|
|
<Secondary><Filename>DtSpinBox<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><Command>DtSpinBoxWidget</Command> inherits behavior and resources from the <Command>Core</Command>,
|
|
<Command>Composite</Command>, <Command>Constraint</Command>, and <Command>XmManager</Command> classes.</Para>
|
|
<Para>The class pointer is <Command>dtSpinBoxWidgetClass</Command>.</Para>
|
|
<Para>The class name is <Command>DtSpinBoxWidget</Command>.</Para>
|
|
<Para><Command>DtSpinBoxWidget</Command> does not support subclassing.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.16">
|
|
<Title>Resources<IndexTerm>
|
|
<Primary>resources</Primary>
|
|
<Secondary><Filename>DtSpinBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font></Primary>
|
|
<Secondary>resources</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtSpinBox</Command> widget defines the following set of widget resources.
|
|
<!--Original XRef content: 'Table 7‐2'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.6">
|
|
lists the class, type, default, and access for each resource.</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>DtNarrowLayout</Command> specifies the style and position of the <Command>DtSpinBox</Command>
|
|
arrows.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNarrowSensitivity</Command> specifies the sensitivity of the arrows in the
|
|
<Command>DtSpinBox</Command>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNspinBoxChildType</Command> specifies the style of the <Command>DtSpinBox</Command>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNdecimalPoints</Command> specifies the position of the decimal point within the
|
|
integer value when the child type is numeric.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNincrementValue</Command> specifies the amount to increment or decrement the
|
|
position when the child type is numeric.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNinitialDelay</Command> specifies the amount of time in milliseconds before the
|
|
arrow buttons begin to spin continuously.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNnumValues</Command> specifies the number of items in the <Command>DtNvalues</Command> list when
|
|
the child type is a string.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNvalues</Command> supplies the list of strings to cycle through when the child type
|
|
resource is a string.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNmaximumValue</Command> specifies the upper bound on the <Command>DtSpinBox</Command> range
|
|
when the child type is numeric.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNminimumValue</Command> specifies the lower bound on the <Command>DtSpinBox</Command> range
|
|
when the child type is numeric.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNmodifyVerifyCallback</Command> is called just before the <Command>DtSpinBox</Command> position
|
|
changes. The application can use this callback to implement new
|
|
application-related logic, including setting a new position, spinning to, or
|
|
canceling the impending action.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNposition</Command> has a different value based on the child type resource. When
|
|
the child type is a string, <Command>DtNposition</Command> is the index into the <Command>DtNvalues</Command> list
|
|
for the current item. When the child type is numeric, <Command>DtNposition</Command> is the
|
|
integer value of the <Command>DtSpinBox</Command> that falls within the maximum and
|
|
minimum value range.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNrepeatDelay</Command> is the number of milliseconds between repeated calls to
|
|
the <Command>DtNvalueChangedCallback</Command> while the user is spinning the
|
|
<Command>DtSpinBox</Command>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNvalueChangedCallback</Command> is called whenever the value of the
|
|
<Command>DtNposition</Command> resource is changed through the use of the spinner arrows.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>See the <Filename MoreInfo="RefEntry">DtSpinBox</Filename>(3) man page for more information.</Para>
|
|
<Table Id="PG.widgs.tbl.2" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.6"><Command>DtSpinBoxWidget</Command> Resources</Title>
|
|
<TGroup Cols="5">
|
|
<ColSpec Colname="1" Colwidth="1.96865 in">
|
|
<ColSpec Colname="2" Colwidth="1.58095 in">
|
|
<ColSpec Colname="3" Colwidth="1.375 in">
|
|
<ColSpec Colname="4" Colwidth="1.5 in">
|
|
<ColSpec Colname="5" Colwidth="0.57103 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Name</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Class</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Type</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Default</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Access</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtNarrowLayout</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCArrowLayout</Command></Para></Entry>
|
|
<Entry><Para><Command>unsigned char</Command></Para></Entry>
|
|
<Entry><Para><Filename>DtARROWS_END</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNarrowSensitivity</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCArrowSensitivity</Command></Para></Entry>
|
|
<Entry><Para><Command>unsigned char</Command></Para></Entry>
|
|
<Entry><Para><Filename>DtARROWS_SENSITIVE</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNspinBoxChildType</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCSpinBoxChildType</Command></Para></Entry>
|
|
<Entry><Para><Command>unsigned char</Command></Para></Entry>
|
|
<Entry><Para><Command>DtSTRING</Command></Para></Entry>
|
|
<Entry><Para>CG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNdecimalPoints</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCDecimalPoints</Command></Para></Entry>
|
|
<Entry><Para><Command>short</Command></Para></Entry>
|
|
<Entry><Para><Filename>0</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNincrementValue</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCIncrementValue</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Filename>1</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNinitialDelay</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCInitialDelay</Command></Para></Entry>
|
|
<Entry><Para><Command>unsigned int</Command></Para></Entry>
|
|
<Entry><Para><Command>250 ms</Command></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNnumValues</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCNumValues</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Filename>0</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNvalues</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCValues</Command></Para></Entry>
|
|
<Entry><Para><Command>XmStringTable</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNmaximumValue</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCMaximumValue</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Filename>10</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNminimumValue</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCMinimumValue</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Filename>0</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNmodifyVerifyCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>XtCallbackList</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para>C</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNposition</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Filename>0</Filename></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNrepeatDelay</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCRepeatDelay</Command></Para></Entry>
|
|
<Entry><Para><Command>unsigned int</Command></Para></Entry>
|
|
<Entry><Para><Command>200 ms</Command></Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNvalueChangedCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>XtCallbackList</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para>C</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.17">
|
|
<Title>Callback Structures<IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font></Primary>
|
|
<Secondary>callback structures</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>callback structures</Primary>
|
|
<Secondary><Filename>DtSpinBox<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The callback structure follows and is described in
|
|
<!--Original XRef content: 'Table 7‐3'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.7">.</Para>
|
|
<ProgramListing>typedef struct {
|
|
int <Symbol Role="Variable">reason</Symbol>;
|
|
XEvent <Symbol Role="Variable">*event</Symbol>;
|
|
Widget <Symbol Role="Variable">widget</Symbol>;
|
|
Boolean <Symbol Role="Variable">doit</Symbol>;
|
|
int <Symbol Role="Variable">position</Symbol>;
|
|
XmString <Symbol Role="Variable">value</Symbol>;
|
|
Boolean <Symbol Role="Variable">crossed_boundary</Symbol>;
|
|
} DtSpinBoxCallbackStruct;
|
|
</ProgramListing>
|
|
<Table Id="PG.widgs.tbl.3" Frame="Topbot">
|
|
<Title><Command Id="PG.widgs.mkr.7"></Command>DtSpinBox Callbacks</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="1.47818 in">
|
|
<ColSpec Colname="2" Colwidth="3.54168 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Callback</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">reason</Symbol></Para></Entry>
|
|
<Entry><Para>Use this callback for three possible reasons. For the first call
|
|
to the callback at the beginning of a spin, or for a single
|
|
activation of the spin arrows, <Filename>DtCR_OK</Filename> is the reason. If the
|
|
<Command>DtSpinBox</Command> is being continuously spun, the reason is
|
|
<Filename>DtCR_SPIN_NEXT</Filename> or <Filename>DtCR_SPIN_PRIOR</Filename>, depending on
|
|
the arrow that is spinning.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">event</Symbol></Para></Entry>
|
|
<Entry><Para>A pointer to the event that caused this callback to be
|
|
invoked. It can be <Command>NULL</Command> when the <Command>DtSpinBox</Command> is
|
|
continuously spinning.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">widget</Symbol></Para></Entry>
|
|
<Entry><Para>The widget identifier for the text widget that is affected by
|
|
the spin.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">doit</Symbol></Para></Entry>
|
|
<Entry><Para>Sets this value only when the <Filename>call_data</Filename> comes from the
|
|
<Command>DtNmodifyVerifyCallback</Command>. For a modifyVerify callback,
|
|
the setting of this field by an application determines
|
|
whether the action that initiated the callback should be
|
|
performed. When this field is set to <Command>False</Command>, the action is not
|
|
performed.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">position</Symbol></Para></Entry>
|
|
<Entry><Para>The new value of the <Command>DtNposition</Command> resource that results
|
|
from the spin.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">value</Symbol></Para></Entry>
|
|
<Entry><Para>The new <Command>XmString</Command> value displayed in the Text widget that
|
|
results from the spin. This string must be copied if it is used
|
|
beyond the scope of the <Filename>call_data</Filename> structure.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">crossed_boundary</Symbol></Para></Entry>
|
|
<Entry><Para>This Boolean is True when the spinbox cycles, and/or
|
|
<Command>DtNspinBoxChildType</Command> of <Command>XmSTRING</Command> wraps from the first
|
|
item to the last or the last item to the first. When the
|
|
<Command>DtNspinBoxChildType</Command> is <Command>XmNUMERIC</Command>, the boundary is
|
|
crossed when the <Command>DtSpinBox</Command> cycles from the maximum
|
|
value to the minimum value or vice versa.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.18">
|
|
<Title>Example of DtSpinBox Widget<IndexTerm>
|
|
<Primary><Filename>DtSpinBox<Default Para Font></Primary>
|
|
<Secondary>example code</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>code example</Primary>
|
|
<Secondary><Filename>DtSpinBox<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The following example shows how to create and use a <Command>DtSpinBox</Command> widget. You
|
|
can find this code as part of the <Filename>controls.c</Filename> demo in the <Command>/usr/dt/examples/dtwidget</Command> directory.</Para>
|
|
<ProgramListing>/*
|
|
* Example code for SpinBox
|
|
*/
|
|
|
|
#include <Dt/SpinBox.h>
|
|
|
|
static char *spinValueStrings[] = {
|
|
“alpha”, “beta”, “gamma”, “delta”,
|
|
“epsilon”, “zeta”, “eta”, “theta”,
|
|
“iota”, “kappa”, “lambda”, “mu”,
|
|
“nu”, “xi”, “omicron”, “pi”,
|
|
“rho”, “sigma”, “tau”, “upsilon”,
|
|
“phi”, “chi”, “psi”, “omega”
|
|
};
|
|
|
|
static void ModifyVerifyCb(Widget, XtPointer, XtPointer);
|
|
|
|
static void CreateSpinBoxes(Widget parent)
|
|
{
|
|
Widget titleLabel, spinBox;
|
|
XmString *valueXmstrings;
|
|
int numValueStrings;
|
|
XmString labelString;
|
|
Arg args[20];
|
|
int i, n;
|
|
|
|
/* Create value compound strings */
|
|
|
|
numValueStrings = XtNumber(spinValueStrings);
|
|
valueXmstrings = (XmString *)XtMalloc(numValueStrings
|
|
sizeof(XmString*));
|
|
for (i = 0; i < numValueStrings; i++) {
|
|
valueXmstrings[i] =
|
|
XmStringCreateLocalized(spinValueStrings[i]);
|
|
}
|
|
|
|
/* Create title label */
|
|
|
|
labelString = XmStringCreateLocalized(“SpinBox Widget”);
|
|
n = 0;
|
|
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
|
titleLabel = XmCreateLabel(parent, “title”, args, n);
|
|
XtManageChild(titleLabel);
|
|
XmStringFree(labelString);
|
|
|
|
/*
|
|
* Create a SpinBox containing string values.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNvalues, valueXmstrings); n++;
|
|
XtSetArg(args[n], DtNnumValues, numValueStrings); n++;
|
|
XtSetArg(args[n], DtNcolumns, 10); n++;
|
|
spinBox = DtCreateSpinBox(parent, “spinBox1”, args, n);
|
|
XtManageChild(spinBox);
|
|
|
|
/*
|
|
* Create a SpinBox containing numeric values to 3 decimal places.
|
|
* Position the arrows on either side of the displayed value.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNspinBoxChildType, DtNUMERIC); n++;
|
|
XtSetArg(args[n], DtNminimumValue, 1000); n++;
|
|
XtSetArg(args[n], DtNmaximumValue, 100000); n++;
|
|
XtSetArg(args[n], DtNincrementValue,1000); n++;
|
|
XtSetArg(args[n], DtNdecimalPoints,3); n++;
|
|
XtSetArg(args[n], DtNposition,1000); n++;
|
|
XtSetArg(args[n], DtNarrowLayout,DtARROWS_SPLIT); n++;
|
|
XtSetArg(args[n], DtNcolumns, 10); n++;
|
|
spinBox = DtCreateSpinBox(parent, “spinBox2”, args, n);
|
|
XtManageChild(spinBox);
|
|
|
|
/*
|
|
* Create a SpinBox containing numeric values to 2 decimal places.
|
|
* Position the arrows on the left of the displayed value.
|
|
* Disallow alternate user changes by adding a modify/verify
|
|
callback.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNspinBoxChildType, DtNUMERIC); n++;
|
|
XtSetArg(args[n], DtNminimumValue, 1500); n++;
|
|
XtSetArg(args[n], DtNmaximumValue, 60500); n++;
|
|
XtSetArg(args[n], DtNincrementValue,1500); n++;
|
|
XtSetArg(args[n], DtNdecimalPoints,2); n++;
|
|
XtSetArg(args[n], DtNposition,7500); n++
|
|
XtSetArg(args[n], DtNarrowLayout,DtARROWS_FLAT_BEGINNING); n++;
|
|
XtSetArg(args[n], DtNcolumns, 10); n++;
|
|
spinBox = DtCreateSpinBox(parent, “spinBox3”, args, n);
|
|
XtManageChild(spinBox);
|
|
|
|
XtAddCallback(spinBox, DtNmodifyVerifyCallback, ModifyVerifyCb,
|
|
NULL);
|
|
|
|
/*
|
|
* Create a SpinBox containing string values.
|
|
* Position the arrows on the left of the display value
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNvalues, valueXmstrings); n++;
|
|
XtSetArg(args[n], DtNnumValues, numValueStrings); n++;
|
|
XtSetArg(args[n], DtNarrowLayout, DtARROWS_BEGINNING); n++;
|
|
XtSetArg(args[n], DtNcolumns, 10); n++;
|
|
spinBox = DtCreateSpinBox(parent, “spinBox4”, args, n);
|
|
XtManageChild(spinBox);
|
|
|
|
/*
|
|
* Create a SpinBox containing numeric values to 3 decimal places.
|
|
* Position the arrows on the right of the displayed value.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNspinBoxChildType, DtNUMERIC); n++;
|
|
XtSetArg(args[n], DtNminimumValue, 1000); n++;
|
|
XtSetArg(args[n], DtNmaximumValue, 100000); n++;
|
|
XtSetArg(args[n], DtNincrementValue,1000); n++;
|
|
XtSetArg(args[n], DtNdecimalPoints,3); n++;
|
|
XtSetArg(args[n], DtNposition,1000); n++;
|
|
XtSetArg(args[n], DtNarrowLayout, DtARROWS_FLAT_END); n++;
|
|
XtSetArg(args[n], DtNcolumns, 10); n++;
|
|
spinBox = DtCreateSpinBox(parent, “spinBox5”, args, n);
|
|
XtManageChild(spinBox);
|
|
|
|
/*
|
|
* Free value strings, SpinBox has taken a copy.
|
|
*/
|
|
|
|
for (i = 0; i < numValueStrings; i++) {
|
|
XmStringFree(valueXmstrings[i]);
|
|
}
|
|
XtFree((char*)valueXmstrings);
|
|
|
|
}
|
|
|
|
/*
|
|
* modify/verify callback.
|
|
*
|
|
* Allow/disallow alternate user changes
|
|
*/
|
|
|
|
static void ModifyVerifyCb(Widget w, XtPointer cd, XtPointer cb)
|
|
{
|
|
DtSpinBoxCallbackStruct *scb= (DtSpinBoxCallbackStruct*)cb;
|
|
static Boolean allowChange = True;
|
|
|
|
scb->doit = allowChange;
|
|
|
|
if (allowChange == False) {
|
|
printf(“DtSpinBox: DtNmodifyVerifyCallback.
|
|
Change disallowed.\n”);
|
|
XBell(XtDisplay(w), 0);
|
|
}
|
|
|
|
allowChange = (allowChange == True) ? False: True;
|
|
}</ProgramListing>
|
|
</Sect2>
|
|
</Sect1>
|
|
<Sect1 Id="PG.widgs.div.19">
|
|
<Title Id="PG.widgs.mkr.8">Text Field and List Box Widget (DtComboBox)<IndexTerm>
|
|
<Primary>text field and list box widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>list box and text field widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>text field and list box</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>list box and text field</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font> widget</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>Use the <Command>DtComboBox</Command> widget to display a list and the current selection from the
|
|
list. You can use this widget for display only, or as a selectable control.</Para>
|
|
<Para>The <Command>DtComboBox</Command> widget is a combination of a text field and a list widget that
|
|
provides a list of valid choices for the text field. Selecting an item from this list
|
|
automatically fills in the text field with that list item.
|
|
<!--Original XRef content: 'Figure 7‐2'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.14"> shows
|
|
examples of a <Command>DtComboBox</Command> widget.</Para>
|
|
<Figure>
|
|
<Title Id="PG.widgs.mkr.9">Examples of text field and list box widget (DtComboBox)<IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>illustration</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>illustration</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Graphic Entityref="PG.widgs.fig.2" Id="PG.widgs.grph.2"></Graphic>
|
|
<Graphic Entityref="PG.widgs.fig.4" Id="PG.widgs.grph.4"></Graphic>
|
|
</Figure>
|
|
<Sect2 Id="PG.widgs.div.20">
|
|
<Title>Library and Header Files<IndexTerm>
|
|
<Primary>header files</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>header file</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>library</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary><Filename>libDtWidget<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>libDtWidget<Default Para Font> library</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtComboBox</Command> widget is in the <Command>libDtWidget</Command> library. The header file is
|
|
<Filename>Dt/ComboBox.h</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.21">
|
|
<Title>Demo Program<IndexTerm>
|
|
<Primary>demo program</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>demo program</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>A demo containing an example of the <Command>DtComboBox</Command> widget is in
|
|
<Filename>/usr/dt/examples/dtwidget/controls.c</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.22">
|
|
<Title>Moving to XmComboBox<IndexTerm>
|
|
<Primary>compatibility</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>compatibility with Motif 2.1</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>XmComboBox<Default Para Font>, compatibility with <Filename>DtComboBox<Default Para Font></Primary>
|
|
</IndexTerm></Title>
|
|
<Para>To use the Motif 2.1 <Command>XmComboBox</Command> widget, change the <Command>Dt</Command> names for
|
|
the class, type, and creation routines to <Command>Xm</Command>. For example, change all
|
|
occurrences of <Command>DtComboBox</Command> to <Command>XmComboBox</Command> in your code. Alternatively, you can compile
|
|
your existing code with <Symbol>-DDT_USE_XM_COMBOBOX</Symbol>.
|
|
This information is supplied in case you choose to
|
|
revise your CDE 1.0 application to use the Motif 2.1 widget.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.23">
|
|
<Title>Convenience Functions<IndexTerm>
|
|
<Primary>convenience functions</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>convenience functions</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtComboBox</Command> widget provides the following convenience functions,
|
|
described in more detail in
|
|
<!--Original XRef content: 'Table 7‐4'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.10">.</Para>
|
|
<Para>See the <Filename MoreInfo="RefEntry">DtComboBox</Filename>(3) man page for more information.</Para>
|
|
<Table Id="PG.widgs.tbl.4" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.10">DtComboBox Widget Convenience Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="1.875 in">
|
|
<ColSpec Colname="2" Colwidth="3.125 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Filename>DtCreateComboBox()</Filename></Para></Entry>
|
|
<Entry><Para>Creates a <Command>DtComboBox</Command> widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Filename>DtComboBoxAddItem()</Filename></Para></Entry>
|
|
<Entry><Para>Adds an item into a <Command>DtComboBox</Command> widget at a
|
|
specified position.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Filename>DtComboBoxDeletePos()</Filename></Para></Entry>
|
|
<Entry><Para>Deletes a specified item from a <Command>DtComboBox</Command>
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Filename>DtComboBoxSetItem()</Filename></Para></Entry>
|
|
<Entry><Para>Selects an item in the <Command>XmList</Command> of a <Command>DtComboBox</Command>
|
|
widget and makes it the first visible item in the list.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Filename>DtComboBoxSelectItem()</Filename></Para></Entry>
|
|
<Entry><Para>Selects an item in the <Command>XmList</Command> of the <Command>DtComboBox</Command>
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
<Para><Command>DtComboBox</Command> is a subclass of the <Command>XmManager</Command> class that is used to display
|
|
<Command>XmList</Command> or <Command>XmScrolledList</Command>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.24">
|
|
<Title>Classes<IndexTerm>
|
|
<Primary>classes</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>classes</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><Command>DtComboBox</Command> inherits behavior and resources from <Command>Core</Command>, <Command>Composite</Command>,
|
|
<Command>Constraints</Command>, and <Command>XmManager</Command> classes.</Para>
|
|
<Para>The class pointer is <Command>dtComboBoxWidgetClass</Command>.</Para>
|
|
<Para>The class name is <Command>DtComboBoxWidget</Command>.</Para>
|
|
<Para><Command>DtComboBoxWidget</Command> does not support subclassing.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.25">
|
|
<Title>Resources<IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>resources</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>resources</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><Command>DtComboBox</Command> provides the following resources.
|
|
<!--Original XRef content: 'Table 7‐5'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.11"> shows the class, type,
|
|
default, and access for these resources.</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>DtNmarginHeight</Command> specifies the number of pixels added between the top
|
|
and bottom of the text widget and the start of the shadow.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNmarginWidth</Command> specifies the number of pixels added between the right
|
|
and left sides of the text widget and the start of the shadow.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNselectedItem</Command> is passed through to the <Command>XmList</Command> to set the
|
|
<Command>XmNselectedItemCount</Command> and <Command>XmNselectedItems</Command> as the single item in
|
|
the <Command>DtNitems</Command> that matches this specified <Command>XmString</Command> in the list.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNselectedPosition</Command> is passed through to the <Command>XmList</Command> to set the
|
|
<Command>XmNselectedItemCount</Command> and <Command>XmNselectedItems</Command> as the single item at
|
|
this specified position in the list.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNselectionCallback</Command> is issued when an item is selected from the
|
|
<Command>DtComboBox</Command> widget list.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNcomboBoxType</Command> determines the style type of the <Command>DtComboBox</Command>.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>The list widget ID is accessible using the <Filename>XtNameToWidget()</Filename> function. The
|
|
resources of these widgets can be set. See the <Filename MoreInfo="RefEntry">DtComboBox</Filename>(3) man page for
|
|
more information.</Para>
|
|
<Para>The codes in the access column show if you can:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para>Set the resource at creation time (C)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Set by using <Command>XtSetValues</Command> (S)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Retrieve by using <Command>XtGetValues</Command> (G)</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Table Id="PG.widgs.tbl.5" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.11">DtComboBox Widget Resources</Title>
|
|
<TGroup Cols="5">
|
|
<ColSpec Colname="1" Colwidth="1.7 in">
|
|
<ColSpec Colname="2" Colwidth="1.6 in">
|
|
<ColSpec Colname="3" Colwidth="1.325 in">
|
|
<ColSpec Colname="4" Colwidth="1.7 in">
|
|
<ColSpec Colname="5" Colwidth="0.7 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Name</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Class</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Type</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Default</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Access</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtNmarginHeight</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCMarginHeight</Command></Para></Entry>
|
|
<Entry><Para><Command>Dimension</Command></Para></Entry>
|
|
<Entry><Para><Filename>2</Filename></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNmarginWidth</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCMarginWidth</Command></Para></Entry>
|
|
<Entry><Para><Command>Dimension</Command></Para></Entry>
|
|
<Entry><Para><Filename>2</Filename></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNselectedItem</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCSelectedItem</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dimension</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNselectedPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCSelectedPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Command>Dimension</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNselectionCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>XtCallbackList</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>C</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcomboBoxType</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCComboBoxType</Command></Para></Entry>
|
|
<Entry><Para><Command>unsigned char</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Command>CG</Command></Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.26">
|
|
<Title>Callback Structures<IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>callback structures</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>callback structures</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
</IndexTerm></Title>
|
|
<Para>The callback structure follows and is described in
|
|
<!--Original XRef content: 'Table 7‐6'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.12">.</Para>
|
|
<ProgramListing>typedef struct {
|
|
int <Symbol Role="Variable">reason</Symbol>;
|
|
XEvent <Symbol Role="Variable">*event</Symbol>;
|
|
XmString <Symbol Role="Variable">item_or_text</Symbol>;
|
|
int <Symbol Role="Variable">item_position</Symbol>;
|
|
} DtComboBoxCallbackStruct;</ProgramListing>
|
|
<Table Id="PG.widgs.tbl.6" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.12">DtComboBox Callback Structures</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="1.25 in">
|
|
<ColSpec Colname="2" Colwidth="3.75 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Structure</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">reason</Symbol></Para></Entry>
|
|
<Entry><Para>The only reason to issue this callback is <Filename>XmCR_SELECT</Filename>.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">event</Symbol></Para></Entry>
|
|
<Entry><Para>A pointer to the event that caused this callback to be invoked.
|
|
It can be NULL.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">item_or_text</Symbol></Para></Entry>
|
|
<Entry><Para>The contents of the text widget at the time the event invoked
|
|
the callback. This data is only valid within the scope of the
|
|
<Filename>call_data</Filename> structure, so it must be copied when it is used
|
|
outside of this scope.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">item_position</Symbol></Para></Entry>
|
|
<Entry><Para>The new value of the <Command>DtNposition</Command> resource in the
|
|
<Command>DtComboBox</Command> list. If the value is 0, the user entered a value in
|
|
the <Command>XmTextField</Command> widget.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.27">
|
|
<Title>Example of DtComboBox Widget<IndexTerm>
|
|
<Primary><Filename>DtComboBox<Default Para Font></Primary>
|
|
<Secondary>example code</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>code example</Primary>
|
|
<Secondary><Filename>DtComboBox<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The following example shows how to create and use a <Command>DtComboBox</Command> widget.
|
|
You can find this code as part of the <Filename>controls.c</Filename> demo in the
|
|
<Filename>/usr/dt/examples/dtwidget</Filename> directory.</Para>
|
|
<ProgramListing>/*
|
|
* Example code for DtComboBox
|
|
*/
|
|
|
|
#include <Dt/ComboBox.h>
|
|
|
|
static char *comboValueStrings[] = {
|
|
“alpha”, “beta”, “gamma”, “delta”,
|
|
“epsilon”, “zeta”, “eta”, “theta”,
|
|
“iota”, “kappa”, “lambda”, “mu”,
|
|
“nu”, “xi”, “omicron”, “pi”,
|
|
“rho”, “sigma”, “tau”, “upsilon”,
|
|
“phi”, “chi”, “psi”, “omega”
|
|
};
|
|
|
|
static char *colorStrings[] = { “Red”, “Yellow”, “Green”, “Brown”,
|
|
“Blue” };
|
|
|
|
static void CreateComboBoxes(Widget parent)
|
|
{
|
|
Widget titleLabel, comboBox, list;
|
|
XmString *valueXmstrings, *colorXmstrings;
|
|
int numValueStrings, numColorStrings;
|
|
XmString labelString, xmString;
|
|
Arg args[20];
|
|
int i, n;
|
|
|
|
/* Create value compound strings */
|
|
|
|
numValueStrings = XtNumber(comboValueStrings);
|
|
valueXmstrings = (XmString *)XtMalloc(numValueStrings *
|
|
sizeof(XmString*));
|
|
for (i = 0; i < numValueStrings; i++) {
|
|
valueXmstrings[i] =
|
|
|
|
XmStringCreateLocalized(comboValueStrings[i]);
|
|
}
|
|
|
|
/* Create color compound strings */
|
|
|
|
numColorStrings = XtNumber(colorStrings);
|
|
colorXmstrings = (XmString *)XtMalloc(numColorStrings *
|
|
sizeof(XmString*));
|
|
for (i = 0; i < numColorStrings; i++) {
|
|
colorXmstrings[i] =
|
|
|
|
XmStringCreateLocalized(colorStrings[i]);
|
|
}
|
|
|
|
/* Create title label */
|
|
|
|
labelString = XmStringCreateLocalized(“ComboBox Widget”);
|
|
n = 0;
|
|
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
|
titleLabel = XmCreateLabel(parent, “title”, args, n);
|
|
XtManageChild(titleLabel);
|
|
XmStringFree(labelString);
|
|
|
|
|
|
/*
|
|
* Create an editable ComboBox containing the color strings.
|
|
* Get the widget id of the drop down list, add some greek
|
|
* letter names to it, and make more items visible.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNcomboBoxType, DtDROP_DOWN_COMBO_BOX); n++;
|
|
XtSetArg(args[n], DtNitems, colorXmstrings); n++;
|
|
XtSetArg(args[n], DtNitemCount, numColorStrings); n++;
|
|
XtSetArg(args[n], DtNvisibleItemCount, 5); n++;
|
|
XtSetArg(args[n], DtNcolumns, 10); n++;
|
|
comboBox = DtCreateComboBox(parent, “comboBox1”, args, n);
|
|
XtManageChild(comboBox);
|
|
|
|
list = XtNameToWidget(comboBox, “*List”);
|
|
XmListAddItems(list, valueXmstrings, 10, 0);
|
|
XtVaSetValues(list, XmNvisibleItemCount, 10, NULL);
|
|
|
|
|
|
/*
|
|
* Create an editable ComboBox with no entries.
|
|
* Get the widget id of the drop down list, add some greek
|
|
* letter names to it and select the third item in the list.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNcomboBoxType, DtDROP_DOWN_COMBO_BOX); n++;
|
|
XtSetArg(args[n], DtNorientation, DtLEFT); n++;
|
|
XtSetArg(args[n], DtNcolumns, 10); n++;
|
|
comboBox = DtCreateComboBox(parent, “comboBox2”, args, n);
|
|
XtManageChild(comboBox);
|
|
|
|
list = XtNameToWidget(comboBox, “*List”);
|
|
XmListAddItems(list, valueXmstrings, 7, 0);
|
|
XtVaSetValues(list, XmNvisibleItemCount, 7, NULL);
|
|
XtVaSetValues(comboBox, DtNselectedPosition, 3, NULL);
|
|
|
|
|
|
/*
|
|
* Create a non-editable ComboBox containing some greek letter
|
|
|
|
names.
|
|
* Position the arrow on the left.
|
|
* Select the `gamma' item in the list.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNorientation, DtLEFT); n++;
|
|
XtSetArg(args[n], DtNitems, valueXmstrings); n++;
|
|
XtSetArg(args[n], DtNitemCount, numValueStrings); n++;
|
|
XtSetArg(args[n], DtNvisibleItemCount, 8); n++;
|
|
comboBox = DtCreateComboBox(parent, “comboBox3”, args, n);
|
|
XtManageChild(comboBox);
|
|
|
|
xmString = XmStringCreateLocalized(“gamma”);
|
|
XtVaSetValues(comboBox, DtNselectedItem, xmString, NULL);
|
|
XmStringFree(xmString);
|
|
|
|
/*
|
|
* Create a non-editable ComboBox with no entries.
|
|
* Position the arrow on the right.
|
|
* Add the greek letter names to the list and select the fourth
|
|
item.
|
|
*/
|
|
|
|
n = 0;
|
|
XtSetArg(args[n], DtNorientation, DtRIGHT); n++;
|
|
XtSetArg(args[n], DtNvisibleItemCount, 8); n++;
|
|
comboBox = DtCreateComboBox(parent, “comboBox4”, args, n);
|
|
XtManageChild(comboBox);
|
|
|
|
for (i = 0; i < numValueStrings; i++) {
|
|
DtComboBoxAddItem(comboBox, valueXmstrings[i],
|
|
0, True);
|
|
}
|
|
XtVaSetValues(comboBox, DtNselectedPosition, 4, NULL);
|
|
|
|
/*
|
|
* Free value and color strings, ComboBox has taken a copy.
|
|
*/
|
|
|
|
for (i = 0; i < numValueStrings; i++) {
|
|
XmStringFree(valueXmstrings[i]);
|
|
}
|
|
XtFree((char*)valueXmstrings);
|
|
|
|
for (i = 0; i < numColorStrings; i++) {
|
|
XmStringFree(colorXmstrings[i]);
|
|
}
|
|
XtFree((char*)colorXmstrings);
|
|
}</ProgramListing>
|
|
</Sect2>
|
|
</Sect1>
|
|
<Sect1 Id="PG.widgs.div.28">
|
|
<Title Id="PG.widgs.mkr.13">Menu Button Widget (DtMenuButton)<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font> widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>menu button widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>menu button</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>pop-up menu button widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>pop-up menu</Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>Use the <Command>DtMenuButton</Command> widget to provide menu-cascading functionality
|
|
outside of a menu pane.</Para>
|
|
<Para><Command>DtMenuButton</Command> widget is a command widget that complements the menu<IndexTerm>
|
|
<Primary>cascading menu widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>cascading menu</Secondary>
|
|
</IndexTerm>
|
|
cascading functionality of an <Command>XmCascadeButton</Command> widget. As a complement to
|
|
<Command>XmCascadeButton</Command> widget, it can only be instantiated outside a <Command>MenuBar</Command>,
|
|
<Command>Pulldown</Command>, or <Command>Popup</Command> (use <Command>XmCascadeButton</Command> widget inside a <Command>MenuPane</Command>.)
|
|
<!--Original XRef content: 'Figure 7‐2'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.9"> shows examples of a <Command>DtMenuButton</Command> widget.</Para>
|
|
<Figure>
|
|
<Title Id="PG.widgs.mkr.14">Examples of menu button widget (DtMenuButton)<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>illustration</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>illustration</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Graphic Entityref="PG.widgs.fig.3" Id="PG.widgs.grph.3"></Graphic>
|
|
</Figure>
|
|
<Sect2 Id="PG.widgs.div.29">
|
|
<Title>Library and Header Files<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>header file</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>header file</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary><Filename>libDtWidget<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>libDtWidget<Default Para Font> library</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtMenuButton</Command> widget is in the <Command>libDtWidget</Command> library. The header file is
|
|
<Filename>Dt/MenuButton.h</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.30">
|
|
<Title>Demo Program<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>demo program</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>demo program</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>A demo containing an example of the <Command>DtMenuButton</Command> widget is in
|
|
<Filename>/usr/dt/examples/dtwidget/controls.c</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.31">
|
|
<Title>Convenience Functions<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>convenience functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>convenience functions</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><Filename>DtCreateMenuButton()</Filename> is a convenience function that creates a Common
|
|
Desktop Environment widget.</Para>
|
|
<Para><Command>DtMenuButton</Command> widget is a subclass of <Command>XmLabel</Command> class. Visually,
|
|
<Command>DtMenuButton</Command> widget has a label string and a menu glyph. The menu glyph
|
|
always appears on the right end of the widget and, by default, is a downward
|
|
pointing arrow.</Para>
|
|
<Para><Command>DtMenuButton</Command> widget has an implicitly created submenu attached to it. The
|
|
submenu is a pop-up menu and has this <Command>DtMenuButton</Command> widget as its parent.
|
|
The name of the implicitly created submenu is obtained by prefixing
|
|
<Filename>submenu_</Filename> to the name of this <Command>DtMenuButton</Command> widget. You can obtain the
|
|
widget ID of the submenu by setting an <Command>XtGetValues</Command> on <Command>DtNsubMenuId</Command>
|
|
resource of this <Command>DtMenuButton</Command> widget. The implicitly created submenu must
|
|
not be destroyed by the user of this widget.</Para>
|
|
<Para>The submenu can be popped up by pressing the menu post button (see
|
|
<Command>XmNmenuPost</Command> resource of <Command>XmRowColumn</Command>) anywhere on the <Command>DtMenuButton</Command>
|
|
widget or by pressing the Motif Cancel key (usually Escape).</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.32">
|
|
<Title>Classes<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>classes</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>classes</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><Command>DtMenuButtonWidget</Command> inherits behavior and resources from <Command>Core</Command>,
|
|
<Command>XmPrimitive</Command>, and <Command>XmLabel</Command> classes.</Para>
|
|
<Para>The class pointer is <Command>dtMenuButtonWidgetClass</Command>.</Para>
|
|
<Para>The class name is <Command>DtMenuButtonWidget</Command>.</Para>
|
|
<Para><Command>DtMenuButtonWidget</Command> does not support subclassing.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.33">
|
|
<Title>Resources<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>resources</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>resources</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><Command>DtMenuButtonWidget</Command> provides the following resources.
|
|
<!--Original XRef content: 'Table 7‐7'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.15"> shows the
|
|
class, type, default, and access for these resources.</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>DtNcascadingCallback</Command> specifies the list of callbacks that are called before
|
|
the attached submenu is displayed.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNcascadePixmap</Command> specifies the pixmap that is displayed as the menu
|
|
glyph. If no pixmap is specified, a downward pointing arrow is displayed.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNsubMenuId</Command> specifies the widget ID of the pop-up menu pane to be
|
|
associated with this <Command>DtMenuButton</Command> widget. You must create the pop-up
|
|
menu pane with this <Command>DtMenuButton</Command> as its parent. You cannot specify this
|
|
resource when the widget is created because the submenu is automatically
|
|
destroyed by this widget when the resource is set.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>See the <Filename MoreInfo="RefEntry">DtMenuButtonWidget</Filename>(3) man page for more information.</Para>
|
|
<Para>The codes in the access column show if you can:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para>Set the resource at creation time (C)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Set by using <Command>XtSetValues</Command> (S)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Retrieve by using <Command>XtGetValues</Command> (G)</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Table Id="PG.widgs.tbl.7" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.15">DtMenuButtonWidget Resources</Title>
|
|
<TGroup Cols="5">
|
|
<ColSpec Colname="1" Colwidth="1.8 in">
|
|
<ColSpec Colname="2" Colwidth="1.5 in">
|
|
<ColSpec Colname="3" Colwidth="1.27857 in">
|
|
<ColSpec Colname="4" Colwidth="1.70714 in">
|
|
<ColSpec Colname="5" Colwidth="0.7 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Name</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Class</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Type</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Default</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Access</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcascadingCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>XtCallbackList</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para><Command>C</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcascadePixmap</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCPixmap</Command></Para></Entry>
|
|
<Entry><Para><Command>Pixmap</Command></Para></Entry>
|
|
<Entry><Para><Filename>XmUNSPECIFIED_PIXMAP</Filename></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNsubMenuId</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCMenuWidget</Command></Para></Entry>
|
|
<Entry><Para><Command>Widget</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para><Command>SG</Command></Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.34">
|
|
<Title>Callback Structures<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>callback structures</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>callback structures</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The callback structure follows and is described in
|
|
<!--Original XRef content: 'Table 7‐8'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.16">.</Para>
|
|
<ProgramListing>typedef struct {
|
|
int <Symbol Role="Variable">reason</Symbol>;
|
|
XEvent <Symbol Role="Variable">*event</Symbol>;
|
|
} XmAnyCallbackStruct;</ProgramListing>
|
|
<Table Id="PG.widgs.tbl.8" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.16">DtMenuButtonWidget Callback Structures</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="1.25 in">
|
|
<ColSpec Colname="2" Colwidth="3.74009 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Structure</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">reason</Symbol></Para></Entry>
|
|
<Entry><Para>Returns reason why the callback was invoked.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">event</Symbol></Para></Entry>
|
|
<Entry><Para>Points to the <Command>XEvent</Command> that triggered the callback or <Command>NULL</Command> if the
|
|
callback was not triggered by an XEvent.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.35">
|
|
<Title>Example of DtMenuButton Widget<IndexTerm>
|
|
<Primary><Filename>DtMenuButton<Default Para Font></Primary>
|
|
<Secondary>example code</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>code example</Primary>
|
|
<Secondary><Filename>DtMenuButton<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The following example shows how to create and use a <Command>DtMenuButton</Command> widget.
|
|
You can find this code as part of the <Filename>controls.c</Filename> demo in the
|
|
<Filename>/usr/dt/examples/dtwidget</Filename> directory.</Para>
|
|
<ProgramListing>/*
|
|
* Example code for DtMenuButton
|
|
*/
|
|
|
|
#include Dt/DtMenuButton.h
|
|
|
|
/* MenuButton custom glyph */
|
|
|
|
#define menu_glyph_width 16
|
|
#define menu_glyph_height 16
|
|
static unsigned char menu_glyph_bits[] = {
|
|
0xe0, 0x03, 0x98, 0x0f, 0x84, 0x1f, 0x82, 0x3f, 0x82, 0x3f, 0x81,
|
|
|
|
0x7f,
|
|
0x81, 0x7f, 0xff, 0x7f, 0xff, 0x40, 0xff, 0x40, 0xfe, 0x20, 0xfe,
|
|
|
|
0x20,
|
|
0xfc, 0x10, 0xf8, 0x0c, 0xe0, 0x03, 0x00, 0x00};
|
|
|
|
static void CreateMenuButtons(Widget parent)
|
|
{
|
|
Widget menuButton, submenu, titleLabel, button;
|
|
Pixmap cascadePixmap;
|
|
Pixel fg, bg;
|
|
Cardinal depth;
|
|
XmString labelString;
|
|
Arg args[20];
|
|
int i, n;
|
|
|
|
/* Create title label */
|
|
|
|
labelString = XmStringCreateLocalized(“MenuButton Widget”);
|
|
n = 0;
|
|
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
|
titleLabel = XmCreateLabel(parent, “title”, args, n);
|
|
XtManageChild(titleLabel);
|
|
XmStringFree(labelString);
|
|
|
|
/*
|
|
* Create a MenuButton.
|
|
* Add push buttons to the built-in popup menu.
|
|
*/
|
|
|
|
labelString = XmStringCreateLocalized(“Action”);
|
|
n = 0;
|
|
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
|
menuButton = DtCreateMenuButton(parent, “menuButton1”, args, n);
|
|
XtManageChild(menuButton);
|
|
XmStringFree(labelString);
|
|
|
|
XtVaGetValues(menuButton, DtNsubMenuId, &submenu, NULL);
|
|
button = XmCreatePushButton(submenu, “Push”, NULL, 0);
|
|
XtManageChild(button);
|
|
button = XmCreatePushButton(submenu, “Pull”, NULL, 0);
|
|
XtManageChild(button);
|
|
button = XmCreatePushButton(submenu, “Turn”, NULL, 0);
|
|
XtManageChild(button);
|
|
|
|
/*
|
|
* Create a MenuButton.
|
|
* Replace the built-in popup menu with a tear-off menu.
|
|
* Add a custom pixmap in the colors of the MenuButton.
|
|
*/
|
|
|
|
labelString = XmStringCreateLocalized(“Movement”);
|
|
n = 0;
|
|
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
|
menuButton = DtCreateMenuButton(parent, “menuButton1”, args, n);
|
|
XtManageChild(menuButton);
|
|
XmStringFree(labelString);
|
|
|
|
/* Create a tear-off menu */
|
|
|
|
n = 0;
|
|
XtSetArg(args[0], XmNtearOffModel, XmTEAR_OFF_ENABLED); n++;
|
|
submenu = XmCreatePopupMenu(menuButton, “submenu”, args, n);
|
|
button = XmCreatePushButton(submenu, “Run”, NULL, 0);
|
|
XtManageChild(button);
|
|
button = XmCreatePushButton(submenu, “Jump”, NULL, 0);
|
|
XtManageChild(button);
|
|
button = XmCreatePushButton(submenu, “Stop”, NULL, 0);
|
|
XtManageChild(button);
|
|
|
|
XtVaSetValues(menuButton, DtNsubMenuId, submenu, NULL);
|
|
|
|
/* Create a pixmap using the menu button's colors and depth */
|
|
|
|
XtVaGetValues(menuButton,
|
|
XmNforeground, &fg,
|
|
XmNbackground, &bg,
|
|
XmNdepth, &depth,
|
|
NULL);
|
|
|
|
cascadePixmap = XCreatePixmapFromBitmapData(XtDisplay
|
|
(menuButton),DefaultRootWindow(XtDisplay
|
|
(menuButton)),
|
|
(char*)menu_glyph_bits,
|
|
menu_glyph_width, menu_glyph_height,
|
|
fg, bg, depth);
|
|
XtVaSetValues(menuButton, DtNcascadePixmap, cascadePixmap,
|
|
|
|
NULL);
|
|
}</ProgramListing>
|
|
</Sect2>
|
|
</Sect1>
|
|
<Sect1 Id="PG.widgs.div.36">
|
|
<Title Id="PG.widgs.mkr.17">Text Editor Widget (DtEditor)<IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary>text editor</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>text editor widget</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>widget</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font> widget</Primary>
|
|
</IndexTerm></Title>
|
|
<Para>The Common Desktop Environment text editing system consists of two
|
|
components:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para>The text editor client, <Command>dtpad</Command>, which provides editing services through
|
|
graphical, action, and ToolTalk interfaces.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>The editor widget, <Filename MoreInfo="RefEntry">DtEditor</Filename>(3), which provides a programmatic interface
|
|
for the following editing services:</Para>
|
|
<ItemizedList Remap="Bullet2">
|
|
<ListItem>
|
|
<Para>Cut and paste</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Search and replace</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Simple formatting</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Spell checking (for 8-bit locales)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Undo previous edit</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Enhanced I/O handling capabilities that support input and output of
|
|
ASCII text, multibyte text, and buffers of data</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Support for reading and writing files directly</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>Although the Motif text widget also provides a programmatic interface,
|
|
applications that use the system-wide uniform editor should use the
|
|
<Filename MoreInfo="RefEntry">DtEditor</Filename>(3) widget. The Common Desktop Environment Text Editor and
|
|
Mailer use the editor widget. Use this widget in the following circumstances:</Para>
|
|
<OrderedList>
|
|
<ListItem>
|
|
<Para>You want the functionality, such as spell checking, undo, and find/change,
|
|
that is provided by the <Filename MoreInfo="RefEntry">DtEditor</Filename>(3) widget.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>You do not want to write the code so that users may read and write data to
|
|
and from a file.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Your program does not need to examine every character typed or every
|
|
cursor movement made by a user.</Para>
|
|
</ListItem>
|
|
</OrderedList>
|
|
<Para>This section describes the text editor widget, <Filename MoreInfo="RefEntry">DtEditor</Filename>(3).</Para>
|
|
<Para>The Editor Widget library provides support for creating and editing text files.
|
|
It enables applications running in the desktop environment to have a
|
|
consistent method of editing text data. The <Filename MoreInfo="RefEntry">DtEditor</Filename>(3) widget consists of a
|
|
scrolled edit window for text, an optional status line, and dialogs for finding
|
|
and changing text, spell checking, and specifying formatting options. The text
|
|
editor widget includes a set of convenience functions for programmatically
|
|
controlling the widget.</Para>
|
|
<Sect2 Id="PG.widgs.div.37">
|
|
<Title>Library and Header Files<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>header file</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>header files</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary><Filename>libDtWidget<Default Para Font> library</Primary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>library</Primary>
|
|
<Secondary><Filename>libDtWidget<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> widget is in the <Command>libDtWidget</Command> library. The header file is
|
|
<Filename>Dt/Editor.h</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.38">
|
|
<Title>Demo Program<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>demo program</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>demo program</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>A demo containing an example of the <Command>DtEditor</Command> widget is in
|
|
<Filename>/usr/dt/examples/dtwidget/editor.c</Filename>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.39">
|
|
<Title>Classes<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>classes</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>classes</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>Widget subclassing is not supported for the <Command>DtEditor</Command> widget class.</Para>
|
|
<Para><Command>DtEditor</Command> inherits behavior and resources from <Command>Core</Command>, <Command>Composite</Command>,
|
|
<Command>Constraints</Command>, <Command>XmManager</Command>, and <Command>XmForm</Command> classes.</Para>
|
|
<Para>The class name for the editor widget is <Command>DtEditorWidget</Command>.</Para>
|
|
<Para>The class pointer is <Command>dtEditorWidgetClass</Command>.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.40">
|
|
<Title>Convenience Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>convenience functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>convenience functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> convenience functions are described in the following tables.</Para>
|
|
<Sect3 Id="PG.widgs.div.41">
|
|
<Title>Life Cycle Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>life cycle functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>life cycle functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> life cycle functions are described in
|
|
<!--Original XRef content: 'Table 7‐9'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.18">.</Para>
|
|
<Table Id="PG.widgs.tbl.9" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.18">DtEditor Life Cycle Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="2.125 in">
|
|
<ColSpec Colname="2" Colwidth="2.87897 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtCreateEditor</Command></Para></Entry>
|
|
<Entry><Para>Creates a new instance of a <Command>DtEditor</Command> widget
|
|
and its children.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorReset</Command></Para></Entry>
|
|
<Entry><Para>Restores a <Command>DtEditor</Command> widget to its initial state.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect3>
|
|
<Sect3 Id="PG.widgs.div.42">
|
|
<Title>Input/Output Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>input/output functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>input/output functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> input/output functions are described in
|
|
<!--Original XRef content: 'Table 7‐10'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.19">.</Para>
|
|
<Table Id="PG.widgs.tbl.10" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.19">DtEditor Input/Output Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="2.25 in">
|
|
<ColSpec Colname="2" Colwidth="2.75 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorAppend</Command></Para></Entry>
|
|
<Entry><Para>Appends content data to the end of an editor
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorAppendFromFile</Command></Para></Entry>
|
|
<Entry><Para>Appends the contents of a file to the end of
|
|
an editor widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorGetContents</Command></Para></Entry>
|
|
<Entry><Para>Retrieves the entire contents of an editor
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorInsert</Command></Para></Entry>
|
|
<Entry><Para>Inserts content data at the current insert
|
|
position.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorInsertFromFile</Command></Para></Entry>
|
|
<Entry><Para>Inserts the contents of a file at the current
|
|
insert position.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtEditorReplace</Para></Entry>
|
|
<Entry><Para>Replaces a portion of text with the supplied
|
|
data.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtEditorReplaceFromFile</Para></Entry>
|
|
<Entry><Para>Replaces a portion of text with the contents of
|
|
a file.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorSaveContentsToFile</Command></Para></Entry>
|
|
<Entry><Para>Saves the entire contents to a file.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorSetContents</Command></Para></Entry>
|
|
<Entry><Para>Loads content data into an editor widget,
|
|
replacing the entire contents of the widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorSetContentsFromFile</Command></Para></Entry>
|
|
<Entry><Para>Loads the contents of a file into an editor
|
|
widget, replacing the entire contents of the
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect3>
|
|
<Sect3 Id="PG.widgs.div.43">
|
|
<Title>Selection Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>selection functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>selection functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> selection functions are described in
|
|
<!--Original XRef content: 'Table 7‐11'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.20">.</Para>
|
|
<Table Id="PG.widgs.tbl.11" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.20">DtEditor Selection Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="2.25 in">
|
|
<ColSpec Colname="2" Colwidth="2.75 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorClearSelection</Command></Para></Entry>
|
|
<Entry><Para>Replaces the currently selected contents with
|
|
blanks.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorCopyToClipboard</Command></Para></Entry>
|
|
<Entry><Para>Copies the currently selected contents to the
|
|
clipboard.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorCutToClipboard</Command></Para></Entry>
|
|
<Entry><Para>Removes the currently selected contents,
|
|
placing then on the clipboard.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorDeleteSelection</Command></Para></Entry>
|
|
<Entry><Para>Removes the currently selected contents.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorDeselect</Command></Para></Entry>
|
|
<Entry><Para>Deselects any selected contents.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorPasteFromClipboard</Command></Para></Entry>
|
|
<Entry><Para>Pastes the contents of the clipboard into an
|
|
editor widget, replacing any currently
|
|
selected contents.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorSelectAll</Command></Para></Entry>
|
|
<Entry><Para>Selects the entire contents of an editor widget.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect3>
|
|
<Sect3 Id="PG.widgs.div.44">
|
|
<Title>Format Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>format functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>format functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> format functions are described in
|
|
<!--Original XRef content: 'Table 7‐12'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.21">.</Para>
|
|
<Table Id="PG.widgs.tbl.12" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.21">DtEditor Format Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="2.12302 in">
|
|
<ColSpec Colname="2" Colwidth="2.85715 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorFormat</Command></Para></Entry>
|
|
<Entry><Para>Formats all or part of the contents of an editor
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorInvokeFormatDialog</Command></Para></Entry>
|
|
<Entry><Para>Displays the format dialog box that enables the
|
|
user to specify format settings for margins and
|
|
justification style and to perform formatting
|
|
operations.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect3>
|
|
<Sect3 Id="PG.widgs.div.45">
|
|
<Title>Find and Change Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>find and change functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>find and change functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> find and change functions are described in
|
|
<!--Original XRef content: 'Table 7‐13'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.22">.</Para>
|
|
<Table Id="PG.widgs.tbl.13" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.22">DtEditArea Find and Change Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="2.5 in">
|
|
<ColSpec Colname="2" Colwidth="2.5 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorChange</Command></Para></Entry>
|
|
<Entry><Para>Changes one or all occurrences of a
|
|
string.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorFind</Command></Para></Entry>
|
|
<Entry><Para>Finds the next occurrence of a string.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorInvokeFindChangeDialog</Command></Para></Entry>
|
|
<Entry><Para>Displays the dialog box that enables the
|
|
user to search for, and optionally change,
|
|
a string.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorInvokeSpellDialog</Command></Para></Entry>
|
|
<Entry><Para>Displays a dialog box with a list of
|
|
misspelled words in the current contents.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect3>
|
|
<Sect3 Id="PG.widgs.div.46">
|
|
<Title>Auxiliary Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>auxiliary functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>auxiliary functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> auxiliary functions are described in
|
|
<!--Original XRef content: 'Table 7‐14'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.23">.</Para>
|
|
<Table Id="PG.widgs.tbl.14" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.23">DtEditor Auxiliary Functions</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="2.5 in">
|
|
<ColSpec Colname="2" Colwidth="2.5 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Function</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorCheckForUnsavedChanges</Command></Para></Entry>
|
|
<Entry><Para>Reports whether the contents of an editor
|
|
widget have been altered since the last
|
|
time they were retrieved or saved.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtEditorDisableRedisplay</Para></Entry>
|
|
<Entry><Para>Prevents redisplay of an editor widget
|
|
even though its visual attributes have
|
|
changed.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtEditorEnableRedisplay</Para></Entry>
|
|
<Entry><Para>Forces the visual update of an editor
|
|
widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorGetInsertPosition</Command></Para></Entry>
|
|
<Entry><Para>Returns the insertion cursor position of
|
|
the editor widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorGetLastPosition</Command></Para></Entry>
|
|
<Entry><Para>Returns the position of the last character
|
|
in the edit window.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorGetMessageTextFieldID</Command></Para></Entry>
|
|
<Entry><Para>Retrieves the widget ID of the text field
|
|
widget used to display application
|
|
messages.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorGetSizeHints</Command></Para></Entry>
|
|
<Entry><Para>Retrieves sizing information from an
|
|
editor widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorGoToLine</Command></Para></Entry>
|
|
<Entry><Para>Moves the insertion cursor to the
|
|
specified line.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorSetInsertionPosition</Command></Para></Entry>
|
|
<Entry><Para>Sets the position of the insertion cursor.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorTraverseToEditor</Command></Para></Entry>
|
|
<Entry><Para>Sets keyboard traversal to the edit
|
|
window of an editor widget.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtEditorUndoEdit</Command></Para></Entry>
|
|
<Entry><Para>Undoes the last edit made by a user.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect3>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.47">
|
|
<Title>Resources<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>resources</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>resources</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> widget provides the following set of resources.</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>DtNautoShowCursorPosition</Command> ensures that the text visible in the scrolled
|
|
edit window contains the insert cursor when set to True. If the insert cursor
|
|
changes, the contents of the editor may scroll to bring the insertion point
|
|
into the window.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNblinkRate</Command> specifies the blink rate of the text cursor in milliseconds.
|
|
The time it takes to blink the insertion cursor on and off is twice the blink
|
|
rate. When the blink rate is set to zero, the cursor does not blink. The value
|
|
must not be negative.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNbuttonFontList</Command> specifies the font list used for the buttons that are
|
|
displayed in the dialog boxes of <Command>DtEditor</Command>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNcolumns</Command> specifies the initial width of the editor as an integer
|
|
number of characters. The value must be greater than zero.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNcursorPosition</Command> specifies the location of the current insert cursor in
|
|
the editor where the current insert cursor is placed. Position is determined
|
|
by the number of characters from the beginning of the text. The first
|
|
character position is 0.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNcursorPositionVisible</Command> marks the insert cursor position by a
|
|
blinking text cursor when the Boolean value is True.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNdialogTitle</Command> specifies the title for all dialogs displayed by DtEditor.
|
|
These include the dialogs for word search and replace, misspelled words,
|
|
and format settings.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNeditable</Command> indicates that the user can edit the data when set to True.
|
|
Prohibits the user from editing data when set to False.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNlabelFontList</Command> specifies the font list used for <Command>DtEditor</Command> labels (the
|
|
labels are displayed in the status line and <Command>DtEditor</Command> dialog boxes).</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNoverstrike</Command> when set to False, characters typed into the editor widget
|
|
inserts at the position of the cursor (the default). When set to True,
|
|
characters typed into the editor widget replace the characters that directly
|
|
follow the insertion cursor. When the end of the line is reached, characters
|
|
are appended to the end of the line. If the status line is visible, the
|
|
<Command>DtNoverstrikeIndicatorLabel</Command> is displayed in the status line whenever
|
|
<Command>DtNoverstrike</Command> is True.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNrows</Command> specifies the initial height of the editor measured in character
|
|
heights. The value must be greater than zero.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNscrollHorizontal</Command> adds a scroll bar that enables the user to scroll
|
|
horizontally through text when the Boolean value is True.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNscrollLeftSide</Command> puts a vertical scroll bar on the left side of the
|
|
scrolled edit window when the Boolean value is True.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNshowStatusLine</Command> displays a status line below the text window when
|
|
set to True. The status line contains a field that displays the current line
|
|
number of the insert cursor, total number of lines in the document, and
|
|
whether the editor is in overstrike mode. Users can type a line number in
|
|
the line number display to go directly to that line.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>The status line also includes a Motif <Filename MoreInfo="RefEntry">XmTextField</Filename>(3) widget for displaying
|
|
messages supplied by an application. This field is a convenient place for an
|
|
application to display status and feedback about the document being edited.
|
|
The ID of the text field is retrieved using
|
|
<Filename MoreInfo="RefEntry">DtEditorGetMessageTextFieldID</Filename>(3). A message is displayed by setting
|
|
the <Command>XmNvalue</Command> or <Command>XmNvalueWcs</Command> resource of this widget. If the text field is not
|
|
needed, you can unmanage it by calling <Filename MoreInfo="RefEntry">XtUnmanageWidget</Filename>(3) with its ID.</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>DtNspellFilter</Command> specifies the filter used to identify spelling errors. The
|
|
function <Filename MoreInfo="RefEntry">DtEditorInvokeSpellDialog</Filename>(3) filters the contents of an
|
|
editor through the filter specified by <Command>DtNspellFilter</Command>. The filter specified
|
|
should accept a file name and produce a list of misspelled and unrecognized
|
|
words in this file on <Command>stdout</Command>. The default filter is <Filename>spell</Filename>(1).</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextBackground</Command> specifies the background for the edit window.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextDeselectCallback</Command> specifies a function called whenever no text
|
|
is selected within the edit area. The reason sent by the callback is
|
|
<Filename>DtEDITOR_TEXT_DESELECT</Filename>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextFontList</Command> specifies the font list used for the <Command>DtEditor</Command> edit
|
|
window and its text fields. The text fields are displayed in the status line
|
|
and <Command>DtEditor</Command> dialog boxes.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextForeground</Command> specifies the foreground for the edit window.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextSelectCallback</Command> specifies a function called whenever text is
|
|
selected within the edit area. The reason sent by the callback is
|
|
<Filename>DtEDITOR_TEXT_SELECT</Filename>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextTranslations</Command> specifies translations that are added to the edit
|
|
window. Translations specified with this resource override any duplicate
|
|
translations defined for the edit window. See the <Filename MoreInfo="RefEntry">DtEditor</Filename>(3) man page
|
|
for a list of translations provided by <Command>DtEditor</Command>.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtopCharacter</Command> displays the line that contains the position of text at the
|
|
top of the scrolled edit window. The line is displayed at the top of the
|
|
widget without shifting the text left or right. Position is determined by the
|
|
number of characters from the beginning of the text. The first character
|
|
position is zero.</Para>
|
|
<Para><Filename MoreInfo="RefEntry">XGetValues</Filename>(3) for <Command>DtNtopCharacter</Command> returns the position of the first
|
|
character in the line that is displayed at the top of the widget.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNwordWrap</Command> breaks lines at word breaks with soft carriage returns when
|
|
they reach the right edge of the window. Note that word wrap affects only
|
|
the visual appearance of the contents of an editor widget. The line breaks
|
|
(soft carriage returns) are not physically inserted into the text. The editor
|
|
does support substituting hard carriage returns when the contents of the
|
|
widget are retrieved or saved to a file. See the <Filename MoreInfo="RefEntry">DtEditorGetContents</Filename>(3)
|
|
and <Filename MoreInfo="RefEntry">DtEditorSaveContentsToFile</Filename>(3) man pages for more information.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para><!--Original XRef content: 'Table 7‐15'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.24"> lists the class, type, default, and access for each resource. You can
|
|
also set the resource values for the inherited classes to set attributes for this
|
|
widget. To reference a resource by name or class in an <Filename>.Xdefaults</Filename> file,
|
|
remove the <Command>DtN</Command> or <Command>DtC</Command> prefix and use the remaining letters. To specify one of
|
|
the defined values for a resource in an <Filename>.Xdefaults</Filename> file, remove the <Command>Dt</Command> prefix
|
|
and use the remaining letters (in either lowercase or uppercase, but include
|
|
any underscores between words).</Para>
|
|
<Para>The codes in the access column show if you can:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para>Set the resource at creation time (C)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Set by using <Command>XtSetValues</Command> (S)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Retrieve by using <Command>XtGetValues</Command> (G)</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>See the <Filename MoreInfo="RefEntry">DtEditor</Filename>(3) man page for more information.</Para>
|
|
<Table Id="PG.widgs.tbl.15" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.24">DtEditor Resources</Title>
|
|
<TGroup Cols="5">
|
|
<ColSpec Colname="1" Colwidth="2.1131 in">
|
|
<ColSpec Colname="2" Colwidth="2.13294 in">
|
|
<ColSpec Colname="3" Colwidth="1.26984 in">
|
|
<ColSpec Colname="4" Colwidth="0.98214 in">
|
|
<ColSpec Colname="5" Colwidth="0.53571 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Name</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Class</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Type</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Default</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Access</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtNautoShowCursorPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCAutoShowCursorPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>True</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNblinkRate</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCBlinkRate</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Filename>500</Filename></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtNbuttonFontList</Para></Entry>
|
|
<Entry><Para>DtCFontList</Para></Entry>
|
|
<Entry><Para>XmFontList</Para></Entry>
|
|
<Entry><Para>Dynamic</Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcolumns</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCColumns</Command></Para></Entry>
|
|
<Entry><Para><Command>XmNcolumns</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcursorPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCursorPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>XmTextPosition</Command></Para></Entry>
|
|
<Entry><Para><Filename>0</Filename></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcursorPositionVisible</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCursorPositionVisible</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>True</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNdialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNeditable</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCEditable</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>True</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtNlabelFontList</Para></Entry>
|
|
<Entry><Para>DtCFontList</Para></Entry>
|
|
<Entry><Para>XmFontList</Para></Entry>
|
|
<Entry><Para>Dynamic</Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNmaxLength</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCMaxLength</Command></Para></Entry>
|
|
<Entry><Para><Command>int</Command></Para></Entry>
|
|
<Entry><Para><Command>Largest
|
|
integer</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNoverstrike</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCOverstrike</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>False</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNrows</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCRows</Command></Para></Entry>
|
|
<Entry><Para><Command>XmNrows</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNscrollHorizontal</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCScroll</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>True</Command></Para></Entry>
|
|
<Entry><Para><Command>CG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNscrollLeftSide</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCScrollSide</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNscrollTopSide</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCScrollSide</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>False</Command></Para></Entry>
|
|
<Entry><Para><Command>CG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNscrollVertical</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCScroll</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>True</Command></Para></Entry>
|
|
<Entry><Para><Command>CG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNshowStatusLine</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCShowStatusLine</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>False</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNspellFilter</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCspellFilter</Command></Para></Entry>
|
|
<Entry><Para><Command>char *</Command></Para></Entry>
|
|
<Entry><Para><Command>Spell</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNtextBackground</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCBackground</Command></Para></Entry>
|
|
<Entry><Para><Command>Pixel</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNtextDeselectCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>XtCallbackList</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para><Command>C</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtNtextFontList</Para></Entry>
|
|
<Entry><Para>DtCFontList</Para></Entry>
|
|
<Entry><Para>XmFontList</Para></Entry>
|
|
<Entry><Para>Dynamic</Para></Entry>
|
|
<Entry><Para>CSG</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNtextForeground</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCForeground</Command></Para></Entry>
|
|
<Entry><Para><Command>Pixel</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para>DtNtextTranslations</Para></Entry>
|
|
<Entry><Para>DtCTranslations</Para></Entry>
|
|
<Entry><Para>XtTranslations</Para></Entry>
|
|
<Entry><Para>NULL</Para></Entry>
|
|
<Entry><Para>CS</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNtextSelectCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCallback</Command></Para></Entry>
|
|
<Entry><Para><Command>XtCallbackList</Command></Para></Entry>
|
|
<Entry><Para><Command>NULL</Command></Para></Entry>
|
|
<Entry><Para><Command>C</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNtopCharacter</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCTextPosition</Command></Para></Entry>
|
|
<Entry><Para><Command>XmTextPosition</Command></Para></Entry>
|
|
<Entry><Para><Filename>0</Filename></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNwordWrap</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCWordWrap</Command></Para></Entry>
|
|
<Entry><Para><Command>Boolean</Command></Para></Entry>
|
|
<Entry><Para><Command>True</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.48">
|
|
<Title>Inherited Resources<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>inherited resources</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>inherited resources</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para><Command>DtEditor</Command> inherits behavior and resources from the following superclasses:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>XmForm</Command></Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>XmManager</Command></Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>Composite</Command></Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>Core</Command></Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>Refer to the appropriate man page for more information.</Para>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.49">
|
|
<Title>Localization Resources</Title>
|
|
<Para>The following list describes a set of widget resources that are designed for
|
|
localization of the <Command>DtEditor</Command> widget and its dialog boxes. Default values for
|
|
these resources depend on the locale.</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>DtNcenterToggleLabel</Command> specifies the label for the center alignment toggle
|
|
button in the Format Settings dialog box. The default value in the C locale is
|
|
Center.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNchangeAllButtonLabel</Command> specifies the label for the button in the
|
|
Find/Change dialog box that changes all occurrences of the Find string in
|
|
the document. The default value in the C locale is Change All.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNchangeButtonLabel</Command> specifies the label for the button in the
|
|
Find/Change dialog box that changes the next occurrence of the find string
|
|
in the document. The default value in the C locale is Change.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNchangeFieldLabel</Command> specifies the label for the field in the Find/Change
|
|
dialog box where the user specifies the replacement string. The default
|
|
value in the C locale is Change To.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNcurrentLineLabel</Command> specifies the label for the current line number field
|
|
in the status line. The default value in the C locale is Line.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNfindButtonLabel</Command> specifies the label for the button in the
|
|
Find/Change dialog box that finds the next occurrence of the find string in
|
|
the document. The default value in the C locale is Find.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNfindChangeDialogTitle</Command> specifies the title for the Find/Change
|
|
dialog box. If <Command>DtNdialogTitle</Command> is non-null, it is added to the front of this
|
|
resource to form the title. The default value in the C locale is Find/Change.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNfindFieldLabel</Command> specifies the label for the field in the Find/Change
|
|
dialog box where the user specifies the search string. The default value in
|
|
the C locale is Find.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNformatAllButtonLabel</Command> specifies the label for the button in the
|
|
Format Settings dialog box that formats the complete document. The default
|
|
value in the C locale is All.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNformatParagraphButtonLabel</Command> specifies the label for the button in
|
|
the Format Settings dialog box that formats the paragraph containing the
|
|
insertion cursor. The default value in the C locale is Paragraph.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNformatSettingsDialogTitle</Command> specifies the title for the Format
|
|
Settings dialog box. If DtNdialogTitle is non-null, it is added to the front of
|
|
this resource to form the title. The default value in the C locale is Format
|
|
Settings.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNinformationDialogTitle</Command> specifies the title for the Information
|
|
dialog box that is used to present feedback and general information to the
|
|
user. If <Command>DtNdialogTitle</Command> is non-null, it is added to the front of this
|
|
resource to form the title. The default value in the C locale is Information.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNjustifyToggleLabel</Command> specifies the label for the justify alignment
|
|
toggle button in the Format Settings dialog box. The default value in the C
|
|
locale is Justify.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNleftAlignToggleLabel</Command> specifies the label for the left alignment
|
|
toggle button in the Format Settings dialog box. The default value in the C
|
|
locale is Left Align.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNleftMarginFieldLabel</Command> specifies the label for the left margin value
|
|
field in the Format Settings dialog box. The default value in the C locale is
|
|
Left Margin.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNmisspelledListLabel</Command> specifies the label for the list of unrecognized
|
|
and misspelled words in the Spell dialog box. The default value in the C
|
|
locale is Misspelled Words.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNoverstrikeLabel</Command> specifies the label in the status line that shows that
|
|
the editor is in overstrike mode. The default value in the C locale is
|
|
Overstrike.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNrightAlignToggleLabel</Command> specifies the label for the right alignment
|
|
toggle button in the Format Settings dialog box. The default value in the C
|
|
locale is Right Align.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNrightMarginFieldLabel</Command> specifies the label for the right margin value
|
|
field in the Format Settings dialog box. The default value in the C locale is
|
|
Right Margin.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNspellDialogTitle</Command> specifies the title for the Format Settings dialog
|
|
box. If <Command>DtNdialogTitle</Command> is non-null, it is added to the front of this resource
|
|
to form the title. The default value in the C locale is Spell.</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtotalLineCountLabel</Command> specifies the label for the display as part of the
|
|
status line that shows the total number of lines in the document. The default
|
|
value in the C locale is Total.</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para><!--Original XRef content: 'Table 7‐16'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.25"> lists the class, type, default, and access for each of the localization
|
|
resources. The codes in the access column show if you can:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para>Set the resource at creation time (C)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Set by using <Command>XtSetValues</Command> (S)</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>Retrieve by using <Command>XtGetValues</Command> (G)</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>See the <Filename MoreInfo="RefEntry">DtEditor</Filename>(3) man page for more information.</Para>
|
|
<Table Id="PG.widgs.tbl.16" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.25">DtEditor Localization Resources</Title>
|
|
<TGroup Cols="5">
|
|
<ColSpec Colname="1" Colwidth="2.53969 in">
|
|
<ColSpec Colname="2" Colwidth="2.32143 in">
|
|
<ColSpec Colname="3" Colwidth="0.80357 in">
|
|
<ColSpec Colname="4" Colwidth="0.73412 in">
|
|
<ColSpec Colname="5" Colwidth="0.54563 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Name</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Class</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Type</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Default</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Access</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcenterToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCenterToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNchangeAllButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCChangeAllButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNchangeButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCChangeButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNchangeFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCChangeFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNcurrentLineLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCCurrentLineLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNfindButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCFindButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNfindChangeDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCFindChangeDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNfindFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCFindFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNformatAllButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCFormatAllButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNformatParagraphButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCFormatParagraphButtonLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNformatSettingsDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCFormatSettingsDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNinformationDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCInformationDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNjustifyToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCJustifyToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNleftAlignToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCLeftAlignToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNleftMarginFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCLeftMarginFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNmisspelledListLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCMisspelledListLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNoverstrikeLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCOverstrikeLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNrightAlignToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCRightAlignToggleLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNrightMarginFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCRightMarginFieldLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNspellDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCSpellDialogTitle</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Command>DtNtotalLineCountLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>DtCTotalLineCountLabel</Command></Para></Entry>
|
|
<Entry><Para><Command>XmString</Command></Para></Entry>
|
|
<Entry><Para><Command>Dynamic</Command></Para></Entry>
|
|
<Entry><Para><Command>CSG</Command></Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
</Sect2>
|
|
<Sect2 Id="PG.widgs.div.50">
|
|
<Title>Callback Functions<IndexTerm>
|
|
<Primary><Filename>DtEditor<Default Para Font></Primary>
|
|
<Secondary>callback functions</Secondary>
|
|
</IndexTerm><IndexTerm>
|
|
<Primary>callback functions</Primary>
|
|
<Secondary><Filename>DtEditor<Default Para Font></Secondary>
|
|
</IndexTerm></Title>
|
|
<Para>The <Command>DtEditor</Command> widget supports three callback functions:</Para>
|
|
<ItemizedList Remap="Bullet1">
|
|
<ListItem>
|
|
<Para><Command>DtEditorNHelpCallback</Command></Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextSelectCallback</Command></Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para><Command>DtNtextDeselectCallback</Command></Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
<Para>If you want to present help information about the editor widget and its dialog
|
|
boxes, set the <Command>XmNhelpCallback</Command> resource and use the reason field passed as
|
|
part of <Command>DtEditorHelpCallbackStruct</Command> to set the contents of the Help dialog
|
|
box. A pointer to the following structure is passed to <Command>XmNHelpCallback</Command>. The
|
|
callback structure and is described in
|
|
<!--Original XRef content: 'Table 7‐17'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.widgs.mkr.26">.</Para>
|
|
<ProgramListing>typedef struct {
|
|
int <Symbol Role="Variable">reason</Symbol>;
|
|
XEvent *<Symbol Role="Variable">event</Symbol>;
|
|
} DtEditorHelpCallbackStruct;</ProgramListing>
|
|
<Table Id="PG.widgs.tbl.17" Frame="Topbot">
|
|
<Title Id="PG.widgs.mkr.26">DtEditorHelp Callback Structure</Title>
|
|
<TGroup Cols="2">
|
|
<ColSpec Colname="1" Colwidth="0.86309 in">
|
|
<ColSpec Colname="2" Colwidth="4.13692 in">
|
|
<THead>
|
|
<Row>
|
|
<Entry><Para><Literal>Structure</Literal></Para></Entry>
|
|
<Entry><Para><Literal>Description</Literal></Para></Entry>
|
|
</Row>
|
|
</THead>
|
|
<TBody>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">reason</Symbol></Para></Entry>
|
|
<Entry><Para>The reason why the callback was invoked. Refer to the <Filename MoreInfo="RefEntry">DtEditor</Filename>(3)
|
|
man page for a list of reasons.</Para></Entry>
|
|
</Row>
|
|
<Row>
|
|
<Entry><Para><Symbol Role="Variable">event</Symbol></Para></Entry>
|
|
<Entry><Para>A pointer to the event that invoked this callback. The value can be
|
|
NULL.</Para></Entry>
|
|
</Row>
|
|
</TBody>
|
|
</TGroup>
|
|
</Table>
|
|
<Para>Use the <Command>DtNtextSelectCallback</Command> and <Command>DtNtextDeselectCallback</Command>
|
|
resources when you want to enable and disable menu items and commands
|
|
depending on whether text is selected. <Command>DtNtextSelectCallback</Command> specifies a
|
|
function that is called whenever some text is selected in the edit window.
|
|
<Command>DtNtextDeselectCallback</Command> specifies a function that is called whenever no
|
|
text is selected within the edit window. The reasons sent by the callbacks are
|
|
<Filename>DtEDITOR_TEXT_SELECT</Filename> and <Filename>DtEDITOR_TEXT_DESELECT</Filename>.</Para>
|
|
</Sect2>
|
|
</Sect1>
|
|
</Chapter>
|
|
<!--fickle 1.14 mif-to-docbook 1.7 01/02/96 09:54:57-->
|