home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / XfeWidgets / Xfe / Translations.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  6.6 KB  |  180 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /*-----------------------------------------*/
  19. /*                                                                        */
  20. /* Name:        <Xfe/Translations.c>                                    */
  21. /* Description:    Xfe widgets default and extra translations.                */
  22. /* Author:        Ramiro Estrugo <ramiro@netscape.com>                    */
  23. /*                                                                        */
  24. /*----------------------------------------------------------------------*/
  25.  
  26.  
  27. #include <Xfe/XfeP.h>
  28.  
  29. /*----------------------------------------------------------------------*/
  30. /*                                                                        */
  31. /* XfeArrow translations                                                */
  32. /*                                                                        */
  33. /*----------------------------------------------------------------------*/
  34. /* extern */ char _XfeArrowDefaultTranslations[] ="\
  35. <Key>space:                    ArmAndActivate()\n\
  36. c<Btn1Down>:                Focus()\n\
  37. <Btn1Down>:                    Arm()\n\
  38. <Btn1Up>:                    Activate() Disarm()\n\
  39. ~c ~s ~a ~m<Key>Return:        ArmAndActivate()\n\
  40. ~c ~s ~a ~m<Key>space:        ArmAndActivate()\n\
  41. :<Key>osfHelp:                Help()\n\
  42. <Enter>:                    Enter()\n\
  43. <Leave>:                    Leave()";
  44.  
  45. /*----------------------------------------------------------------------*/
  46. /*                                                                        */
  47. /* XfeLabel translations                                                */
  48. /*                                                                        */
  49. /*----------------------------------------------------------------------*/
  50. /* extern */ char _XfeLabelDefaultTranslations[] ="\
  51. <Btn1Down>:                    Select()\n\
  52. c<Btn1Down>:                Focus()\n\
  53. :<Key>osfHelp:                Help()\n\
  54. <Enter>:                    Enter()\n\
  55. <Leave>:                    Leave()";
  56.  
  57. /*----------------------------------------------------------------------*/
  58. /*                                                                        */
  59. /* XfeButton translations                                                */
  60. /*                                                                        */
  61. /*----------------------------------------------------------------------*/
  62. /* extern */ char _XfeButtonDefaultTranslations[] ="\
  63. <Key>space:                    ArmAndActivate()\n\
  64. c<Btn1Down>:                Focus()\n\
  65. <Btn1Down>:                    Arm()\n\
  66. <Btn1Up>:                    Activate() Disarm()\n\
  67. <Btn3Down>:                    Btn3Down()\n\
  68. <Btn3Up>:                    Btn3Up()\n\
  69. ~c ~s ~a ~m<Key>Return:        ArmAndActivate()\n\
  70. ~c ~s ~a ~m<Key>space:        ArmAndActivate()\n\
  71. :<Key>osfHelp:                Help()\n\
  72. <Enter>:                    Enter()\n\
  73. <Leave>:                    Leave()";
  74.  
  75. /* extern */ char _XfeButtonMotionAddTranslations[] ="\
  76. <Motion>:                    Motion()";
  77.  
  78. /* extern */ char _XfeButtonMotionRemoveTranslations[] ="\
  79. <Motion>:                    ";
  80.  
  81. /*----------------------------------------------------------------------*/
  82. /*                                                                        */
  83. /* XfePrimitive translations                                            */
  84. /*                                                                        */
  85. /*----------------------------------------------------------------------*/
  86. /* extern */ char _XfePrimitiveDefaultTranslations[] ="\
  87. c<Btn1Down>:                Focus()\n\
  88. :<Key>osfHelp:                Help()\n\
  89. <Enter>:                    Enter()\n\
  90. <Leave>:                    Leave()";
  91.  
  92. /*----------------------------------------------------------------------*/
  93. /*                                                                        */
  94. /* XfeBypassShell translations                                            */
  95. /*                                                                        */
  96. /*----------------------------------------------------------------------*/
  97. /* extern */ char _XfeBypassShellDefaultTranslations[] ="\
  98. <BtnUp>:                    BtnUp()\n\
  99. <BtnDown>:                    BtnDown()";
  100.  
  101. /*----------------------------------------------------------------------*/
  102. /*                                                                        */
  103. /* XfeButton extra translations                                            */
  104. /*                                                                        */
  105. /*----------------------------------------------------------------------*/
  106. /* extern */ char _XfeBmButtonExtraTranslations[] ="\
  107. <Btn1Motion>:                Motion()\n\
  108. <Motion>:                    Motion()";
  109.  
  110. /*----------------------------------------------------------------------*/
  111. /*                                                                        */
  112. /* XfeToolBar extra translations                                        */
  113. /*                                                                        */
  114. /*----------------------------------------------------------------------*/
  115. /* extern */ char _XfeToolBarExtraTranslations[] ="\
  116. <Btn3Down>:                    Btn3Down()\n\
  117. <Btn3Up>:                    Btn3Up()";
  118.  
  119. /*----------------------------------------------------------------------*/
  120. /*                                                                        */
  121. /* XfeComboBox translations.                                            */
  122. /*                                                                        */
  123. /*----------------------------------------------------------------------*/
  124. /* extern */ char _XfeComboBoxTextEditableTranslations[] ="\
  125. ~c s ~m ~a <Btn1Down>:            extend-start()\n\
  126. c ~s ~m ~a <Btn1Down>:            move-destination()\n\
  127. ~c ~s ~m ~a <Btn1Down>:            grab-focus()\n\
  128. ~c ~m ~a <Btn1Motion>:            extend-adjust()\n\
  129. ~c ~m ~a <Btn1Up>:                extend-end()";
  130.  
  131. /* extern */ char _XfeComboBoxTextReadOnlyTranslations[] ="\
  132. ~c ~s ~m ~a <Btn1Down>:            grab-focus() Popup()\n\
  133. ~c ~m ~a <Btn1Motion>:            \n\
  134. ~c ~m ~a <Btn1Up>:                Popdown()";
  135.  
  136. #if 0
  137. /* extern */ char _XfeComboBoxArrowTranslations[] ="\
  138. ~c ~s ~m ~a <Btn1Down>:            Highlight() Arm() Popup()\n\
  139. ~c ~m ~a <Btn1Up>:                Activate() Disarm() Popdown()";
  140. #else
  141. /* extern */ char _XfeComboBoxArrowTranslations[] ="\
  142. ~c ~s ~m ~a <Btn1Down>:            Highlight() Arm()  Popup()\n\
  143. ~c ~m ~a <Btn1Up>:                Activate() Disarm() Popdown()";
  144. #endif
  145.  
  146. /* extern */ char _XfeComboBoxExtraTranslations[] ="\
  147. ~c ~s ~m ~a <Btn1Down>:            Highlight() Popup()\n\
  148. ~c ~m ~a <Btn1Up>:                Popdown()";
  149.  
  150. /*----------------------------------------------------------------------*/
  151. /*                                                                        */
  152. /* Translation / Action functions                                        */
  153. /*                                                                        */
  154. /*----------------------------------------------------------------------*/
  155. /* extern */ void
  156. XfeOverrideTranslations(Widget w,String table)
  157. /*----------------------------------------------------------------------*/
  158. {
  159.     XtTranslations parsed = NULL;
  160.  
  161.     assert( _XfeIsAlive(w) );
  162.     assert( table != NULL );
  163.     
  164.     parsed = XtParseTranslationTable(table);
  165.     
  166.     XtOverrideTranslations(w,parsed);
  167. }
  168. /*----------------------------------------------------------------------*/
  169. /* extern */ void
  170. XfeAddActions(Widget w,XtActionList actions,Cardinal num_actions)
  171. /*----------------------------------------------------------------------*/
  172. {
  173.     assert( _XfeIsAlive(w) );
  174.     assert( actions != NULL );
  175.     assert( num_actions > 0 );
  176.  
  177.     XtAppAddActions(XtWidgetToApplicationContext(w),actions,num_actions);
  178. }
  179. /*----------------------------------------------------------------------*/
  180.