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