10568f49bSmrg<?xml version="1.0" encoding="UTF-8" ?> 20568f49bSmrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> 30568f49bSmrg 49e7bcd65Smrg<chapter id='Translation_Management'> 59e7bcd65Smrg<title>Translation Management</title> 69e7bcd65Smrg<para> 79e7bcd65SmrgExcept under unusual circumstances, 89e7bcd65Smrgwidgets do not hardwire the mapping of user events into widget behavior 99e7bcd65Smrgby using the event manager. 109e7bcd65SmrgInstead, they provide a default mapping of events into behavior 119e7bcd65Smrgthat you can override. 129e7bcd65Smrg</para> 139e7bcd65Smrg 149e7bcd65Smrg<para> 159e7bcd65SmrgThe translation manager provides an interface to specify and manage the 169e7bcd65Smrgmapping of X event sequences into widget-supplied functionality, 179e7bcd65Smrgfor example, calling procedure <emphasis remap='I'>Abc</emphasis> when the <emphasis remap='I'>y</emphasis> key 189e7bcd65Smrgis pressed. 199e7bcd65Smrg</para> 209e7bcd65Smrg 219e7bcd65Smrg<para> 229e7bcd65SmrgThe translation manager uses two kinds of tables to perform translations: 239e7bcd65Smrg</para> 249e7bcd65Smrg<itemizedlist spacing='compact'> 259e7bcd65Smrg <listitem> 269e7bcd65Smrg <para> 279e7bcd65SmrgThe action tables, which are in the widget class structure, 289e7bcd65Smrgspecify the mapping of externally available procedure name strings 299e7bcd65Smrgto the corresponding procedure implemented by the widget class. 309e7bcd65Smrg </para> 319e7bcd65Smrg </listitem> 329e7bcd65Smrg <listitem> 339e7bcd65Smrg <para> 349e7bcd65SmrgA translation table, which is in the widget class structure, 359e7bcd65Smrgspecifies the mapping of event sequences to procedure name strings. 369e7bcd65Smrg </para> 379e7bcd65Smrg </listitem> 389e7bcd65Smrg</itemizedlist> 399e7bcd65Smrg<para> 409e7bcd65SmrgYou can override the translation table in the class structure 419e7bcd65Smrgfor a specific widget instance by supplying a different translation table 429e7bcd65Smrgfor the widget instance. The resources 439e7bcd65SmrgXtNtranslations and XtNbaseTranslations are used to modify the class 449e7bcd65Smrgdefault translation table; see <xref linkend='Translation_Table_Management' />. 459e7bcd65Smrg</para> 469e7bcd65Smrg<sect1 id="Action_Tables"> 479e7bcd65Smrg<title>Action Tables</title> 489e7bcd65Smrg<para> 499e7bcd65SmrgAll widget class records contain an action table, 509e7bcd65Smrgan array of 519e7bcd65Smrg<function>XtActionsRec</function> 529e7bcd65Smrgentries. 539e7bcd65SmrgIn addition, 549e7bcd65Smrgan application can register its own action tables with the translation manager 559e7bcd65Smrgso that the translation tables it provides to widget instances can access 569e7bcd65Smrgapplication functionality directly. 579e7bcd65SmrgThe translation action procedure pointer is of type 589e7bcd65Smrg<xref linkend='XtActionProc' xrefstyle='select: title'/>. 599e7bcd65Smrg</para> 609e7bcd65Smrg 619e7bcd65Smrg<funcsynopsis id='XtActionProc'> 629e7bcd65Smrg<funcprototype> 639e7bcd65Smrg<funcdef>typedef void <function>(*XtActionProc)</function></funcdef> 649e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 659e7bcd65Smrg <paramdef>XEvent *<parameter>event</parameter></paramdef> 669e7bcd65Smrg <paramdef>String *<parameter>params</parameter></paramdef> 679e7bcd65Smrg <paramdef>Cardinal *<parameter>num_params</parameter></paramdef> 689e7bcd65Smrg</funcprototype> 699e7bcd65Smrg</funcsynopsis> 709e7bcd65Smrg 719e7bcd65Smrg<variablelist> 729e7bcd65Smrg <varlistentry> 739e7bcd65Smrg <term> 749e7bcd65Smrg <emphasis remap='I'>w</emphasis> 759e7bcd65Smrg </term> 769e7bcd65Smrg <listitem> 779e7bcd65Smrg <para> 789e7bcd65SmrgSpecifies the widget that caused the action to be called. 799e7bcd65Smrg </para> 809e7bcd65Smrg </listitem> 819e7bcd65Smrg </varlistentry> 829e7bcd65Smrg <varlistentry> 839e7bcd65Smrg <term> 849e7bcd65Smrg <emphasis remap='I'>event</emphasis> 859e7bcd65Smrg </term> 869e7bcd65Smrg <listitem> 879e7bcd65Smrg <para> 889e7bcd65SmrgSpecifies the event that caused the action to be called. 899e7bcd65SmrgIf the action is called after a sequence of events, 909e7bcd65Smrgthen the last event in the sequence is used. 919e7bcd65Smrg </para> 929e7bcd65Smrg </listitem> 939e7bcd65Smrg </varlistentry> 949e7bcd65Smrg <varlistentry> 959e7bcd65Smrg <term> 969e7bcd65Smrg <emphasis remap='I'>params</emphasis> 979e7bcd65Smrg </term> 989e7bcd65Smrg <listitem> 999e7bcd65Smrg <para> 1009e7bcd65SmrgSpecifies a pointer to the list of strings that were specified 1019e7bcd65Smrgin the translation table as arguments to the action, or NULL. 1029e7bcd65Smrg </para> 1039e7bcd65Smrg </listitem> 1049e7bcd65Smrg </varlistentry> 1059e7bcd65Smrg <varlistentry> 1069e7bcd65Smrg <term> 1079e7bcd65Smrg <emphasis remap='I'>num_params</emphasis> 1089e7bcd65Smrg </term> 1099e7bcd65Smrg <listitem> 1109e7bcd65Smrg <para> 1119e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>params</emphasis>. 1129e7bcd65Smrg </para> 1139e7bcd65Smrg </listitem> 1149e7bcd65Smrg </varlistentry> 1159e7bcd65Smrg</variablelist> 1169e7bcd65Smrg 1170568f49bSmrg<programlisting> 1189e7bcd65Smrgtypedef struct _XtActionsRec { 1190568f49bSmrg String string; 1200568f49bSmrg XtActionProc proc; 1219e7bcd65Smrg} XtActionsRec, *XtActionList; 1220568f49bSmrg</programlisting> 1239e7bcd65Smrg<para> 1249e7bcd65SmrgThe <emphasis remap='I'>string</emphasis> field is the name used in translation tables to access 1259e7bcd65Smrgthe procedure. 1269e7bcd65SmrgThe <emphasis remap='I'>proc</emphasis> field is a pointer to a procedure that implements 1279e7bcd65Smrgthe functionality. 1289e7bcd65Smrg</para> 1299e7bcd65Smrg 1309e7bcd65Smrg<para> 1319e7bcd65SmrgWhen the action list is specified as the 1329e7bcd65Smrg<function>CoreClassPart</function> 1339e7bcd65Smrg<emphasis remap='I'>actions</emphasis> field, the string pointed to by <emphasis remap='I'>string</emphasis> must be 1349e7bcd65Smrgpermanently allocated prior to or during the execution of the class 1359e7bcd65Smrginitialization procedure and must not be subsequently deallocated. 1369e7bcd65Smrg</para> 1379e7bcd65Smrg 1389e7bcd65Smrg<para> 1399e7bcd65SmrgAction procedures should not assume that the widget in which they 1409e7bcd65Smrgare invoked is realized; an accelerator specification can cause 1419e7bcd65Smrgan action procedure to be called for a widget that does not yet 1429e7bcd65Smrghave a window. Widget writers should also note which of a widget's 1439e7bcd65Smrgcallback lists are invoked from action procedures and warn clients 1449e7bcd65Smrgnot to assume the widget is realized in those callbacks. 1459e7bcd65Smrg</para> 1469e7bcd65Smrg 1479e7bcd65Smrg<para> 1489e7bcd65SmrgFor example, a Pushbutton widget has procedures to take the following actions: 1499e7bcd65Smrg</para> 1509e7bcd65Smrg<itemizedlist spacing='compact'> 1519e7bcd65Smrg <listitem> 1529e7bcd65Smrg <para> 1539e7bcd65SmrgSet the button to indicate it is activated. 1549e7bcd65Smrg </para> 1559e7bcd65Smrg </listitem> 1569e7bcd65Smrg <listitem> 1579e7bcd65Smrg <para> 1589e7bcd65SmrgUnset the button back to its normal mode. 1599e7bcd65Smrg </para> 1609e7bcd65Smrg </listitem> 1619e7bcd65Smrg <listitem> 1629e7bcd65Smrg <para> 1639e7bcd65SmrgHighlight the button borders. 1649e7bcd65Smrg </para> 1659e7bcd65Smrg </listitem> 1669e7bcd65Smrg <listitem> 1679e7bcd65Smrg <para> 1689e7bcd65SmrgUnhighlight the button borders. 1699e7bcd65Smrg </para> 1709e7bcd65Smrg </listitem> 1719e7bcd65Smrg <listitem> 1729e7bcd65Smrg <para> 1739e7bcd65SmrgNotify any callbacks that the button has been activated. 1749e7bcd65Smrg </para> 1759e7bcd65Smrg </listitem> 1769e7bcd65Smrg</itemizedlist> 1779e7bcd65Smrg<para> 1789e7bcd65SmrgThe action table for the Pushbutton widget class makes these functions 1799e7bcd65Smrgavailable to translation tables written for Pushbutton or any subclass. 1809e7bcd65SmrgThe string entry is the name used in translation tables. 1819e7bcd65SmrgThe procedure entry (usually spelled identically to the string) 1829e7bcd65Smrgis the name of the C procedure that implements that function: 1839e7bcd65Smrg</para> 1840568f49bSmrg<programlisting> 1859e7bcd65SmrgXtActionsRec actionTable[] = { 1860568f49bSmrg {"Set", Set}, 1870568f49bSmrg {"Unset", Unset}, 1880568f49bSmrg {"Highlight", Highlight}, 1890568f49bSmrg {"Unhighlight", Unhighlight} 1900568f49bSmrg {"Notify", Notify}, 1919e7bcd65Smrg}; 1920568f49bSmrg</programlisting> 1939e7bcd65Smrg<para> 1949e7bcd65SmrgThe Intrinsics reserve all action names and parameters starting with 1950568f49bSmrgthe characters “Xt” for future standard enhancements. Users, 1969e7bcd65Smrgapplications, and widgets should not declare action names or pass 1979e7bcd65Smrgparameters starting with these characters except to invoke specified 1989e7bcd65Smrgbuilt-in Intrinsics functions. 1999e7bcd65Smrg</para> 2009e7bcd65Smrg<sect2 id="Action_Table_Registration"> 2019e7bcd65Smrg<title>Action Table Registration</title> 2029e7bcd65Smrg<para> 2039e7bcd65SmrgThe <emphasis remap='I'>actions</emphasis> and <emphasis remap='I'>num_actions</emphasis> fields of 2049e7bcd65Smrg<function>CoreClassPart</function> 2059e7bcd65Smrgspecify the actions implemented by a widget class. These are 2069e7bcd65Smrgautomatically registered with the Intrinsics when the class is initialized 2079e7bcd65Smrgand must be allocated in writable storage prior to Core class_part 2089e7bcd65Smrginitialization, and never deallocated. To save memory and optimize 2099e7bcd65Smrgaccess, the Intrinsics may overwrite the storage in order to compile the 2109e7bcd65Smrglist into an internal representation. 2119e7bcd65Smrg</para> 2129e7bcd65Smrg 2139e7bcd65Smrg<para> 2149e7bcd65SmrgTo declare an action table within an application 2159e7bcd65Smrgand register it with the translation manager, use 2169e7bcd65Smrg<xref linkend='XtAppAddActions' xrefstyle='select: title'/>. 2179e7bcd65Smrg</para> 2189e7bcd65Smrg 2199e7bcd65Smrg<funcsynopsis id='XtAppAddActions'> 2209e7bcd65Smrg<funcprototype> 2219e7bcd65Smrg<funcdef>void <function>XtAppAddActions</function></funcdef> 2229e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 2239e7bcd65Smrg <paramdef>XtActionList <parameter>actions</parameter></paramdef> 2249e7bcd65Smrg <paramdef>Cardinal <parameter>num_actions</parameter></paramdef> 2259e7bcd65Smrg</funcprototype> 2269e7bcd65Smrg</funcsynopsis> 2279e7bcd65Smrg 2289e7bcd65Smrg<variablelist> 2299e7bcd65Smrg <varlistentry> 2309e7bcd65Smrg <term> 2319e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 2329e7bcd65Smrg </term> 2339e7bcd65Smrg <listitem> 2349e7bcd65Smrg <para> 2359e7bcd65SmrgSpecifies the application context. 2369e7bcd65Smrg </para> 2379e7bcd65Smrg </listitem> 2389e7bcd65Smrg </varlistentry> 2399e7bcd65Smrg <varlistentry> 2409e7bcd65Smrg <term> 2419e7bcd65Smrg <emphasis remap='I'>actions</emphasis> 2429e7bcd65Smrg </term> 2439e7bcd65Smrg <listitem> 2449e7bcd65Smrg <para> 2459e7bcd65SmrgSpecifies the action table to register. 2469e7bcd65Smrg </para> 2479e7bcd65Smrg </listitem> 2489e7bcd65Smrg </varlistentry> 2499e7bcd65Smrg <varlistentry> 2509e7bcd65Smrg <term> 2519e7bcd65Smrg <emphasis remap='I'>num_actions</emphasis> 2529e7bcd65Smrg </term> 2539e7bcd65Smrg <listitem> 2549e7bcd65Smrg <para> 2559e7bcd65SmrgSpecifies the number of entries in this action table. 2569e7bcd65Smrg </para> 2579e7bcd65Smrg </listitem> 2589e7bcd65Smrg </varlistentry> 2599e7bcd65Smrg</variablelist> 2609e7bcd65Smrg 2619e7bcd65Smrg<para> 2629e7bcd65SmrgIf more than one action is registered with the same name, 2639e7bcd65Smrgthe most recently registered action is used. 2649e7bcd65SmrgIf duplicate actions exist in an action table, 2659e7bcd65Smrgthe first is used. 2669e7bcd65SmrgThe Intrinsics register an action table containing 2679e7bcd65Smrg<xref linkend='XtMenuPopup' xrefstyle='select: title'/> 2689e7bcd65Smrgand 2699e7bcd65Smrg<xref linkend='XtMenuPopdown' xrefstyle='select: title'/> 2709e7bcd65Smrgas part of 2719e7bcd65Smrg<xref linkend='XtCreateApplicationContext' xrefstyle='select: title'/>. 2729e7bcd65Smrg</para> 2739e7bcd65Smrg</sect2> 2749e7bcd65Smrg 2759e7bcd65Smrg<sect2 id="Action_Names_to_Procedure_Translations"> 2769e7bcd65Smrg<title>Action Names to Procedure Translations</title> 2779e7bcd65Smrg<para> 2789e7bcd65SmrgThe translation manager uses a simple algorithm to resolve the name of 2799e7bcd65Smrga procedure specified in a translation table into the 2809e7bcd65Smrgactual procedure specified 2819e7bcd65Smrgin an action table. 2829e7bcd65SmrgWhen the widget 2839e7bcd65Smrgis realized, the translation manager 2849e7bcd65Smrgperforms a search for the name in the following tables, in order: 2859e7bcd65Smrg</para> 2869e7bcd65Smrg<itemizedlist spacing='compact'> 2879e7bcd65Smrg <listitem> 2889e7bcd65Smrg <para> 2899e7bcd65SmrgThe widget's class and all superclass action tables, in subclass-to-superclass 2909e7bcd65Smrgorder. 2919e7bcd65Smrg </para> 2929e7bcd65Smrg </listitem> 2939e7bcd65Smrg <listitem> 2949e7bcd65Smrg <para> 2959e7bcd65SmrgThe parent's class and all superclass action tables, in subclass-to-superclass 2969e7bcd65Smrgorder, then on up the ancestor tree. 2979e7bcd65Smrg </para> 2989e7bcd65Smrg </listitem> 2999e7bcd65Smrg <listitem> 3009e7bcd65Smrg <para> 3019e7bcd65SmrgThe action tables registered with 3029e7bcd65Smrg<xref linkend='XtAppAddActions' xrefstyle='select: title'/> 3039e7bcd65Smrgand 3049e7bcd65Smrg<xref linkend='XtAddActions' xrefstyle='select: title'/> 3059e7bcd65Smrgfrom the most recently added table to the oldest table. 3069e7bcd65Smrg </para> 3079e7bcd65Smrg </listitem> 3089e7bcd65Smrg</itemizedlist> 3099e7bcd65Smrg<para> 3109e7bcd65SmrgAs soon as it finds a name, 3119e7bcd65Smrgthe translation manager stops the search. 3129e7bcd65SmrgIf it cannot find a name, 3139e7bcd65Smrgthe translation manager generates a warning message. 3149e7bcd65Smrg</para> 3159e7bcd65Smrg</sect2> 3169e7bcd65Smrg 3179e7bcd65Smrg<sect2 id="Action_Hook_Registration"> 3189e7bcd65Smrg<title>Action Hook Registration</title> 3199e7bcd65Smrg<para> 3209e7bcd65SmrgAn application can specify a procedure that will be called just before 3219e7bcd65Smrgevery action routine is dispatched by the translation manager. To do 3229e7bcd65Smrgso, the application supplies a procedure pointer of type 3239e7bcd65Smrg<xref linkend='XtActionHookProc' xrefstyle='select: title'/>. 3249e7bcd65Smrg</para> 3259e7bcd65Smrg 3269e7bcd65Smrg<funcsynopsis id='XtActionHookProc'> 3279e7bcd65Smrg<funcprototype> 3289e7bcd65Smrg<funcdef>typedef void <function>(*XtActionHookProc)</function></funcdef> 3299e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 3309e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 3319e7bcd65Smrg <paramdef>String <parameter>action_name</parameter></paramdef> 3329e7bcd65Smrg <paramdef>XEvent* <parameter>event</parameter></paramdef> 3339e7bcd65Smrg <paramdef>String* <parameter>params</parameter></paramdef> 3349e7bcd65Smrg <paramdef>Cardinal* <parameter>num_params</parameter></paramdef> 3359e7bcd65Smrg</funcprototype> 3369e7bcd65Smrg</funcsynopsis> 3379e7bcd65Smrg 3389e7bcd65Smrg 3399e7bcd65Smrg 3409e7bcd65Smrg<variablelist> 3419e7bcd65Smrg <varlistentry> 3429e7bcd65Smrg <term> 3439e7bcd65Smrg <emphasis remap='I'>w</emphasis> 3449e7bcd65Smrg </term> 3459e7bcd65Smrg <listitem> 3469e7bcd65Smrg <para> 3479e7bcd65SmrgSpecifies the widget whose action is about to be dispatched. 3489e7bcd65Smrg </para> 3499e7bcd65Smrg </listitem> 3509e7bcd65Smrg </varlistentry> 3519e7bcd65Smrg <varlistentry> 3529e7bcd65Smrg <term> 3539e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 3549e7bcd65Smrg </term> 3559e7bcd65Smrg <listitem> 3569e7bcd65Smrg <para> 3579e7bcd65SmrgSpecifies the application-specific closure that was passed to 3589e7bcd65Smrg<function>XtAppAddActionHook.</function> 3599e7bcd65Smrg </para> 3609e7bcd65Smrg </listitem> 3619e7bcd65Smrg </varlistentry> 3629e7bcd65Smrg <varlistentry> 3639e7bcd65Smrg <term> 3649e7bcd65Smrg <emphasis remap='I'>action_name</emphasis> 3659e7bcd65Smrg </term> 3669e7bcd65Smrg <listitem> 3679e7bcd65Smrg <para> 3689e7bcd65SmrgSpecifies the name of the action to be dispatched. 3699e7bcd65Smrg </para> 3709e7bcd65Smrg </listitem> 3719e7bcd65Smrg </varlistentry> 3729e7bcd65Smrg <varlistentry> 3739e7bcd65Smrg <term> 3749e7bcd65Smrg <emphasis remap='I'>event</emphasis> 3759e7bcd65Smrg </term> 3769e7bcd65Smrg <listitem> 3779e7bcd65Smrg <para> 3789e7bcd65SmrgSpecifies the event argument that will be passed to the action routine. 3799e7bcd65Smrg </para> 3809e7bcd65Smrg </listitem> 3819e7bcd65Smrg </varlistentry> 3829e7bcd65Smrg <varlistentry> 3839e7bcd65Smrg <term> 3849e7bcd65Smrg <emphasis remap='I'>params</emphasis> 3859e7bcd65Smrg </term> 3869e7bcd65Smrg <listitem> 3879e7bcd65Smrg <para> 3889e7bcd65SmrgSpecifies the action parameters that will be passed to the action routine. 3899e7bcd65Smrg </para> 3909e7bcd65Smrg </listitem> 3919e7bcd65Smrg </varlistentry> 3929e7bcd65Smrg <varlistentry> 3939e7bcd65Smrg <term> 3949e7bcd65Smrg <emphasis remap='I'>num_params</emphasis> 3959e7bcd65Smrg </term> 3969e7bcd65Smrg <listitem> 3979e7bcd65Smrg <para> 3989e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>params</emphasis>. 3999e7bcd65Smrg </para> 4009e7bcd65Smrg </listitem> 4019e7bcd65Smrg </varlistentry> 4029e7bcd65Smrg</variablelist> 4039e7bcd65Smrg 4049e7bcd65Smrg<para> 4059e7bcd65SmrgAction hooks should not modify any of the data pointed to by the 4069e7bcd65Smrgarguments other than the <emphasis remap='I'>client_data</emphasis> argument. 4079e7bcd65Smrg</para> 4089e7bcd65Smrg 4099e7bcd65Smrg<para> 4109e7bcd65SmrgTo add an action hook, use 4119e7bcd65Smrg<xref linkend='XtAppAddActionHook' xrefstyle='select: title'/>. 4129e7bcd65Smrg</para> 4139e7bcd65Smrg 4149e7bcd65Smrg<funcsynopsis id='XtAppAddActionHook'> 4159e7bcd65Smrg<funcprototype> 4169e7bcd65Smrg<funcdef>XtActionHookId <function>XtAppAddActionHook</function></funcdef> 4179e7bcd65Smrg <paramdef>XtAppContext <parameter>app</parameter></paramdef> 4189e7bcd65Smrg <paramdef>XtActionHookProc <parameter>proc</parameter></paramdef> 4199e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 4209e7bcd65Smrg</funcprototype> 4219e7bcd65Smrg</funcsynopsis> 4229e7bcd65Smrg 4239e7bcd65Smrg<variablelist> 4249e7bcd65Smrg <varlistentry> 4259e7bcd65Smrg <term> 4269e7bcd65Smrg <emphasis remap='I'>app</emphasis> 4279e7bcd65Smrg </term> 4289e7bcd65Smrg <listitem> 4299e7bcd65Smrg <para> 4309e7bcd65SmrgSpecifies the application context. 4319e7bcd65Smrg </para> 4329e7bcd65Smrg </listitem> 4339e7bcd65Smrg </varlistentry> 4349e7bcd65Smrg <varlistentry> 4359e7bcd65Smrg <term> 4369e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 4379e7bcd65Smrg </term> 4389e7bcd65Smrg <listitem> 4399e7bcd65Smrg <para> 4409e7bcd65SmrgSpecifies the action hook procedure. 4419e7bcd65Smrg </para> 4429e7bcd65Smrg </listitem> 4439e7bcd65Smrg </varlistentry> 4449e7bcd65Smrg <varlistentry> 4459e7bcd65Smrg <term> 4469e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 4479e7bcd65Smrg </term> 4489e7bcd65Smrg <listitem> 4499e7bcd65Smrg <para> 4509e7bcd65SmrgSpecifies application-specific data to be passed to the action hook. 4519e7bcd65Smrg </para> 4529e7bcd65Smrg </listitem> 4539e7bcd65Smrg </varlistentry> 4549e7bcd65Smrg</variablelist> 4559e7bcd65Smrg 4569e7bcd65Smrg<para> 4579e7bcd65Smrg<xref linkend='XtAppAddActionHook' xrefstyle='select: title'/> 4589e7bcd65Smrgadds the specified procedure to the front of a list 4599e7bcd65Smrgmaintained in the application context. In the future, when an action 4609e7bcd65Smrgroutine is about to be invoked for any widget in this application 4619e7bcd65Smrgcontext, either through the translation manager or via 4629e7bcd65Smrg<xref linkend='XtCallActionProc' xrefstyle='select: title'/>, 4639e7bcd65Smrgthe action hook procedures will be called in reverse 4649e7bcd65Smrgorder of registration just prior to invoking the action routine. 4659e7bcd65Smrg</para> 4669e7bcd65Smrg 4679e7bcd65Smrg<para> 4689e7bcd65SmrgAction hook procedures are removed automatically and the 4699e7bcd65Smrg<function>XtActionHookId is</function> 4709e7bcd65Smrgdestroyed when the application context in which 4719e7bcd65Smrgthey were added is destroyed. 4729e7bcd65Smrg</para> 4739e7bcd65Smrg 4749e7bcd65Smrg<para> 4759e7bcd65SmrgTo remove an action hook procedure without destroying the application 4769e7bcd65Smrgcontext, use 4779e7bcd65Smrg<xref linkend='XtRemoveActionHook' xrefstyle='select: title'/>. 4789e7bcd65Smrg</para> 4799e7bcd65Smrg 4809e7bcd65Smrg<funcsynopsis id='XtRemoveActionHook'> 4819e7bcd65Smrg<funcprototype> 4829e7bcd65Smrg<funcdef>void <function>XtRemoveActionHook</function></funcdef> 4839e7bcd65Smrg <paramdef>XtActionHookId <parameter>id</parameter></paramdef> 4849e7bcd65Smrg</funcprototype> 4859e7bcd65Smrg</funcsynopsis> 4869e7bcd65Smrg 4879e7bcd65Smrg<variablelist> 4889e7bcd65Smrg <varlistentry> 4899e7bcd65Smrg <term> 4909e7bcd65Smrg <emphasis remap='I'>id</emphasis> 4919e7bcd65Smrg </term> 4929e7bcd65Smrg <listitem> 4939e7bcd65Smrg <para> 4949e7bcd65SmrgSpecifies the action hook id returned by 4959e7bcd65Smrg<xref linkend='XtAppAddActionHook' xrefstyle='select: title'/>. 4969e7bcd65Smrg </para> 4979e7bcd65Smrg </listitem> 4989e7bcd65Smrg </varlistentry> 4999e7bcd65Smrg</variablelist> 5009e7bcd65Smrg 5019e7bcd65Smrg<para> 5029e7bcd65Smrg<xref linkend='XtRemoveActionHook' xrefstyle='select: title'/> 5039e7bcd65Smrgremoves the specified action hook procedure from 5049e7bcd65Smrgthe list in which it was registered. 5059e7bcd65Smrg</para> 5069e7bcd65Smrg</sect2> 5079e7bcd65Smrg</sect1> 5089e7bcd65Smrg 5099e7bcd65Smrg<sect1 id="Translation_Tables"> 5109e7bcd65Smrg<title>Translation Tables</title> 5119e7bcd65Smrg<para> 5129e7bcd65SmrgAll widget instance records contain a translation table, 5139e7bcd65Smrgwhich is a resource with a default value specified elsewhere in the 5149e7bcd65Smrgclass record. 5159e7bcd65SmrgA translation table specifies what action procedures are invoked for 5169e7bcd65Smrgan event or a sequence of events. 5179e7bcd65SmrgA translation table 5189e7bcd65Smrgis a string containing a list of translations from an event sequence 5199e7bcd65Smrginto one or more action procedure calls. 5209e7bcd65SmrgThe translations are separated from one another by newline characters 5219e7bcd65Smrg(ASCII LF). 5229e7bcd65SmrgThe complete syntax of translation tables is specified in Appendix B. 5239e7bcd65Smrg</para> 5249e7bcd65Smrg 5259e7bcd65Smrg<para> 5269e7bcd65SmrgAs an example, the default behavior of Pushbutton is 5279e7bcd65Smrg</para> 5289e7bcd65Smrg<itemizedlist spacing='compact'> 5299e7bcd65Smrg <listitem> 5309e7bcd65Smrg <para> 5319e7bcd65SmrgHighlight on enter window. 5329e7bcd65Smrg </para> 5339e7bcd65Smrg </listitem> 5349e7bcd65Smrg <listitem> 5359e7bcd65Smrg <para> 5369e7bcd65SmrgUnhighlight on exit window. 5379e7bcd65Smrg </para> 5389e7bcd65Smrg </listitem> 5399e7bcd65Smrg <listitem> 5409e7bcd65Smrg <para> 5419e7bcd65SmrgInvert on left button down. 5429e7bcd65Smrg </para> 5439e7bcd65Smrg </listitem> 5449e7bcd65Smrg <listitem> 5459e7bcd65Smrg <para> 5469e7bcd65SmrgCall callbacks and reinvert on left button up. 5479e7bcd65Smrg </para> 5489e7bcd65Smrg </listitem> 5499e7bcd65Smrg</itemizedlist> 5509e7bcd65Smrg<para> 5519e7bcd65SmrgThe following illustrates Pushbutton's default translation table: 5529e7bcd65Smrg</para> 5530568f49bSmrg<programlisting> 5549e7bcd65Smrgstatic String defaultTranslations = 5550568f49bSmrg "<EnterWindow>: Highlight()\n\ 5560568f49bSmrg <LeaveWindow>: Unhighlight()\n\ 5570568f49bSmrg <Btn1Down>: Set()\n\ 5580568f49bSmrg <Btn1Up>: Notify() Unset()"; 5590568f49bSmrg</programlisting> 5609e7bcd65Smrg<para> 5619e7bcd65SmrgThe <emphasis remap='I'>tm_table</emphasis> field of the 5629e7bcd65Smrg<function>CoreClassPart</function> 5639e7bcd65Smrgshould be filled in at class initialization time with 5649e7bcd65Smrgthe string containing the class's default translations. 5659e7bcd65SmrgIf a class wants to inherit its superclass's translations, 5669e7bcd65Smrgit can store the special value 5679e7bcd65Smrg<function>XtInheritTranslations</function> 5689e7bcd65Smrginto <emphasis remap='I'>tm_table</emphasis>. 5699e7bcd65SmrgIn Core's class part initialization procedure, 5709e7bcd65Smrgthe Intrinsics compile this translation table into an efficient internal form. 5719e7bcd65SmrgThen, at widget creation time, 5729e7bcd65Smrgthis default translation table is 5739e7bcd65Smrgcombined with the XtNtranslations 5749e7bcd65Smrgand XtNbaseTranslations resources; see 5759e7bcd65Smrg<xref linkend='Translation_Table_Management' />. 5769e7bcd65Smrg</para> 5779e7bcd65Smrg 5789e7bcd65Smrg<para> 5799e7bcd65SmrgThe resource conversion mechanism automatically compiles 5809e7bcd65Smrgstring translation tables that are specified in the resource database. 5819e7bcd65SmrgIf a client uses translation tables that are not retrieved via a 5829e7bcd65Smrgresource conversion, 5839e7bcd65Smrgit must compile them itself using 5849e7bcd65Smrg<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/>. 5859e7bcd65Smrg</para> 5869e7bcd65Smrg 5879e7bcd65Smrg<para> 5889e7bcd65SmrgThe Intrinsics use the compiled form of the translation table to register the 5899e7bcd65Smrgnecessary events with the event manager. 5909e7bcd65SmrgWidgets need do nothing other than specify the action and translation tables 5919e7bcd65Smrgfor events to be processed by the translation manager. 5929e7bcd65Smrg</para> 5939e7bcd65Smrg<sect2 id="Event_Sequences"> 5949e7bcd65Smrg<title>Event Sequences</title> 5959e7bcd65Smrg<para> 5969e7bcd65SmrgAn event sequence is a comma-separated list of X event descriptions 5979e7bcd65Smrgthat describes a specific sequence of X events to map to a set of 5989e7bcd65Smrgprogram actions. 5999e7bcd65SmrgEach X event description consists of three parts: 6009e7bcd65SmrgThe X event type, a prefix consisting of the X modifier bits, and 6019e7bcd65Smrgan event-specific suffix. 6029e7bcd65Smrg</para> 6039e7bcd65Smrg 6049e7bcd65Smrg<para> 6059e7bcd65SmrgVarious abbreviations are supported to make translation tables easier 6069e7bcd65Smrgto read. The events must match incoming events in left-to-right order 6079e7bcd65Smrgto trigger the action sequence. 6089e7bcd65Smrg</para> 6099e7bcd65Smrg</sect2> 6109e7bcd65Smrg 6119e7bcd65Smrg<sect2 id="Action_Sequences"> 6129e7bcd65Smrg<title>Action Sequences</title> 6139e7bcd65Smrg<para> 6149e7bcd65SmrgAction sequences specify what program or widget actions to take in response to 6159e7bcd65Smrgincoming X events. An action sequence consists of space-separated 6169e7bcd65Smrgaction procedure call specifications. 6179e7bcd65SmrgEach action procedure call consists of the name of an action procedure and a 6189e7bcd65Smrgparenthesized list of zero or more comma-separated 6199e7bcd65Smrgstring parameters to pass to that procedure. 6209e7bcd65SmrgThe actions are invoked in left-to-right order as specified in the 6219e7bcd65Smrgaction sequence. 6229e7bcd65Smrg</para> 6239e7bcd65Smrg</sect2> 6249e7bcd65Smrg 6259e7bcd65Smrg<sect2 id="Multi_Click_Time"> 6269e7bcd65Smrg<title>Multi-Click Time</title> 6279e7bcd65Smrg<para> 6289e7bcd65SmrgTranslation table entries may specify actions that are taken when two 6299e7bcd65Smrgor more identical events occur consecutively within a short time 6309e7bcd65Smrginterval, called the multi-click time. The multi-click time value may 6310568f49bSmrgbe specified as an application resource with name “multiClickTime” and 6320568f49bSmrgclass “MultiClickTime” and may also be modified dynamically by the 6339e7bcd65Smrgapplication. The multi-click time is unique for each Display value and 6349e7bcd65Smrgis retrieved from the resource database by 6359e7bcd65Smrg<xref linkend='XtDisplayInitialize' xrefstyle='select: title'/>. 6369e7bcd65SmrgIf no value is specified, the initial value is 200 milliseconds. 6379e7bcd65Smrg</para> 6389e7bcd65Smrg 6399e7bcd65Smrg<para> 6409e7bcd65SmrgTo set the multi-click time dynamically, use 6419e7bcd65Smrg<xref linkend='XtSetMultiClickTime' xrefstyle='select: title'/>. 6429e7bcd65Smrg</para> 6439e7bcd65Smrg 6449e7bcd65Smrg<funcsynopsis id='XtSetMultiClickTime'> 6459e7bcd65Smrg<funcprototype> 6469e7bcd65Smrg<funcdef>void <function>XtSetMultiClickTime</function></funcdef> 6479e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 6489e7bcd65Smrg <paramdef>int <parameter>time</parameter></paramdef> 6499e7bcd65Smrg</funcprototype> 6509e7bcd65Smrg</funcsynopsis> 6519e7bcd65Smrg 6529e7bcd65Smrg<variablelist> 6539e7bcd65Smrg <varlistentry> 6549e7bcd65Smrg <term> 6559e7bcd65Smrg <emphasis remap='I'>display</emphasis> 6569e7bcd65Smrg </term> 6579e7bcd65Smrg <listitem> 6589e7bcd65Smrg <para> 6599e7bcd65SmrgSpecifies the display connection. 6609e7bcd65Smrg </para> 6619e7bcd65Smrg </listitem> 6629e7bcd65Smrg </varlistentry> 6639e7bcd65Smrg <varlistentry> 6649e7bcd65Smrg <term> 6659e7bcd65Smrg <emphasis remap='I'>time</emphasis> 6669e7bcd65Smrg </term> 6679e7bcd65Smrg <listitem> 6689e7bcd65Smrg <para> 6699e7bcd65SmrgSpecifies the multi-click time in milliseconds. 6709e7bcd65Smrg </para> 6719e7bcd65Smrg </listitem> 6729e7bcd65Smrg </varlistentry> 6739e7bcd65Smrg</variablelist> 6749e7bcd65Smrg 6759e7bcd65Smrg<para> 6769e7bcd65Smrg<xref linkend='XtSetMultiClickTime' xrefstyle='select: title'/> 6779e7bcd65Smrgsets the time interval used by the translation 6789e7bcd65Smrgmanager to determine when multiple events are interpreted as a 6799e7bcd65Smrgrepeated event. When a repeat count is specified in a translation 6809e7bcd65Smrgentry, the interval between the timestamps in each pair of repeated 6819e7bcd65Smrgevents (e.g., between two 6829e7bcd65Smrg<function>ButtonPress</function> 6839e7bcd65Smrgevents) must be less than the 6849e7bcd65Smrgmulti-click time in order for the translation actions to be taken. 6859e7bcd65Smrg</para> 6869e7bcd65Smrg 6879e7bcd65Smrg<para> 6889e7bcd65SmrgTo read the multi-click time, use 6899e7bcd65Smrg<xref linkend='XtGetMultiClickTime' xrefstyle='select: title'/>. 6909e7bcd65Smrg</para> 6919e7bcd65Smrg 6929e7bcd65Smrg<funcsynopsis id='XtGetMultiClickTime'> 6939e7bcd65Smrg<funcprototype> 6949e7bcd65Smrg<funcdef>int <function>XtGetMultiClickTime</function></funcdef> 6959e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 6969e7bcd65Smrg</funcprototype> 6979e7bcd65Smrg</funcsynopsis> 6989e7bcd65Smrg 6999e7bcd65Smrg<variablelist> 7009e7bcd65Smrg <varlistentry> 7019e7bcd65Smrg <term> 7029e7bcd65Smrg <emphasis remap='I'>display</emphasis> 7039e7bcd65Smrg </term> 7049e7bcd65Smrg <listitem> 7059e7bcd65Smrg <para> 7069e7bcd65SmrgSpecifies the display connection. 7079e7bcd65Smrg </para> 7089e7bcd65Smrg </listitem> 7099e7bcd65Smrg </varlistentry> 7109e7bcd65Smrg</variablelist> 7119e7bcd65Smrg 7129e7bcd65Smrg<para> 7139e7bcd65Smrg<xref linkend='XtGetMultiClickTime' xrefstyle='select: title'/> 7149e7bcd65Smrgreturns the time in milliseconds that the 7159e7bcd65Smrgtranslation manager uses to determine if multiple events are to be 7169e7bcd65Smrginterpreted as a repeated event for purposes of matching a translation 7179e7bcd65Smrgentry containing a repeat count. 7189e7bcd65Smrg</para> 7199e7bcd65Smrg</sect2> 7209e7bcd65Smrg</sect1> 7219e7bcd65Smrg 7229e7bcd65Smrg<sect1 id="Translation_Table_Management"> 7239e7bcd65Smrg<title>Translation Table Management</title> 7249e7bcd65Smrg<para> 7259e7bcd65SmrgSometimes an application needs to merge 7269e7bcd65Smrgits own translations with a widget's translations. 7279e7bcd65SmrgFor example, a window manager provides functions to move a window. 7289e7bcd65SmrgThe window manager wishes to bind this operation to a specific 7299e7bcd65Smrgpointer button in the title bar without the possibility of user 7309e7bcd65Smrgoverride and bind it to other buttons that may be overridden by the user. 7319e7bcd65Smrg</para> 7329e7bcd65Smrg 7339e7bcd65Smrg<para> 7349e7bcd65SmrgTo accomplish this, 7359e7bcd65Smrgthe window manager should first create the title bar 7369e7bcd65Smrgand then should merge the two translation tables into 7379e7bcd65Smrgthe title bar's translations. 7389e7bcd65SmrgOne translation table contains the translations that the window manager 7399e7bcd65Smrgwants only if the user has not specified a translation for a particular event 7409e7bcd65Smrgor event sequence (i.e., those that may be overridden). 7419e7bcd65SmrgThe other translation table contains the translations that the 7429e7bcd65Smrgwindow manager wants regardless of what the user has specified. 7439e7bcd65Smrg</para> 7449e7bcd65Smrg 7459e7bcd65Smrg<para> 7469e7bcd65SmrgThree Intrinsics functions support this merging: 7479e7bcd65Smrg</para> 7489e7bcd65Smrg 7499e7bcd65Smrg<variablelist> 7509e7bcd65Smrg <varlistentry> 7519e7bcd65Smrg <term> 7529e7bcd65Smrg <emphasis remap='I'>XtParseTranslationTable</emphasis> 7539e7bcd65Smrg </term> 7549e7bcd65Smrg <listitem> 7559e7bcd65Smrg <para>Compiles a translation table.</para> 7569e7bcd65Smrg </listitem> 7579e7bcd65Smrg </varlistentry> 7589e7bcd65Smrg <varlistentry> 7599e7bcd65Smrg <term> 7609e7bcd65Smrg <emphasis remap='I'>XtAugmentTranslations</emphasis> 7619e7bcd65Smrg </term> 7629e7bcd65Smrg <listitem> 7639e7bcd65Smrg <para>Merges a compiled translation table into a widget's 7649e7bcd65Smrg compiled translation table, ignoring any new translations that 7659e7bcd65Smrg conflict with existing translations. 7669e7bcd65Smrg </para> 7679e7bcd65Smrg </listitem> 7689e7bcd65Smrg </varlistentry> 7699e7bcd65Smrg <varlistentry> 7709e7bcd65Smrg <term> 7719e7bcd65Smrg <emphasis remap='I'>XtOverrideTranslations</emphasis> 7729e7bcd65Smrg </term> 7739e7bcd65Smrg <listitem> 7749e7bcd65Smrg <para>Merges a compiled translation table into a widget's 7759e7bcd65Smrg compiled translation table, replacing any existing translations that 7769e7bcd65Smrg conflict with new translations. 7779e7bcd65Smrg </para> 7789e7bcd65Smrg </listitem> 7799e7bcd65Smrg </varlistentry> 7809e7bcd65Smrg</variablelist> 7819e7bcd65Smrg 7829e7bcd65Smrg<para> 7839e7bcd65SmrgTo compile a translation table, use 7849e7bcd65Smrg<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/>. 7859e7bcd65Smrg</para> 7869e7bcd65Smrg 7879e7bcd65Smrg<funcsynopsis id='XtParseTranslationTable'> 7889e7bcd65Smrg<funcprototype> 7899e7bcd65Smrg<funcdef>XtTranslations <function>XtParseTranslationTable</function></funcdef> 7900568f49bSmrg <paramdef>const char * <parameter>table</parameter></paramdef> 7919e7bcd65Smrg</funcprototype> 7929e7bcd65Smrg</funcsynopsis> 7939e7bcd65Smrg 7949e7bcd65Smrg<variablelist> 7959e7bcd65Smrg <varlistentry> 7969e7bcd65Smrg <term> 7979e7bcd65Smrg <emphasis remap='I'>table</emphasis> 7989e7bcd65Smrg </term> 7999e7bcd65Smrg <listitem> 8009e7bcd65Smrg <para> 8019e7bcd65SmrgSpecifies the translation table to compile. 8029e7bcd65Smrg </para> 8039e7bcd65Smrg </listitem> 8049e7bcd65Smrg </varlistentry> 8059e7bcd65Smrg</variablelist> 8069e7bcd65Smrg 8079e7bcd65Smrg<para> 8089e7bcd65SmrgThe 8099e7bcd65Smrg<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/> 8109e7bcd65Smrgfunction compiles the translation table, provided in the format given 8119e7bcd65Smrgin Appendix B, into an opaque internal representation 8129e7bcd65Smrgof type 8139e7bcd65Smrg<function>XtTranslations</function>. 8149e7bcd65SmrgNote that if an empty translation table is required for any purpose, 8159e7bcd65Smrgone can be obtained by calling 8169e7bcd65Smrg<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/> 8179e7bcd65Smrgand passing an empty string. 8189e7bcd65Smrg</para> 8199e7bcd65Smrg 8209e7bcd65Smrg<para> 8219e7bcd65SmrgTo merge additional translations into an existing translation table, use 8229e7bcd65Smrg<xref linkend='XtAugmentTranslations' xrefstyle='select: title'/>. 8239e7bcd65Smrg</para> 8249e7bcd65Smrg 8259e7bcd65Smrg<funcsynopsis id='XtAugmentTranslations'> 8269e7bcd65Smrg<funcprototype> 8279e7bcd65Smrg<funcdef>void <function>XtAugmentTranslations</function></funcdef> 8289e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 8299e7bcd65Smrg <paramdef>XtTranslations <parameter>translations</parameter></paramdef> 8309e7bcd65Smrg</funcprototype> 8319e7bcd65Smrg</funcsynopsis> 8329e7bcd65Smrg 8339e7bcd65Smrg<variablelist> 8349e7bcd65Smrg <varlistentry> 8359e7bcd65Smrg <term> 8369e7bcd65Smrg <emphasis remap='I'>w</emphasis> 8379e7bcd65Smrg </term> 8389e7bcd65Smrg <listitem> 8399e7bcd65Smrg <para> 8409e7bcd65SmrgSpecifies the widget into which the new translations are to be merged. Must be of class Core or any subclass thereof. 8419e7bcd65Smrg </para> 8429e7bcd65Smrg </listitem> 8439e7bcd65Smrg </varlistentry> 8449e7bcd65Smrg <varlistentry> 8459e7bcd65Smrg <term> 8469e7bcd65Smrg <emphasis remap='I'>translations</emphasis> 8479e7bcd65Smrg </term> 8489e7bcd65Smrg <listitem> 8499e7bcd65Smrg <para> 8509e7bcd65SmrgSpecifies the compiled translation table to merge in. 8519e7bcd65Smrg </para> 8529e7bcd65Smrg </listitem> 8539e7bcd65Smrg </varlistentry> 8549e7bcd65Smrg</variablelist> 8559e7bcd65Smrg 8569e7bcd65Smrg<para> 8579e7bcd65SmrgThe 8589e7bcd65Smrg<xref linkend='XtAugmentTranslations' xrefstyle='select: title'/> 8599e7bcd65Smrgfunction merges the new translations into the existing widget 8609e7bcd65Smrgtranslations, ignoring any 8619e7bcd65Smrg<function>#replace</function>, 8629e7bcd65Smrg<function>#augment</function>, 8639e7bcd65Smrgor 8649e7bcd65Smrg<function>#override</function> 8659e7bcd65Smrgdirective that may have been specified 8669e7bcd65Smrgin the translation string. The translation table specified by 8679e7bcd65Smrg<emphasis remap='I'>translations</emphasis> is not altered by this process. 8689e7bcd65Smrg<xref linkend='XtAugmentTranslations' xrefstyle='select: title'/> 8699e7bcd65Smrglogically appends the string representation of the new translations to 8709e7bcd65Smrgthe string representation of the widget's current translations and reparses 8719e7bcd65Smrgthe result with no warning messages about duplicate left-hand sides, then 8729e7bcd65Smrgstores the result back into the widget instance; i.e., 8739e7bcd65Smrgif the new translations contain an event or event sequence that 8749e7bcd65Smrgalready exists in the widget's translations, 8759e7bcd65Smrgthe new translation is ignored. 8769e7bcd65Smrg</para> 8779e7bcd65Smrg 8789e7bcd65Smrg<para> 8799e7bcd65SmrgTo overwrite existing translations with new translations, use 8809e7bcd65Smrg<xref linkend='XtOverrideTranslations' xrefstyle='select: title'/>. 8819e7bcd65Smrg</para> 8829e7bcd65Smrg 8839e7bcd65Smrg<funcsynopsis id='XtOverrideTranslations'> 8849e7bcd65Smrg<funcprototype> 8859e7bcd65Smrg<funcdef>void <function>XtOverrideTranslations</function></funcdef> 8869e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 8879e7bcd65Smrg <paramdef>XtTranslations <parameter>translations</parameter></paramdef> 8889e7bcd65Smrg</funcprototype> 8899e7bcd65Smrg</funcsynopsis> 8909e7bcd65Smrg 8919e7bcd65Smrg<variablelist> 8929e7bcd65Smrg <varlistentry> 8939e7bcd65Smrg <term> 8949e7bcd65Smrg <emphasis remap='I'>w</emphasis> 8959e7bcd65Smrg </term> 8969e7bcd65Smrg <listitem> 8979e7bcd65Smrg <para> 8989e7bcd65SmrgSpecifies the widget into which the new translations are to be merged. Must be of class Core or any subclass thereof. 8999e7bcd65Smrg </para> 9009e7bcd65Smrg </listitem> 9019e7bcd65Smrg </varlistentry> 9029e7bcd65Smrg <varlistentry> 9039e7bcd65Smrg <term> 9049e7bcd65Smrg <emphasis remap='I'>translations</emphasis> 9059e7bcd65Smrg </term> 9069e7bcd65Smrg <listitem> 9079e7bcd65Smrg <para> 9089e7bcd65SmrgSpecifies the compiled translation table to merge in. 9099e7bcd65Smrg </para> 9109e7bcd65Smrg </listitem> 9119e7bcd65Smrg </varlistentry> 9129e7bcd65Smrg</variablelist> 9139e7bcd65Smrg 9149e7bcd65Smrg<para> 9159e7bcd65SmrgThe 9169e7bcd65Smrg<xref linkend='XtOverrideTranslations' xrefstyle='select: title'/> 9179e7bcd65Smrgfunction merges the new translations into the existing widget 9189e7bcd65Smrgtranslations, ignoring any 9199e7bcd65Smrg<function>#replace</function>, 9209e7bcd65Smrg<function>#augment</function>, 9219e7bcd65Smrgor 9229e7bcd65Smrg<function>#override</function> 9239e7bcd65Smrgdirective that may have been 9249e7bcd65Smrgspecified in the translation string. The translation table 9259e7bcd65Smrgspecified by <emphasis remap='I'>translations</emphasis> is not altered by this process. 9269e7bcd65Smrg<xref linkend='XtOverrideTranslations' xrefstyle='select: title'/> 9279e7bcd65Smrglogically appends the string representation of the widget's current 9289e7bcd65Smrgtranslations to the string representation of the new translations and 9299e7bcd65Smrgreparses the result with no warning messages about duplicate left-hand 9309e7bcd65Smrgsides, then stores the result back into the widget instance; i.e., 9319e7bcd65Smrgif the new translations contain an event or event sequence that 9329e7bcd65Smrgalready exists in the widget's translations, 9339e7bcd65Smrgthe new translation overrides the widget's translation. 9349e7bcd65Smrg</para> 9359e7bcd65Smrg 9369e7bcd65Smrg<para> 9379e7bcd65SmrgTo replace a widget's translations completely, use 9389e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 9399e7bcd65Smrgon the XtNtranslations resource and specify a compiled translation table 9409e7bcd65Smrgas the value. 9419e7bcd65Smrg</para> 9429e7bcd65Smrg 9439e7bcd65Smrg<para> 9449e7bcd65SmrgTo make it possible for users to easily modify translation tables in their 9459e7bcd65Smrgresource files, 9469e7bcd65Smrgthe string-to-translation-table resource type converter 9479e7bcd65Smrgallows the string to specify whether the table should replace, 9489e7bcd65Smrgaugment, or override any 9499e7bcd65Smrgexisting translation table in the widget. 9509e7bcd65SmrgTo specify this, 9519e7bcd65Smrga pound sign (#) is given as the first character of the table 9520568f49bSmrgfollowed by one of the keywords “replace”, “augment”, or 9530568f49bSmrg“override” to indicate 9549e7bcd65Smrgwhether to replace, augment, or override the existing table. 9559e7bcd65SmrgThe replace or merge 9569e7bcd65Smrgoperation is performed during the 9579e7bcd65SmrgCore 9589e7bcd65Smrginstance initialization. 9599e7bcd65SmrgEach merge operation produces a new 9609e7bcd65Smrgtranslation resource value; if the original tables were shared by 9619e7bcd65Smrgother widgets, they are unaffected. If no directive is 9620568f49bSmrgspecified, “#replace” is assumed. 9639e7bcd65Smrg</para> 9649e7bcd65Smrg 9659e7bcd65Smrg<para> 9669e7bcd65SmrgAt instance initialization 9679e7bcd65Smrgthe XtNtranslations resource is first fetched. Then, if it was 9680568f49bSmrgnot specified or did not contain “#replace”, the 9699e7bcd65Smrgresource database is searched for the resource XtNbaseTranslations. 9709e7bcd65SmrgIf XtNbaseTranslations is found, it is merged into the widget class 9719e7bcd65Smrgtranslation table. Then the widget <emphasis remap='I'>translations</emphasis> field is 9729e7bcd65Smrgmerged into the result or into the class translation table if 9739e7bcd65SmrgXtNbaseTranslations was not found. This final table is then 9749e7bcd65Smrgstored into the widget <emphasis remap='I'>translations</emphasis> field. If the XtNtranslations 9750568f49bSmrgresource specified “#replace”, no merge is done. 9769e7bcd65SmrgIf neither XtNbaseTranslations or XtNtranslations are specified, 9779e7bcd65Smrgthe class translation table is copied into the widget instance. 9789e7bcd65Smrg</para> 9799e7bcd65Smrg 9809e7bcd65Smrg<para> 9819e7bcd65SmrgTo completely remove existing translations, use 9829e7bcd65Smrg<xref linkend='XtUninstallTranslations' xrefstyle='select: title'/>. 9839e7bcd65Smrg</para> 9849e7bcd65Smrg 9859e7bcd65Smrg<funcsynopsis id='XtUninstallTranslations'> 9869e7bcd65Smrg<funcprototype> 9879e7bcd65Smrg<funcdef>void <function>XtUninstallTranslations</function></funcdef> 9889e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 9899e7bcd65Smrg</funcprototype> 9909e7bcd65Smrg</funcsynopsis> 9919e7bcd65Smrg 9929e7bcd65Smrg<variablelist> 9939e7bcd65Smrg <varlistentry> 9949e7bcd65Smrg <term> 9959e7bcd65Smrg <emphasis remap='I'>w</emphasis> 9969e7bcd65Smrg </term> 9979e7bcd65Smrg <listitem> 9989e7bcd65Smrg <para> 9999e7bcd65SmrgSpecifies the widget from which the translations are to be removed. Must be of class Core or any subclass thereof. 10009e7bcd65Smrg </para> 10019e7bcd65Smrg </listitem> 10029e7bcd65Smrg </varlistentry> 10039e7bcd65Smrg</variablelist> 10049e7bcd65Smrg 10059e7bcd65Smrg<para> 10069e7bcd65SmrgThe 10079e7bcd65Smrg<xref linkend='XtUninstallTranslations' xrefstyle='select: title'/> 10089e7bcd65Smrgfunction causes the entire translation table for the widget to be removed. 10099e7bcd65Smrg</para> 10109e7bcd65Smrg</sect1> 10119e7bcd65Smrg 10129e7bcd65Smrg<sect1 id="Using_Accelerators"> 10139e7bcd65Smrg<title>Using Accelerators</title> 10149e7bcd65Smrg<para> 10159e7bcd65SmrgIt is often desirable to be able to bind events in one widget to actions in 10169e7bcd65Smrganother. 10179e7bcd65SmrgIn particular, 10189e7bcd65Smrgit is often useful to be able to invoke menu actions from the keyboard. 10199e7bcd65SmrgThe Intrinsics provide a facility, called accelerators, that lets you 10209e7bcd65Smrgaccomplish this. 10219e7bcd65SmrgAn accelerator table is a translation table that is bound with its 10229e7bcd65Smrgactions in the context of a particular widget, the <emphasis remap='I'>source</emphasis> widget. 10239e7bcd65SmrgThe accelerator table can then be installed on one or more <emphasis remap='I'>destination</emphasis> widgets. 10249e7bcd65SmrgWhen an event sequence in the destination widget would cause an 10259e7bcd65Smrgaccelerator action to be taken, and if the source widget is sensitive, 10269e7bcd65Smrgthe actions are executed as though triggered by the same event sequence 10279e7bcd65Smrgin the accelerator source 10289e7bcd65Smrgwidget. The event is 10299e7bcd65Smrgpassed to the action procedure without modification. The action 10309e7bcd65Smrgprocedures used within accelerators must not assume that the source 10319e7bcd65Smrgwidget is realized nor that any fields of the event are in reference 10329e7bcd65Smrgto the source widget's window if the widget is realized. 10339e7bcd65Smrg</para> 10349e7bcd65Smrg 10359e7bcd65Smrg<para> 10369e7bcd65SmrgEach widget instance contains that widget's exported accelerator table 10379e7bcd65Smrgas a resource. 10389e7bcd65SmrgEach class of widget exports a method that takes a 10399e7bcd65Smrgdisplayable string representation of the accelerators 10409e7bcd65Smrgso that widgets can display their current accelerators. 10419e7bcd65SmrgThe representation is the accelerator table in canonical 10429e7bcd65Smrgtranslation table form (see Appendix B). 10439e7bcd65SmrgThe display_accelerator procedure pointer is of type 10449e7bcd65Smrg<xref linkend='XtStringProc' xrefstyle='select: title'/>. 10459e7bcd65Smrg</para> 10469e7bcd65Smrg 10479e7bcd65Smrg<funcsynopsis id='XtStringProc'> 10489e7bcd65Smrg<funcprototype> 10499e7bcd65Smrg<funcdef>typedef void <function>(*XtStringProc)</function></funcdef> 10509e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 10519e7bcd65Smrg <paramdef>String <parameter>string</parameter></paramdef> 10529e7bcd65Smrg</funcprototype> 10539e7bcd65Smrg</funcsynopsis> 10549e7bcd65Smrg 10559e7bcd65Smrg<variablelist> 10569e7bcd65Smrg <varlistentry> 10579e7bcd65Smrg <term> 10589e7bcd65Smrg <emphasis remap='I'>w</emphasis> 10599e7bcd65Smrg </term> 10609e7bcd65Smrg <listitem> 10619e7bcd65Smrg <para> 10629e7bcd65SmrgSpecifies the source widget that supplied the accelerators. 10639e7bcd65Smrg </para> 10649e7bcd65Smrg </listitem> 10659e7bcd65Smrg </varlistentry> 10669e7bcd65Smrg <varlistentry> 10679e7bcd65Smrg <term> 10689e7bcd65Smrg <emphasis remap='I'>string</emphasis> 10699e7bcd65Smrg </term> 10709e7bcd65Smrg <listitem> 10719e7bcd65Smrg <para> 10729e7bcd65SmrgSpecifies the string representation of the accelerators for this widget. 10739e7bcd65Smrg </para> 10749e7bcd65Smrg </listitem> 10759e7bcd65Smrg </varlistentry> 10769e7bcd65Smrg</variablelist> 10779e7bcd65Smrg 10789e7bcd65Smrg<para> 10799e7bcd65SmrgAccelerators can be specified in resource files, 10809e7bcd65Smrgand the string representation is the same as for a translation table. 10819e7bcd65SmrgHowever, 10829e7bcd65Smrgthe interpretation of the 10839e7bcd65Smrg<function>#augment</function> 10849e7bcd65Smrgand 10859e7bcd65Smrg<function>#override</function> 10869e7bcd65Smrgdirectives applies to 10879e7bcd65Smrgwhat will happen when the accelerator is installed; 10889e7bcd65Smrgthat is, whether or not the accelerator translations will override the 10899e7bcd65Smrgtranslations in the destination widget. 10909e7bcd65SmrgThe default is 10919e7bcd65Smrg<function>#augment</function>, 10929e7bcd65Smrgwhich means that the accelerator translations have lower priority 10939e7bcd65Smrgthan the destination translations. 10949e7bcd65SmrgThe 10959e7bcd65Smrg<function>#replace</function> 10969e7bcd65Smrgdirective is ignored for accelerator tables. 10979e7bcd65Smrg</para> 10989e7bcd65Smrg 10999e7bcd65Smrg<para> 11009e7bcd65SmrgTo parse an accelerator table, use 11019e7bcd65Smrg<xref linkend='XtParseAcceleratorTable' xrefstyle='select: title'/>. 11029e7bcd65Smrg</para> 11039e7bcd65Smrg 11049e7bcd65Smrg<funcsynopsis id='XtParseAcceleratorTable'> 11059e7bcd65Smrg<funcprototype> 11069e7bcd65Smrg<funcdef>XtAccelerators <function>XtParseAcceleratorTable</function></funcdef> 11070568f49bSmrg <paramdef>const char * <parameter>source</parameter></paramdef> 11089e7bcd65Smrg</funcprototype> 11099e7bcd65Smrg</funcsynopsis> 11109e7bcd65Smrg 11119e7bcd65Smrg<variablelist> 11129e7bcd65Smrg <varlistentry> 11139e7bcd65Smrg <term> 11149e7bcd65Smrg <emphasis remap='I'>source</emphasis> 11159e7bcd65Smrg </term> 11169e7bcd65Smrg <listitem> 11179e7bcd65Smrg <para> 11189e7bcd65SmrgSpecifies the accelerator table to compile. 11199e7bcd65Smrg </para> 11209e7bcd65Smrg </listitem> 11219e7bcd65Smrg </varlistentry> 11229e7bcd65Smrg</variablelist> 11239e7bcd65Smrg 11249e7bcd65Smrg<para> 11259e7bcd65SmrgThe 11269e7bcd65Smrg<xref linkend='XtParseAcceleratorTable' xrefstyle='select: title'/> 11279e7bcd65Smrgfunction compiles the accelerator table into an opaque internal representation. 11289e7bcd65SmrgThe client 11299e7bcd65Smrgshould set the XtNaccelerators resource of 11309e7bcd65Smrgeach widget that is to be activated by these translations 11319e7bcd65Smrgto the returned value. 11329e7bcd65Smrg</para> 11339e7bcd65Smrg 11349e7bcd65Smrg<para> 11359e7bcd65SmrgTo install accelerators from a widget on another widget, use 11369e7bcd65Smrg<xref linkend='XtInstallAccelerators' xrefstyle='select: title'/>. 11379e7bcd65Smrg</para> 11389e7bcd65Smrg 11399e7bcd65Smrg<funcsynopsis id='XtInstallAccelerators'> 11409e7bcd65Smrg<funcprototype> 11419e7bcd65Smrg<funcdef>void <function>XtInstallAccelerators</function></funcdef> 11429e7bcd65Smrg <paramdef>Widget <parameter>destination</parameter></paramdef> 11439e7bcd65Smrg <paramdef>Widget <parameter>source</parameter></paramdef> 11449e7bcd65Smrg</funcprototype> 11459e7bcd65Smrg</funcsynopsis> 11469e7bcd65Smrg 11479e7bcd65Smrg<variablelist> 11489e7bcd65Smrg <varlistentry> 11499e7bcd65Smrg <term> 11509e7bcd65Smrg <emphasis remap='I'>destination</emphasis> 11519e7bcd65Smrg </term> 11529e7bcd65Smrg <listitem> 11539e7bcd65Smrg <para> 11549e7bcd65SmrgSpecifies the widget on which the accelerators are to be installed. Must be of class Core or any subclass thereof. 11559e7bcd65Smrg </para> 11569e7bcd65Smrg </listitem> 11579e7bcd65Smrg </varlistentry> 11589e7bcd65Smrg <varlistentry> 11599e7bcd65Smrg <term> 11609e7bcd65Smrg <emphasis remap='I'>source</emphasis> 11619e7bcd65Smrg </term> 11629e7bcd65Smrg <listitem> 11639e7bcd65Smrg <para> 11649e7bcd65SmrgSpecifies the widget from which the accelerators are to come. Must be of class Core or any subclass thereof. 11659e7bcd65Smrg </para> 11669e7bcd65Smrg </listitem> 11679e7bcd65Smrg </varlistentry> 11689e7bcd65Smrg</variablelist> 11699e7bcd65Smrg 11709e7bcd65Smrg<para> 11719e7bcd65SmrgThe 11729e7bcd65Smrg<xref linkend='XtInstallAccelerators' xrefstyle='select: title'/> 11739e7bcd65Smrgfunction installs the <emphasis remap='I'>accelerators</emphasis> resource value from 11749e7bcd65Smrg<emphasis remap='I'>source</emphasis> onto <emphasis remap='I'>destination</emphasis> 11759e7bcd65Smrgby merging the source accelerators into the destination translations. 11769e7bcd65SmrgIf the source <emphasis remap='I'>display_accelerator</emphasis> field is non-NULL, 11779e7bcd65Smrg<xref linkend='XtInstallAccelerators' xrefstyle='select: title'/> 11789e7bcd65Smrgcalls it with the source widget and a string representation 11799e7bcd65Smrgof the accelerator table, 11809e7bcd65Smrgwhich indicates that its accelerators have been installed 11819e7bcd65Smrgand that it should display them appropriately. 11829e7bcd65SmrgThe string representation of the accelerator table is its 11839e7bcd65Smrgcanonical translation table representation. 11849e7bcd65Smrg</para> 11859e7bcd65Smrg 11869e7bcd65Smrg<para> 11879e7bcd65SmrgAs a convenience for installing all accelerators from a widget and all its 11889e7bcd65Smrgdescendants onto one destination, use 11899e7bcd65Smrg<xref linkend='XtInstallAllAccelerators' xrefstyle='select: title'/>. 11909e7bcd65Smrg</para> 11919e7bcd65Smrg 11929e7bcd65Smrg<funcsynopsis id='XtInstallAllAccelerators'> 11939e7bcd65Smrg<funcprototype> 11949e7bcd65Smrg<funcdef>void <function>XtInstallAllAccelerators</function></funcdef> 11959e7bcd65Smrg <paramdef>Widget <parameter>destination</parameter></paramdef> 11969e7bcd65Smrg <paramdef>Widget <parameter>source</parameter></paramdef> 11979e7bcd65Smrg</funcprototype> 11989e7bcd65Smrg</funcsynopsis> 11999e7bcd65Smrg 12009e7bcd65Smrg<variablelist> 12019e7bcd65Smrg <varlistentry> 12029e7bcd65Smrg <term> 12039e7bcd65Smrg <emphasis remap='I'>destination</emphasis> 12049e7bcd65Smrg </term> 12059e7bcd65Smrg <listitem> 12069e7bcd65Smrg <para> 12079e7bcd65SmrgSpecifies the widget on which the accelerators are to be installed. Must be of class Core or any subclass thereof. 12089e7bcd65Smrg </para> 12099e7bcd65Smrg </listitem> 12109e7bcd65Smrg </varlistentry> 12119e7bcd65Smrg <varlistentry> 12129e7bcd65Smrg <term> 12139e7bcd65Smrg <emphasis remap='I'>source</emphasis> 12149e7bcd65Smrg </term> 12159e7bcd65Smrg <listitem> 12169e7bcd65Smrg <para> 12179e7bcd65SmrgSpecifies the root widget of the widget tree 12189e7bcd65Smrgfrom which the accelerators are to come. Must be of class Core or any subclass thereof. 12199e7bcd65Smrg </para> 12209e7bcd65Smrg </listitem> 12219e7bcd65Smrg </varlistentry> 12229e7bcd65Smrg</variablelist> 12239e7bcd65Smrg 12249e7bcd65Smrg<para> 12259e7bcd65SmrgThe 12269e7bcd65Smrg<xref linkend='XtInstallAllAccelerators' xrefstyle='select: title'/> 12279e7bcd65Smrgfunction recursively descends the widget tree rooted at <emphasis remap='I'>source</emphasis> 12289e7bcd65Smrgand installs the accelerators resource value 12299e7bcd65Smrgof each widget encountered onto <emphasis remap='I'>destination</emphasis>. 12309e7bcd65SmrgA common use is to call 12319e7bcd65Smrg<xref linkend='XtInstallAllAccelerators' xrefstyle='select: title'/> 12329e7bcd65Smrgand pass the application main window as the source. 12339e7bcd65Smrg</para> 12349e7bcd65Smrg</sect1> 12359e7bcd65Smrg 12369e7bcd65Smrg<sect1 id="KeyCode_to_KeySym_Conversions"> 12379e7bcd65Smrg<title>KeyCode-to-KeySym Conversions</title> 12389e7bcd65Smrg<para> 12399e7bcd65SmrgThe translation manager provides support for automatically translating 12409e7bcd65SmrgKeyCodes in incoming key events into KeySyms. 12419e7bcd65SmrgKeyCode-to-KeySym translator procedure pointers are of type 12429e7bcd65Smrg<xref linkend='XtKeyProc' xrefstyle='select: title'/>. 12439e7bcd65Smrg</para> 12449e7bcd65Smrg 12459e7bcd65Smrg<funcsynopsis id='XtKeyProc'> 12469e7bcd65Smrg<funcprototype> 12479e7bcd65Smrg<funcdef>typedef void <function>(*XtKeyProc)</function></funcdef> 12489e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 12499e7bcd65Smrg <paramdef>KeyCode <parameter>keycode</parameter></paramdef> 12509e7bcd65Smrg <paramdef>Modifiers <parameter>modifiers</parameter></paramdef> 12519e7bcd65Smrg <paramdef>Modifiers *<parameter>modifiers_return</parameter></paramdef> 12529e7bcd65Smrg <paramdef>KeySym *<parameter>keysym_return</parameter></paramdef> 12539e7bcd65Smrg</funcprototype> 12549e7bcd65Smrg</funcsynopsis> 12559e7bcd65Smrg 12569e7bcd65Smrg<variablelist> 12579e7bcd65Smrg <varlistentry> 12589e7bcd65Smrg <term> 12599e7bcd65Smrg <emphasis remap='I'>display</emphasis> 12609e7bcd65Smrg </term> 12619e7bcd65Smrg <listitem> 12629e7bcd65Smrg <para> 12639e7bcd65SmrgSpecifies the display that the KeyCode is from. 12649e7bcd65Smrg </para> 12659e7bcd65Smrg </listitem> 12669e7bcd65Smrg </varlistentry> 12679e7bcd65Smrg <varlistentry> 12689e7bcd65Smrg <term> 12699e7bcd65Smrg <emphasis remap='I'>keycode</emphasis> 12709e7bcd65Smrg </term> 12719e7bcd65Smrg <listitem> 12729e7bcd65Smrg <para> 12739e7bcd65SmrgSpecifies the KeyCode to translate. 12749e7bcd65Smrg </para> 12759e7bcd65Smrg </listitem> 12769e7bcd65Smrg </varlistentry> 12779e7bcd65Smrg <varlistentry> 12789e7bcd65Smrg <term> 12799e7bcd65Smrg <emphasis remap='I'>modifiers</emphasis> 12809e7bcd65Smrg </term> 12819e7bcd65Smrg <listitem> 12829e7bcd65Smrg <para> 12839e7bcd65SmrgSpecifies the modifiers to the KeyCode. 12849e7bcd65Smrg </para> 12859e7bcd65Smrg </listitem> 12869e7bcd65Smrg </varlistentry> 12879e7bcd65Smrg <varlistentry> 12889e7bcd65Smrg <term> 12899e7bcd65Smrg <emphasis remap='I'>modifiers_return</emphasis> 12909e7bcd65Smrg </term> 12919e7bcd65Smrg <listitem> 12929e7bcd65Smrg <para> 12939e7bcd65SmrgSpecifies a location in which to store 12949e7bcd65Smrga mask that indicates the subset of all 12959e7bcd65Smrgmodifiers that are examined by the key translator for the specified keycode. 12969e7bcd65Smrg </para> 12979e7bcd65Smrg </listitem> 12989e7bcd65Smrg </varlistentry> 12999e7bcd65Smrg <varlistentry> 13009e7bcd65Smrg <term> 13019e7bcd65Smrg <emphasis remap='I'>keysym_return</emphasis> 13029e7bcd65Smrg </term> 13039e7bcd65Smrg <listitem> 13049e7bcd65Smrg <para> 13059e7bcd65SmrgSpecifies a location in which to store the resulting KeySym. 13069e7bcd65Smrg </para> 13079e7bcd65Smrg </listitem> 13089e7bcd65Smrg </varlistentry> 13099e7bcd65Smrg</variablelist> 13109e7bcd65Smrg 13119e7bcd65Smrg<para> 13129e7bcd65SmrgThis procedure takes a KeyCode and modifiers and produces a KeySym. 13139e7bcd65SmrgFor any given key translator function and keyboard encoding, 13149e7bcd65Smrg<emphasis remap='I'>modifiers_return</emphasis> will be a constant per KeyCode that indicates 13159e7bcd65Smrgthe subset of all modifiers that are examined by the key translator 13169e7bcd65Smrgfor that KeyCode. 13179e7bcd65Smrg</para> 13189e7bcd65Smrg 13199e7bcd65Smrg<para> 13209e7bcd65SmrgThe KeyCode-to-KeySym translator procedure 13219e7bcd65Smrgmust be implemented such that multiple calls with the same 13229e7bcd65Smrg<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>keycode</emphasis>, and <emphasis remap='I'>modifiers</emphasis> return the same 13239e7bcd65Smrgresult until either a new case converter, an 13249e7bcd65Smrg<xref linkend='XtCaseProc' xrefstyle='select: title'/>, 13259e7bcd65Smrgis installed or a 13269e7bcd65Smrg<function>MappingNotify</function> 13279e7bcd65Smrgevent is received. 13289e7bcd65Smrg</para> 13299e7bcd65Smrg 13309e7bcd65Smrg<para> 13319e7bcd65SmrgThe Intrinsics maintain tables internally to map KeyCodes to KeySyms 13329e7bcd65Smrgfor each open display. Translator procedures and other clients may 13339e7bcd65Smrgshare a single copy of this table to perform the same mapping. 13349e7bcd65Smrg</para> 13359e7bcd65Smrg 13369e7bcd65Smrg<para> 13379e7bcd65SmrgTo return a pointer to the KeySym-to-KeyCode mapping table for a 13389e7bcd65Smrgparticular display, use 13399e7bcd65Smrg<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/>. 13409e7bcd65Smrg</para> 13419e7bcd65Smrg 13429e7bcd65Smrg<funcsynopsis id='XtGetKeysymTable'> 13439e7bcd65Smrg<funcprototype> 13449e7bcd65Smrg<funcdef>KeySym *<function>XtGetKeysymTable</function></funcdef> 13459e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 13469e7bcd65Smrg <paramdef>KeyCode *<parameter>min_keycode_return</parameter></paramdef> 13479e7bcd65Smrg <paramdef>int *<parameter>keysyms_per_keycode_return</parameter></paramdef> 13489e7bcd65Smrg</funcprototype> 13499e7bcd65Smrg</funcsynopsis> 13509e7bcd65Smrg 13519e7bcd65Smrg<variablelist> 13529e7bcd65Smrg <varlistentry> 13539e7bcd65Smrg <term> 13549e7bcd65Smrg <emphasis remap='I'>display</emphasis> 13559e7bcd65Smrg </term> 13569e7bcd65Smrg <listitem> 13579e7bcd65Smrg <para> 13589e7bcd65SmrgSpecifies the display whose table is required. 13599e7bcd65Smrg </para> 13609e7bcd65Smrg </listitem> 13619e7bcd65Smrg </varlistentry> 13629e7bcd65Smrg <varlistentry> 13639e7bcd65Smrg <term> 13649e7bcd65Smrg <emphasis remap='I'>min_keycode_return</emphasis> 13659e7bcd65Smrg </term> 13669e7bcd65Smrg <listitem> 13679e7bcd65Smrg <para> 13689e7bcd65SmrgReturns the minimum KeyCode valid for the display. 13699e7bcd65Smrg </para> 13709e7bcd65Smrg </listitem> 13719e7bcd65Smrg </varlistentry> 13729e7bcd65Smrg <varlistentry> 13739e7bcd65Smrg <term> 13749e7bcd65Smrg <emphasis remap='I'>keysyms_per_keycode_return</emphasis> 13759e7bcd65Smrg </term> 13769e7bcd65Smrg <listitem> 13779e7bcd65Smrg <para> 13789e7bcd65SmrgReturns the number of KeySyms stored for each KeyCode. 13799e7bcd65Smrg </para> 13809e7bcd65Smrg </listitem> 13819e7bcd65Smrg </varlistentry> 13829e7bcd65Smrg</variablelist> 13839e7bcd65Smrg 13849e7bcd65Smrg<para> 13859e7bcd65Smrg<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/> 13869e7bcd65Smrgreturns a pointer to the Intrinsics' copy of the 13879e7bcd65Smrgserver's KeyCode-to-KeySym table. This table must not be modified. 13889e7bcd65SmrgThere are <emphasis remap='I'>keysyms_per_keycode_return</emphasis> KeySyms associated with each 13899e7bcd65SmrgKeyCode, located in the table with indices starting at index 13909e7bcd65Smrg</para> 13910568f49bSmrg<programlisting> 13929e7bcd65Smrg (test_keycode - min_keycode_return) * keysyms_per_keycode_return 13930568f49bSmrg</programlisting> 13949e7bcd65Smrg<para> 13959e7bcd65Smrgfor KeyCode <emphasis remap='I'>test_keycode</emphasis>. Any entries that have no KeySyms associated 13969e7bcd65Smrgwith them contain the value 13979e7bcd65Smrg<function>NoSymbol</function>. 13989e7bcd65SmrgClients should not cache the KeySym table but should call 13999e7bcd65Smrg<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/> 14009e7bcd65Smrgeach time the value is 14019e7bcd65Smrgneeded, as the table may change prior to dispatching each event. 14029e7bcd65Smrg</para> 14039e7bcd65Smrg 14049e7bcd65Smrg<para> 14059e7bcd65SmrgFor more information on this table, see 14069e7bcd65Smrg<olink targetdoc='libX11' targetptr='Manipulating_the_Keyboard_Encoding'>Section 12.7</olink> in 14070568f49bSmrg<olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 14089e7bcd65Smrg</para> 14099e7bcd65Smrg 14109e7bcd65Smrg<para> 14119e7bcd65SmrgTo register a key translator, use 14129e7bcd65Smrg<xref linkend='XtSetKeyTranslator' xrefstyle='select: title'/>. 14139e7bcd65Smrg</para> 14149e7bcd65Smrg 14159e7bcd65Smrg<funcsynopsis id='XtSetKeyTranslator'> 14169e7bcd65Smrg<funcprototype> 14179e7bcd65Smrg<funcdef>void <function>XtSetKeyTranslator</function></funcdef> 14189e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 14199e7bcd65Smrg <paramdef>XtKeyProc <parameter>proc</parameter></paramdef> 14209e7bcd65Smrg</funcprototype> 14219e7bcd65Smrg</funcsynopsis> 14229e7bcd65Smrg 14239e7bcd65Smrg<variablelist> 14249e7bcd65Smrg <varlistentry> 14259e7bcd65Smrg <term> 14269e7bcd65Smrg <emphasis remap='I'>display</emphasis> 14279e7bcd65Smrg </term> 14289e7bcd65Smrg <listitem> 14299e7bcd65Smrg <para> 14309e7bcd65SmrgSpecifies the display from which to translate the events. 14319e7bcd65Smrg </para> 14329e7bcd65Smrg </listitem> 14339e7bcd65Smrg </varlistentry> 14349e7bcd65Smrg <varlistentry> 14359e7bcd65Smrg <term> 14369e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 14379e7bcd65Smrg </term> 14389e7bcd65Smrg <listitem> 14399e7bcd65Smrg <para> 14409e7bcd65SmrgSpecifies the procedure to perform key translations. 14419e7bcd65Smrg </para> 14429e7bcd65Smrg </listitem> 14439e7bcd65Smrg </varlistentry> 14449e7bcd65Smrg</variablelist> 14459e7bcd65Smrg 14469e7bcd65Smrg<para> 14479e7bcd65SmrgThe 14489e7bcd65Smrg<xref linkend='XtSetKeyTranslator' xrefstyle='select: title'/> 14499e7bcd65Smrgfunction sets the specified procedure as the current key translator. 14509e7bcd65SmrgThe default translator is 14519e7bcd65Smrg<function>XtTranslateKey</function>, 14529e7bcd65Smrgan 14539e7bcd65Smrg<xref linkend='XtKeyProc' xrefstyle='select: title'/> 14549e7bcd65Smrgthat uses the Shift, Lock, numlock, and group modifiers 14559e7bcd65Smrgwith the interpretations defined in <emphasis remap='I'>X Window System Protocol</emphasis>, Section 5. 14569e7bcd65SmrgIt is provided so that new translators can call it to get default 14579e7bcd65SmrgKeyCode-to-KeySym translations and so that the default translator 14589e7bcd65Smrgcan be reinstalled. 14599e7bcd65Smrg</para> 14609e7bcd65Smrg 14619e7bcd65Smrg<para> 14629e7bcd65SmrgTo invoke the currently registered KeyCode-to-KeySym translator, 14639e7bcd65Smrguse 14649e7bcd65Smrg<xref linkend='XtTranslateKeycode' xrefstyle='select: title'/>. 14659e7bcd65Smrg</para> 14669e7bcd65Smrg 14679e7bcd65Smrg<funcsynopsis id='XtTranslateKeycode'> 14689e7bcd65Smrg<funcprototype> 14699e7bcd65Smrg<funcdef>void <function>XtTranslateKeycode</function></funcdef> 14709e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 14719e7bcd65Smrg <paramdef>KeyCode <parameter>keycode</parameter></paramdef> 14729e7bcd65Smrg <paramdef>Modifiers <parameter>modifiers</parameter></paramdef> 14739e7bcd65Smrg <paramdef>Modifiers *<parameter>modifiers_return</parameter></paramdef> 14749e7bcd65Smrg <paramdef>KeySym *<parameter>keysym_return</parameter></paramdef> 14759e7bcd65Smrg</funcprototype> 14769e7bcd65Smrg</funcsynopsis> 14779e7bcd65Smrg 14789e7bcd65Smrg<variablelist> 14799e7bcd65Smrg <varlistentry> 14809e7bcd65Smrg <term> 14819e7bcd65Smrg <emphasis remap='I'>display</emphasis> 14829e7bcd65Smrg </term> 14839e7bcd65Smrg <listitem> 14849e7bcd65Smrg <para> 14859e7bcd65SmrgSpecifies the display that the KeyCode is from. 14869e7bcd65Smrg </para> 14879e7bcd65Smrg </listitem> 14889e7bcd65Smrg </varlistentry> 14899e7bcd65Smrg <varlistentry> 14909e7bcd65Smrg <term> 14919e7bcd65Smrg <emphasis remap='I'>keycode</emphasis> 14929e7bcd65Smrg </term> 14939e7bcd65Smrg <listitem> 14949e7bcd65Smrg <para> 14959e7bcd65SmrgSpecifies the KeyCode to translate. 14969e7bcd65Smrg </para> 14979e7bcd65Smrg </listitem> 14989e7bcd65Smrg </varlistentry> 14999e7bcd65Smrg <varlistentry> 15009e7bcd65Smrg <term> 15019e7bcd65Smrg <emphasis remap='I'>modifiers</emphasis> 15029e7bcd65Smrg </term> 15039e7bcd65Smrg <listitem> 15049e7bcd65Smrg <para> 15059e7bcd65SmrgSpecifies the modifiers to the KeyCode. 15069e7bcd65Smrg </para> 15079e7bcd65Smrg </listitem> 15089e7bcd65Smrg </varlistentry> 15099e7bcd65Smrg <varlistentry> 15109e7bcd65Smrg <term> 15119e7bcd65Smrg <emphasis remap='I'>modifiers_return</emphasis> 15129e7bcd65Smrg </term> 15139e7bcd65Smrg <listitem> 15149e7bcd65Smrg <para> 15159e7bcd65SmrgReturns a mask that indicates the modifiers actually used 15169e7bcd65Smrgto generate the KeySym. 15179e7bcd65Smrg </para> 15189e7bcd65Smrg </listitem> 15199e7bcd65Smrg </varlistentry> 15209e7bcd65Smrg <varlistentry> 15219e7bcd65Smrg <term> 15229e7bcd65Smrg <emphasis remap='I'>keysym_return</emphasis> 15239e7bcd65Smrg </term> 15249e7bcd65Smrg <listitem> 15259e7bcd65Smrg <para> 15269e7bcd65SmrgReturns the resulting KeySym. 15279e7bcd65Smrg </para> 15289e7bcd65Smrg </listitem> 15299e7bcd65Smrg </varlistentry> 15309e7bcd65Smrg</variablelist> 15319e7bcd65Smrg 15329e7bcd65Smrg<para> 15339e7bcd65SmrgThe 15349e7bcd65Smrg<xref linkend='XtTranslateKeycode' xrefstyle='select: title'/> 15359e7bcd65Smrgfunction passes the specified arguments 15369e7bcd65Smrgdirectly to the currently registered KeyCode-to-KeySym translator. 15379e7bcd65Smrg</para> 15389e7bcd65Smrg 15399e7bcd65Smrg<para> 15409e7bcd65SmrgTo handle capitalization of nonstandard KeySyms, the Intrinsics allow 15419e7bcd65Smrgclients to register case conversion routines. 15429e7bcd65SmrgCase converter procedure pointers are of type 15439e7bcd65Smrg<xref linkend='XtCaseProc' xrefstyle='select: title'/>. 15449e7bcd65Smrg</para> 15459e7bcd65Smrg 15469e7bcd65Smrg<funcsynopsis id='XtCaseProc'> 15479e7bcd65Smrg<funcprototype> 15489e7bcd65Smrg<funcdef>typedef void <function>(*XtCaseProc)</function></funcdef> 15499e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 15509e7bcd65Smrg <paramdef>KeySym <parameter>keysym</parameter></paramdef> 15519e7bcd65Smrg <paramdef>KeySym *<parameter>lower_return</parameter></paramdef> 15529e7bcd65Smrg <paramdef>KeySym *<parameter>upper_return</parameter></paramdef> 15539e7bcd65Smrg</funcprototype> 15549e7bcd65Smrg</funcsynopsis> 15559e7bcd65Smrg 15569e7bcd65Smrg<variablelist> 15579e7bcd65Smrg <varlistentry> 15589e7bcd65Smrg <term> 15599e7bcd65Smrg <emphasis remap='I'>display</emphasis> 15609e7bcd65Smrg </term> 15619e7bcd65Smrg <listitem> 15629e7bcd65Smrg <para> 15639e7bcd65SmrgSpecifies the display connection for which the conversion is required. 15649e7bcd65Smrg </para> 15659e7bcd65Smrg </listitem> 15669e7bcd65Smrg </varlistentry> 15679e7bcd65Smrg <varlistentry> 15689e7bcd65Smrg <term> 15699e7bcd65Smrg <emphasis remap='I'>keysym</emphasis> 15709e7bcd65Smrg </term> 15719e7bcd65Smrg <listitem> 15729e7bcd65Smrg <para> 15739e7bcd65SmrgSpecifies the KeySym to convert. 15749e7bcd65Smrg </para> 15759e7bcd65Smrg </listitem> 15769e7bcd65Smrg </varlistentry> 15779e7bcd65Smrg <varlistentry> 15789e7bcd65Smrg <term> 15799e7bcd65Smrg <emphasis remap='I'>lower_return</emphasis> 15809e7bcd65Smrg </term> 15819e7bcd65Smrg <listitem> 15829e7bcd65Smrg <para> 15839e7bcd65SmrgSpecifies a location into which to store the lowercase equivalent for 15849e7bcd65Smrgthe KeySym. 15859e7bcd65Smrg </para> 15869e7bcd65Smrg </listitem> 15879e7bcd65Smrg </varlistentry> 15889e7bcd65Smrg <varlistentry> 15899e7bcd65Smrg <term> 15909e7bcd65Smrg <emphasis remap='I'>upper_return</emphasis> 15919e7bcd65Smrg </term> 15929e7bcd65Smrg <listitem> 15939e7bcd65Smrg <para> 15949e7bcd65SmrgSpecifies a location into which to store the uppercase equivalent for 15959e7bcd65Smrgthe KeySym. 15969e7bcd65Smrg </para> 15979e7bcd65Smrg </listitem> 15989e7bcd65Smrg </varlistentry> 15999e7bcd65Smrg</variablelist> 16009e7bcd65Smrg 16019e7bcd65Smrg<para> 16029e7bcd65SmrgIf there is no case distinction, 16039e7bcd65Smrgthis procedure should store the KeySym into both return values. 16049e7bcd65Smrg</para> 16059e7bcd65Smrg 16069e7bcd65Smrg<para> 16079e7bcd65SmrgTo register a case converter, use 16089e7bcd65Smrg<xref linkend='XtRegisterCaseConverter' xrefstyle='select: title'/>. 16099e7bcd65Smrg</para> 16109e7bcd65Smrg 16119e7bcd65Smrg<funcsynopsis id='XtRegisterCaseConverter'> 16129e7bcd65Smrg<funcprototype> 16139e7bcd65Smrg<funcdef>void <function>XtRegisterCaseConverter</function></funcdef> 16149e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 16159e7bcd65Smrg <paramdef>XtCaseProc <parameter>proc</parameter></paramdef> 16169e7bcd65Smrg <paramdef>KeySym <parameter>start</parameter></paramdef> 16179e7bcd65Smrg <paramdef>KeySym <parameter>stop</parameter></paramdef> 16189e7bcd65Smrg</funcprototype> 16199e7bcd65Smrg</funcsynopsis> 16209e7bcd65Smrg 16219e7bcd65Smrg<variablelist> 16229e7bcd65Smrg <varlistentry> 16239e7bcd65Smrg <term> 16249e7bcd65Smrg <emphasis remap='I'>display</emphasis> 16259e7bcd65Smrg </term> 16269e7bcd65Smrg <listitem> 16279e7bcd65Smrg <para> 16289e7bcd65SmrgSpecifies the display from which the key events are to come. 16299e7bcd65Smrg </para> 16309e7bcd65Smrg </listitem> 16319e7bcd65Smrg </varlistentry> 16329e7bcd65Smrg <varlistentry> 16339e7bcd65Smrg <term> 16349e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 16359e7bcd65Smrg </term> 16369e7bcd65Smrg <listitem> 16379e7bcd65Smrg <para> 16389e7bcd65SmrgSpecifies the 16399e7bcd65Smrg<xref linkend='XtCaseProc' xrefstyle='select: title'/> 16409e7bcd65Smrgto do the conversions. 16419e7bcd65Smrg </para> 16429e7bcd65Smrg </listitem> 16439e7bcd65Smrg </varlistentry> 16449e7bcd65Smrg <varlistentry> 16459e7bcd65Smrg <term> 16469e7bcd65Smrg <emphasis remap='I'>start</emphasis> 16479e7bcd65Smrg </term> 16489e7bcd65Smrg <listitem> 16499e7bcd65Smrg <para> 16509e7bcd65SmrgSpecifies the first KeySym for which this converter is valid. 16519e7bcd65Smrg </para> 16529e7bcd65Smrg </listitem> 16539e7bcd65Smrg </varlistentry> 16549e7bcd65Smrg <varlistentry> 16559e7bcd65Smrg <term> 16569e7bcd65Smrg <emphasis remap='I'>stop</emphasis> 16579e7bcd65Smrg </term> 16589e7bcd65Smrg <listitem> 16599e7bcd65Smrg <para> 16609e7bcd65SmrgSpecifies the last KeySym for which this converter is valid. 16619e7bcd65Smrg </para> 16629e7bcd65Smrg </listitem> 16639e7bcd65Smrg </varlistentry> 16649e7bcd65Smrg</variablelist> 16659e7bcd65Smrg 16669e7bcd65Smrg<para> 16679e7bcd65SmrgThe 16689e7bcd65Smrg<xref linkend='XtRegisterCaseConverter' xrefstyle='select: title'/> 16699e7bcd65Smrgregisters the specified case converter. 16709e7bcd65SmrgThe <emphasis remap='I'>start</emphasis> and <emphasis remap='I'>stop</emphasis> arguments provide the inclusive range of KeySyms 16719e7bcd65Smrgfor which this converter is to be called. 16729e7bcd65SmrgThe new converter overrides any previous converters for KeySyms in that range. 16739e7bcd65SmrgNo interface exists to remove converters; 16749e7bcd65Smrgyou need to register an identity converter. 16759e7bcd65SmrgWhen a new converter is registered, 16769e7bcd65Smrgthe Intrinsics refresh the keyboard state if necessary. 16779e7bcd65SmrgThe default converter understands case conversion for all 16789e7bcd65SmrgLatin KeySyms defined in <emphasis remap='I'>X Window System Protocol</emphasis>, Appendix A. 16799e7bcd65Smrg</para> 16809e7bcd65Smrg 16819e7bcd65Smrg<para> 16829e7bcd65SmrgTo determine uppercase and lowercase equivalents for a KeySym, use 16839e7bcd65Smrg<xref linkend='XtConvertCase' xrefstyle='select: title'/>. 16849e7bcd65Smrg</para> 16859e7bcd65Smrg 16869e7bcd65Smrg<funcsynopsis id='XtConvertCase'> 16879e7bcd65Smrg<funcprototype> 16889e7bcd65Smrg<funcdef>void <function>XtConvertCase</function></funcdef> 16899e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 16909e7bcd65Smrg <paramdef>KeySym <parameter>keysym</parameter></paramdef> 16919e7bcd65Smrg <paramdef>KeySym *<parameter>lower_return</parameter></paramdef> 16929e7bcd65Smrg <paramdef>KeySym *<parameter>upper_return</parameter></paramdef> 16939e7bcd65Smrg</funcprototype> 16949e7bcd65Smrg</funcsynopsis> 16959e7bcd65Smrg 16969e7bcd65Smrg<variablelist> 16979e7bcd65Smrg <varlistentry> 16989e7bcd65Smrg <term> 16999e7bcd65Smrg <emphasis remap='I'>display</emphasis> 17009e7bcd65Smrg </term> 17019e7bcd65Smrg <listitem> 17029e7bcd65Smrg <para> 17039e7bcd65SmrgSpecifies the display that the KeySym came from. 17049e7bcd65Smrg </para> 17059e7bcd65Smrg </listitem> 17069e7bcd65Smrg </varlistentry> 17079e7bcd65Smrg <varlistentry> 17089e7bcd65Smrg <term> 17099e7bcd65Smrg <emphasis remap='I'>keysym</emphasis> 17109e7bcd65Smrg </term> 17119e7bcd65Smrg <listitem> 17129e7bcd65Smrg <para> 17139e7bcd65SmrgSpecifies the KeySym to convert. 17149e7bcd65Smrg </para> 17159e7bcd65Smrg </listitem> 17169e7bcd65Smrg </varlistentry> 17179e7bcd65Smrg <varlistentry> 17189e7bcd65Smrg <term> 17199e7bcd65Smrg <emphasis remap='I'>lower_return</emphasis> 17209e7bcd65Smrg </term> 17219e7bcd65Smrg <listitem> 17229e7bcd65Smrg <para> 17239e7bcd65SmrgReturns the lowercase equivalent of the KeySym. 17249e7bcd65Smrg </para> 17259e7bcd65Smrg </listitem> 17269e7bcd65Smrg </varlistentry> 17279e7bcd65Smrg <varlistentry> 17289e7bcd65Smrg <term> 17299e7bcd65Smrg <emphasis remap='I'>upper_return</emphasis> 17309e7bcd65Smrg </term> 17319e7bcd65Smrg <listitem> 17329e7bcd65Smrg <para> 17339e7bcd65SmrgReturns the uppercase equivalent of the KeySym. 17349e7bcd65Smrg </para> 17359e7bcd65Smrg </listitem> 17369e7bcd65Smrg </varlistentry> 17379e7bcd65Smrg</variablelist> 17389e7bcd65Smrg 17399e7bcd65Smrg<para> 17409e7bcd65SmrgThe 17419e7bcd65Smrg<xref linkend='XtConvertCase' xrefstyle='select: title'/> 17429e7bcd65Smrgfunction calls the appropriate converter and returns the results. 17439e7bcd65SmrgA user-supplied 17449e7bcd65Smrg<xref linkend='XtKeyProc' xrefstyle='select: title'/> 17459e7bcd65Smrgmay need to use this function. 17469e7bcd65Smrg</para> 17479e7bcd65Smrg</sect1> 17489e7bcd65Smrg 17499e7bcd65Smrg<sect1 id="Obtaining_a_KeySym_in_an_Action_Procedure"> 17509e7bcd65Smrg<title>Obtaining a KeySym in an Action Procedure</title> 17519e7bcd65Smrg<para> 17529e7bcd65SmrgWhen an action procedure is invoked on a 17539e7bcd65Smrg<function>KeyPress</function> 17549e7bcd65Smrgor 17559e7bcd65Smrg<function>KeyRelease</function> 17569e7bcd65Smrgevent, it often has a need to retrieve the KeySym and modifiers 17579e7bcd65Smrgcorresponding to the event that caused it to be invoked. In order to 17589e7bcd65Smrgavoid repeating the processing that was just performed by the 17599e7bcd65SmrgIntrinsics to match the translation entry, the KeySym and modifiers 17609e7bcd65Smrgare stored for the duration of the action procedure and are made 17619e7bcd65Smrgavailable to the client. 17629e7bcd65Smrg</para> 17639e7bcd65Smrg 17649e7bcd65Smrg<para> 17659e7bcd65SmrgTo retrieve the KeySym and modifiers that matched the final event 17669e7bcd65Smrgspecification in the translation table entry, use 17679e7bcd65Smrg<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/>. 17689e7bcd65Smrg</para> 17699e7bcd65Smrg 17709e7bcd65Smrg<funcsynopsis id='XtGetActionKeysym'> 17719e7bcd65Smrg<funcprototype> 17729e7bcd65Smrg<funcdef>KeySym <function>XtGetActionKeysym</function></funcdef> 17739e7bcd65Smrg <paramdef>XEvent *<parameter>event</parameter></paramdef> 17749e7bcd65Smrg <paramdef>Modifiers *<parameter>modifiers_return</parameter></paramdef> 17759e7bcd65Smrg</funcprototype> 17769e7bcd65Smrg</funcsynopsis> 17779e7bcd65Smrg 17789e7bcd65Smrg<variablelist> 17799e7bcd65Smrg <varlistentry> 17809e7bcd65Smrg <term> 17819e7bcd65Smrg <emphasis remap='I'>event</emphasis> 17829e7bcd65Smrg </term> 17839e7bcd65Smrg <listitem> 17849e7bcd65Smrg <para> 17859e7bcd65SmrgSpecifies the event pointer passed to the action procedure by the Intrinsics. 17869e7bcd65Smrg </para> 17879e7bcd65Smrg </listitem> 17889e7bcd65Smrg </varlistentry> 17899e7bcd65Smrg <varlistentry> 17909e7bcd65Smrg <term> 17919e7bcd65Smrg <emphasis remap='I'>modifiers_return</emphasis> 17929e7bcd65Smrg </term> 17939e7bcd65Smrg <listitem> 17949e7bcd65Smrg <para> 17959e7bcd65SmrgReturns the modifiers that caused the match, if non-NULL. 17969e7bcd65Smrg </para> 17979e7bcd65Smrg </listitem> 17989e7bcd65Smrg </varlistentry> 17999e7bcd65Smrg</variablelist> 18009e7bcd65Smrg 18019e7bcd65Smrg<para> 18029e7bcd65SmrgIf 18039e7bcd65Smrg<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/> 18049e7bcd65Smrgis called after an action procedure has been 18059e7bcd65Smrginvoked by the Intrinsics and before that action procedure returns, and 18069e7bcd65Smrgif the event pointer has the same value as the event pointer passed to 18079e7bcd65Smrgthat action routine, and if the event is a 18089e7bcd65Smrg<function>KeyPress</function> 18099e7bcd65Smrgor 18109e7bcd65Smrg<function>KeyRelease</function> 18119e7bcd65Smrgevent, then 18129e7bcd65Smrg<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/> 18139e7bcd65Smrgreturns the KeySym that matched the final 18149e7bcd65Smrgevent specification in the translation table and, if <emphasis remap='I'>modifiers_return</emphasis> 18159e7bcd65Smrgis non-NULL, the modifier state actually used to generate this KeySym; 18169e7bcd65Smrgotherwise, if the event is a 18179e7bcd65Smrg<function>KeyPress</function> 18189e7bcd65Smrgor 18199e7bcd65Smrg<function>KeyRelease</function> 18209e7bcd65Smrgevent, then 18219e7bcd65Smrg<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/> 18229e7bcd65Smrgcalls 18239e7bcd65Smrg<xref linkend='XtTranslateKeycode' xrefstyle='select: title'/> 18249e7bcd65Smrgand returns the results; 18259e7bcd65Smrgelse it returns 18269e7bcd65Smrg<function>NoSymbol</function> 18279e7bcd65Smrgand does not examine <emphasis remap='I'>modifiers_return</emphasis>. 18289e7bcd65Smrg</para> 18299e7bcd65Smrg 18309e7bcd65Smrg<para> 18319e7bcd65SmrgNote that if an action procedure invoked by the Intrinsics 18329e7bcd65Smrginvokes a subsequent action procedure (and so on) via 18339e7bcd65Smrg<xref linkend='XtCallActionProc' xrefstyle='select: title'/>, 18349e7bcd65Smrgthe nested action procedure may also call 18359e7bcd65Smrg<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/> 18369e7bcd65Smrgto retrieve the Intrinsics' KeySym and modifiers. 18379e7bcd65Smrg</para> 18389e7bcd65Smrg</sect1> 18399e7bcd65Smrg 18409e7bcd65Smrg<sect1 id="KeySym_to_KeyCode_Conversions"> 18419e7bcd65Smrg<title>KeySym-to-KeyCode Conversions</title> 18429e7bcd65Smrg<para> 18439e7bcd65SmrgTo return the list of KeyCodes that map to a particular KeySym in 18449e7bcd65Smrgthe keyboard mapping table maintained by the Intrinsics, use 18459e7bcd65Smrg<xref linkend='XtKeysymToKeycodeList' xrefstyle='select: title'/>. 18469e7bcd65Smrg</para> 18479e7bcd65Smrg 18489e7bcd65Smrg<funcsynopsis id='XtKeysymToKeycodeList'> 18499e7bcd65Smrg<funcprototype> 18509e7bcd65Smrg<funcdef>void <function>XtKeysymToKeycodeList</function></funcdef> 18519e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 18529e7bcd65Smrg <paramdef>KeySym <parameter>keysym</parameter></paramdef> 18539e7bcd65Smrg <paramdef>KeyCode **<parameter>keycodes_return</parameter></paramdef> 18549e7bcd65Smrg <paramdef>Cardinal *<parameter>keycount_return</parameter></paramdef> 18559e7bcd65Smrg</funcprototype> 18569e7bcd65Smrg</funcsynopsis> 18579e7bcd65Smrg 18589e7bcd65Smrg<variablelist> 18599e7bcd65Smrg <varlistentry> 18609e7bcd65Smrg <term> 18619e7bcd65Smrg <emphasis remap='I'>display</emphasis> 18629e7bcd65Smrg </term> 18639e7bcd65Smrg <listitem> 18649e7bcd65Smrg <para> 18659e7bcd65SmrgSpecifies the display whose table is required. 18669e7bcd65Smrg </para> 18679e7bcd65Smrg </listitem> 18689e7bcd65Smrg </varlistentry> 18699e7bcd65Smrg <varlistentry> 18709e7bcd65Smrg <term> 18719e7bcd65Smrg <emphasis remap='I'>keysym</emphasis> 18729e7bcd65Smrg </term> 18739e7bcd65Smrg <listitem> 18749e7bcd65Smrg <para> 18759e7bcd65SmrgSpecifies the KeySym for which to search. 18769e7bcd65Smrg </para> 18779e7bcd65Smrg </listitem> 18789e7bcd65Smrg </varlistentry> 18799e7bcd65Smrg <varlistentry> 18809e7bcd65Smrg <term> 18819e7bcd65Smrg <emphasis remap='I'>keycodes_return</emphasis> 18829e7bcd65Smrg </term> 18839e7bcd65Smrg <listitem> 18849e7bcd65Smrg <para> 18859e7bcd65SmrgReturns a list of KeyCodes that have <emphasis remap='I'>keysym</emphasis> 18869e7bcd65Smrgassociated with them, or NULL if <emphasis remap='I'>keycount_return</emphasis> is 0. 18879e7bcd65Smrg </para> 18889e7bcd65Smrg </listitem> 18899e7bcd65Smrg </varlistentry> 18909e7bcd65Smrg <varlistentry> 18919e7bcd65Smrg <term> 18929e7bcd65Smrg <emphasis remap='I'>keycount_return</emphasis> 18939e7bcd65Smrg </term> 18949e7bcd65Smrg <listitem> 18959e7bcd65Smrg <para> 18969e7bcd65SmrgReturns the number of KeyCodes in the keycode list. 18979e7bcd65Smrg </para> 18989e7bcd65Smrg </listitem> 18999e7bcd65Smrg </varlistentry> 19009e7bcd65Smrg</variablelist> 19019e7bcd65Smrg 19029e7bcd65Smrg<para> 19039e7bcd65SmrgThe 19049e7bcd65Smrg<xref linkend='XtKeysymToKeycodeList' xrefstyle='select: title'/> 19059e7bcd65Smrgprocedure returns all the KeyCodes that have <emphasis remap='I'>keysym</emphasis> 19069e7bcd65Smrgin their entry for the keyboard mapping table associated with <emphasis remap='I'>display</emphasis>. 19079e7bcd65SmrgFor each entry in the 19089e7bcd65Smrgtable, the first four KeySyms (groups 1 and 2) are interpreted as 19099e7bcd65Smrgspecified by <emphasis remap='I'>X Window System Protocol</emphasis>, Section 5. If no KeyCodes map to the 19109e7bcd65Smrgspecified KeySym, <emphasis remap='I'>keycount_return</emphasis> is zero and *<emphasis remap='I'>keycodes_return</emphasis> is NULL. 19119e7bcd65Smrg</para> 19129e7bcd65Smrg 19139e7bcd65Smrg<para> 19149e7bcd65SmrgThe caller should free the storage pointed to by <emphasis remap='I'>keycodes_return</emphasis> using 19159e7bcd65Smrg<xref linkend='XtFree' xrefstyle='select: title'/> 19169e7bcd65Smrgwhen it is no longer useful. If the caller needs to examine 19179e7bcd65Smrgthe KeyCode-to-KeySym table for a particular KeyCode, it should call 19189e7bcd65Smrg<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/>. 19199e7bcd65Smrg</para> 19209e7bcd65Smrg</sect1> 19219e7bcd65Smrg 19229e7bcd65Smrg<sect1 id="Registering_Button_and_Key_Grabs_for_Actions"> 19239e7bcd65Smrg<title>Registering Button and Key Grabs for Actions</title> 19249e7bcd65Smrg<para> 19259e7bcd65SmrgTo register button and key grabs for a widget's window according to the 19269e7bcd65Smrgevent bindings in the widget's translation table, use 19279e7bcd65Smrg<xref linkend='XtRegisterGrabAction' xrefstyle='select: title'/>. 19289e7bcd65Smrg</para> 19299e7bcd65Smrg 19309e7bcd65Smrg<funcsynopsis id='XtRegisterGrabAction'> 19319e7bcd65Smrg<funcprototype> 19329e7bcd65Smrg<funcdef>void <function>XtRegisterGrabAction</function></funcdef> 19339e7bcd65Smrg <paramdef>XtActionProc <parameter>action_proc</parameter></paramdef> 19349e7bcd65Smrg <paramdef>Boolean <parameter>owner_events</parameter></paramdef> 19359e7bcd65Smrg <paramdef>unsigned int <parameter>event_mask</parameter></paramdef> 19369e7bcd65Smrg <paramdef>int <parameter>pointer_mode</parameter></paramdef> 19370568f49bSmrg <paramdef>int <parameter>keyboard_mode</parameter></paramdef> 19389e7bcd65Smrg</funcprototype> 19399e7bcd65Smrg</funcsynopsis> 19409e7bcd65Smrg 19419e7bcd65Smrg<variablelist> 19429e7bcd65Smrg <varlistentry> 19439e7bcd65Smrg <term> 19449e7bcd65Smrg <emphasis remap='I'>action_proc</emphasis> 19459e7bcd65Smrg </term> 19469e7bcd65Smrg <listitem> 19479e7bcd65Smrg <para> 19489e7bcd65SmrgSpecifies the action procedure to search for in translation tables. 19499e7bcd65Smrg </para> 19509e7bcd65Smrg </listitem> 19519e7bcd65Smrg </varlistentry> 19529e7bcd65Smrg <varlistentry> 19539e7bcd65Smrg <term> 19549e7bcd65Smrg <emphasis remap='I'>owner_events</emphasis> 19559e7bcd65Smrg </term> 19569e7bcd65Smrg <listitem> 19579e7bcd65Smrg <para></para> 19580568f49bSmrg 19599e7bcd65Smrg </listitem> 19609e7bcd65Smrg </varlistentry> 19619e7bcd65Smrg <varlistentry> 19629e7bcd65Smrg <term> 19639e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 19649e7bcd65Smrg </term> 19659e7bcd65Smrg <listitem> 19669e7bcd65Smrg <para></para> 19670568f49bSmrg 19689e7bcd65Smrg </listitem> 19699e7bcd65Smrg </varlistentry> 19709e7bcd65Smrg <varlistentry> 19719e7bcd65Smrg <term> 19729e7bcd65Smrg <emphasis remap='I'>pointer_mode</emphasis> 19739e7bcd65Smrg </term> 19749e7bcd65Smrg <listitem> 19759e7bcd65Smrg <para></para> 19769e7bcd65Smrg </listitem> 19779e7bcd65Smrg </varlistentry> 19789e7bcd65Smrg <varlistentry> 19799e7bcd65Smrg <term> 19809e7bcd65Smrg <emphasis remap='I'>keyboard_mode</emphasis> 19819e7bcd65Smrg </term> 19829e7bcd65Smrg <listitem> 19839e7bcd65Smrg <para> 19849e7bcd65SmrgSpecify arguments to 19859e7bcd65Smrg<xref linkend='XtGrabButton' xrefstyle='select: title'/> 19869e7bcd65Smrgor 19879e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/>. 19889e7bcd65Smrg </para> 19899e7bcd65Smrg </listitem> 19909e7bcd65Smrg </varlistentry> 19919e7bcd65Smrg</variablelist> 19929e7bcd65Smrg 19939e7bcd65Smrg<para> 19949e7bcd65Smrg<xref linkend='XtRegisterGrabAction' xrefstyle='select: title'/> 19959e7bcd65Smrgadds the specified <emphasis remap='I'>action_proc</emphasis> to a list known to 19969e7bcd65Smrgthe translation manager. When a widget is realized, or when the 19979e7bcd65Smrgtranslations of a realized widget or the accelerators installed on a 19989e7bcd65Smrgrealized widget are modified, its translation table and any installed 19999e7bcd65Smrgaccelerators are scanned for action procedures on this list. 20009e7bcd65SmrgIf any are invoked on 20019e7bcd65Smrg<function>ButtonPress</function> 20029e7bcd65Smrgor 20039e7bcd65Smrg<function>KeyPress</function> 20049e7bcd65Smrgevents as the only or final event 20059e7bcd65Smrgin a sequence, the Intrinsics will call 20069e7bcd65Smrg<xref linkend='XtGrabButton' xrefstyle='select: title'/> 20079e7bcd65Smrgor 20089e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 20099e7bcd65Smrgfor the widget with every button or KeyCode which maps to the 20109e7bcd65Smrgevent detail field, passing the specified <emphasis remap='I'>owner_events</emphasis>, <emphasis remap='I'>event_mask</emphasis>, 20119e7bcd65Smrg<emphasis remap='I'>pointer_mode</emphasis>, and <emphasis remap='I'>keyboard_mode</emphasis>. For 20129e7bcd65Smrg<function>ButtonPress</function> 20139e7bcd65Smrgevents, the modifiers 20149e7bcd65Smrgspecified in the grab are determined directly from the translation 20159e7bcd65Smrgspecification and <emphasis remap='I'>confine_to</emphasis> and <emphasis remap='I'>cursor</emphasis> are specified as 20169e7bcd65Smrg<function>None</function>. 20179e7bcd65SmrgFor 20189e7bcd65Smrg<function>KeyPress</function> 20199e7bcd65Smrgevents, if the translation table entry specifies colon (:) in 20209e7bcd65Smrgthe modifier list, the modifiers are determined by calling the key 20219e7bcd65Smrgtranslator procedure registered for the display and calling 20229e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 20239e7bcd65Smrgfor every combination of standard modifiers which map the KeyCode to 20249e7bcd65Smrgthe specified event detail KeySym, and ORing any modifiers specified in 20259e7bcd65Smrgthe translation table entry, and <emphasis remap='I'>event_mask</emphasis> is ignored. If the 20269e7bcd65Smrgtranslation table entry does not specify colon in the modifier list, 20279e7bcd65Smrgthe modifiers specified in the grab are those specified in the 20289e7bcd65Smrgtranslation table entry only. For both 20299e7bcd65Smrg<function>ButtonPress</function> 20309e7bcd65Smrgand 20319e7bcd65Smrg<function>KeyPress</function> 20329e7bcd65Smrgevents, don't-care modifiers are ignored unless the translation entry 20330568f49bSmrgexplicitly specifies “Any” in the <emphasis remap='I'>modifiers</emphasis> field. 20349e7bcd65Smrg</para> 20359e7bcd65Smrg 20369e7bcd65Smrg<para> 20379e7bcd65SmrgIf the specified <emphasis remap='I'>action_proc</emphasis> is already registered for the calling 20389e7bcd65Smrgprocess, the new values will replace the previously specified values 20399e7bcd65Smrgfor any widgets that become realized following the call, but existing 20409e7bcd65Smrggrabs are not altered on currently realized widgets. 20419e7bcd65Smrg</para> 20429e7bcd65Smrg 20439e7bcd65Smrg<para> 20449e7bcd65SmrgWhen translations or installed accelerators are modified for a 20459e7bcd65Smrgrealized widget, any previous key or button grabs registered 20469e7bcd65Smrgas a result of the old bindings are released if they do not appear in 20479e7bcd65Smrgthe new bindings and are not explicitly grabbed by the client with 20489e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 20499e7bcd65Smrgor 20509e7bcd65Smrg<xref linkend='XtGrabButton' xrefstyle='select: title'/>. 20519e7bcd65Smrg</para> 20529e7bcd65Smrg</sect1> 20539e7bcd65Smrg 20549e7bcd65Smrg<sect1 id="Invoking_Actions_Directly"> 20559e7bcd65Smrg<title>Invoking Actions Directly</title> 20569e7bcd65Smrg<para> 20579e7bcd65SmrgNormally action procedures are invoked by the Intrinsics when an 20589e7bcd65Smrgevent or event sequence arrives for a widget. To 20599e7bcd65Smrginvoke an action procedure directly, without generating 20609e7bcd65Smrg(or synthesizing) events, use 20619e7bcd65Smrg<xref linkend='XtCallActionProc' xrefstyle='select: title'/>. 20629e7bcd65Smrg</para> 20639e7bcd65Smrg 20649e7bcd65Smrg<funcsynopsis id='XtCallActionProc'> 20659e7bcd65Smrg<funcprototype> 20669e7bcd65Smrg<funcdef>void <function>XtCallActionProc</function></funcdef> 20679e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 20680568f49bSmrg <paramdef>const char * <parameter>action</parameter></paramdef> 20690568f49bSmrg <paramdef>XEvent * <parameter>event</parameter></paramdef> 20700568f49bSmrg <paramdef>String * <parameter>params</parameter></paramdef> 20719e7bcd65Smrg <paramdef>Cardinal <parameter>num_params</parameter></paramdef> 20729e7bcd65Smrg</funcprototype> 20739e7bcd65Smrg</funcsynopsis> 20749e7bcd65Smrg 20759e7bcd65Smrg<variablelist> 20769e7bcd65Smrg <varlistentry> 20779e7bcd65Smrg <term> 20789e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 20799e7bcd65Smrg </term> 20809e7bcd65Smrg <listitem> 20819e7bcd65Smrg <para> 20829e7bcd65SmrgSpecifies the widget in which the action is to be invoked. Must be of class Core or any subclass thereof. 20839e7bcd65Smrg </para> 20849e7bcd65Smrg </listitem> 20859e7bcd65Smrg </varlistentry> 20869e7bcd65Smrg <varlistentry> 20879e7bcd65Smrg <term> 20889e7bcd65Smrg <emphasis remap='I'>action</emphasis> 20899e7bcd65Smrg </term> 20909e7bcd65Smrg <listitem> 20919e7bcd65Smrg <para> 20929e7bcd65SmrgSpecifies the name of the action routine. 20939e7bcd65Smrg </para> 20949e7bcd65Smrg </listitem> 20959e7bcd65Smrg </varlistentry> 20969e7bcd65Smrg <varlistentry> 20979e7bcd65Smrg <term> 20989e7bcd65Smrg <emphasis remap='I'>event</emphasis> 20999e7bcd65Smrg </term> 21009e7bcd65Smrg <listitem> 21019e7bcd65Smrg <para> 21029e7bcd65SmrgSpecifies the contents of the <emphasis remap='I'>event</emphasis> passed to the action routine. 21039e7bcd65Smrg </para> 21049e7bcd65Smrg </listitem> 21059e7bcd65Smrg </varlistentry> 21069e7bcd65Smrg <varlistentry> 21079e7bcd65Smrg <term> 21089e7bcd65Smrg <emphasis remap='I'>params</emphasis> 21099e7bcd65Smrg </term> 21109e7bcd65Smrg <listitem> 21119e7bcd65Smrg <para> 21129e7bcd65SmrgSpecifies the contents of the <emphasis remap='I'>params</emphasis> passed to the action routine. 21139e7bcd65Smrg </para> 21149e7bcd65Smrg </listitem> 21159e7bcd65Smrg </varlistentry> 21169e7bcd65Smrg <varlistentry> 21179e7bcd65Smrg <term> 21189e7bcd65Smrg <emphasis remap='I'>num_params</emphasis> 21199e7bcd65Smrg </term> 21209e7bcd65Smrg <listitem> 21219e7bcd65Smrg <para> 21229e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>params</emphasis>. 21239e7bcd65Smrg </para> 21249e7bcd65Smrg </listitem> 21259e7bcd65Smrg </varlistentry> 21269e7bcd65Smrg</variablelist> 21279e7bcd65Smrg 21289e7bcd65Smrg<para> 21299e7bcd65Smrg<xref linkend='XtCallActionProc' xrefstyle='select: title'/> 21309e7bcd65Smrgsearches for the named action routine in the same 21319e7bcd65Smrgmanner and order as translation tables are bound, as described in 21329e7bcd65SmrgSection 10.1.2, except that application action tables are searched, if 21339e7bcd65Smrgnecessary, as of the time of the call to 21349e7bcd65Smrg<xref linkend='XtCallActionProc' xrefstyle='select: title'/>. 21359e7bcd65SmrgIf found, 21369e7bcd65Smrgthe action routine is invoked with the specified widget, event pointer, 21379e7bcd65Smrgand parameters. It is the responsibility of the caller to ensure that 21389e7bcd65Smrgthe contents of the <emphasis remap='I'>event</emphasis>, <emphasis remap='I'>params</emphasis>, and <emphasis remap='I'>num_params</emphasis> arguments are 21399e7bcd65Smrgappropriate for the specified action routine and, if necessary, that 21409e7bcd65Smrgthe specified widget is realized or sensitive. If the named action 21419e7bcd65Smrgroutine cannot be found, 21429e7bcd65Smrg<xref linkend='XtCallActionProc' xrefstyle='select: title'/> 21439e7bcd65Smrggenerates a warning message and returns. 21449e7bcd65Smrg</para> 21459e7bcd65Smrg</sect1> 21469e7bcd65Smrg 21479e7bcd65Smrg<sect1 id="Obtaining_a_Widget_s_Action_List"> 21489e7bcd65Smrg<title>Obtaining a Widget's Action List</title> 21499e7bcd65Smrg<para> 21509e7bcd65SmrgOccasionally a subclass will require the pointers to one or more of 21519e7bcd65Smrgits superclass's action procedures. This would be needed, for 21529e7bcd65Smrgexample, in order to envelop the superclass's action. To retrieve 21539e7bcd65Smrgthe list of action procedures registered in the superclass's 21549e7bcd65Smrg<emphasis remap='I'>actions</emphasis> field, use 21559e7bcd65Smrg<xref linkend='XtGetActionList' xrefstyle='select: title'/>. 21569e7bcd65Smrg</para> 21579e7bcd65Smrg 21589e7bcd65Smrg<funcsynopsis id='XtGetActionList'> 21599e7bcd65Smrg<funcprototype> 21609e7bcd65Smrg<funcdef>void <function>XtGetActionList</function></funcdef> 21619e7bcd65Smrg <paramdef>WidgetClass <parameter>widget_class</parameter></paramdef> 21629e7bcd65Smrg <paramdef>XtActionList *<parameter>actions_return</parameter></paramdef> 21639e7bcd65Smrg <paramdef>Cardinal *<parameter>num_actions_return</parameter></paramdef> 21649e7bcd65Smrg</funcprototype> 21659e7bcd65Smrg</funcsynopsis> 21669e7bcd65Smrg 21679e7bcd65Smrg<variablelist> 21689e7bcd65Smrg <varlistentry> 21699e7bcd65Smrg <term> 21709e7bcd65Smrg <emphasis remap='I'>widget_class</emphasis> 21719e7bcd65Smrg </term> 21729e7bcd65Smrg <listitem> 21739e7bcd65Smrg <para> 21749e7bcd65SmrgSpecifies the widget class whose actions are to be returned. 21759e7bcd65Smrg </para> 21769e7bcd65Smrg </listitem> 21779e7bcd65Smrg </varlistentry> 21789e7bcd65Smrg <varlistentry> 21799e7bcd65Smrg <term> 21809e7bcd65Smrg <emphasis remap='I'>actions_return</emphasis> 21819e7bcd65Smrg </term> 21829e7bcd65Smrg <listitem> 21839e7bcd65Smrg <para> 21849e7bcd65SmrgReturns the action list. 21859e7bcd65Smrg </para> 21869e7bcd65Smrg </listitem> 21879e7bcd65Smrg </varlistentry> 21889e7bcd65Smrg <varlistentry> 21899e7bcd65Smrg <term> 21909e7bcd65Smrg <emphasis remap='I'>num_actions_return</emphasis> 21919e7bcd65Smrg </term> 21929e7bcd65Smrg <listitem> 21939e7bcd65Smrg <para> 21949e7bcd65SmrgReturns the number of action procedures declared by the class. 21959e7bcd65Smrg </para> 21969e7bcd65Smrg </listitem> 21979e7bcd65Smrg </varlistentry> 21989e7bcd65Smrg</variablelist> 21999e7bcd65Smrg 22009e7bcd65Smrg<para> 22019e7bcd65Smrg<xref linkend='XtGetActionList' xrefstyle='select: title'/> 22029e7bcd65Smrgreturns the action table defined by the specified 22039e7bcd65Smrgwidget class. This table does not include actions defined by the 22049e7bcd65Smrgsuperclasses. If <emphasis remap='I'>widget_class</emphasis> is not initialized, or is not 22059e7bcd65Smrg<function>coreWidgetClass</function> 22069e7bcd65Smrgor a subclass thereof, or if the class does not define any actions, 22079e7bcd65Smrg*<emphasis remap='I'>actions_return</emphasis> will be NULL and *<emphasis remap='I'>num_actions_return</emphasis> 22089e7bcd65Smrgwill be zero. 22099e7bcd65SmrgIf *<emphasis remap='I'>actions_return</emphasis> is non-NULL the client is responsible for freeing 22109e7bcd65Smrgthe table using 22119e7bcd65Smrg<xref linkend='XtFree' xrefstyle='select: title'/> 22129e7bcd65Smrgwhen it is no longer needed. 22139e7bcd65Smrg</para> 22149e7bcd65Smrg</sect1> 22159e7bcd65Smrg</chapter> 2216