home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / Xaw / Sme < prev    next >
Encoding:
Text File  |  1991-07-29  |  3.1 KB  |  113 lines

  1. .NH 2
  2. Sme Object
  3. .LP
  4. .XS
  5.     Sme Object
  6. .XE
  7. .IN "Sme object" "" "@DEF@"
  8. .sp
  9. .Ds 0
  10. .TA 2.0i
  11. .ta 2.0i
  12. Application Header file    <X11/Xaw/Sme.h>
  13. .IN "Sme.h" ""
  14. Class Header file    <X11/Xaw/SmeP.h>
  15. .IN "SmeP.h" ""
  16. Class        smeObjectClass
  17. .IN "smeObjectClass" ""
  18. Class Name    Sme
  19. .IN "Sme object" "class name"
  20. Superclass    RectObj
  21. .De
  22. .sp
  23. .LP
  24. The Sme object is the base class for all menu entries.  While this
  25. object is mainly intended to be subclassed, it may be used in a menu to
  26. add blank space between menu entries.  
  27. .NH 3
  28. Resources
  29. .IN "SmeLine object" "resources"
  30. .LP
  31. The resources associated with the SmeLine object are defined in this
  32. section, and affect only the single menu entry specified by this object.
  33. There are no new resources added for this class, as it picks up all its
  34. resources from the RectObj class.
  35. .ps 9
  36. .nr PS 9
  37. .vs 11
  38. .nr VS 11
  39. .TS H
  40. lw(1.5i) lw(1i) lw(1i) lw(2i).
  41. _
  42. .sp 3p
  43. .TB
  44. Name    Class    Type    Default Value
  45. .sp 3p
  46. _
  47. .TH
  48. .R
  49. .sp 3p
  50. ancestorSensitive    AncestorSensitive    Boolean    True
  51. callback    Callback    XtCallbackList    NULL
  52. destroyCallback    Callback    XtCallbackList    NULL
  53. height    Height    Dimension    0
  54. sensitive    Sensitive    Boolean    True
  55. width    Width    Dimension    1
  56. .sp 3p
  57. _
  58. .TE
  59. .ps 11
  60. .nr PS 11
  61. .vs 13
  62. .nr VS 13
  63. .As
  64. .Dc
  65. .Hw
  66. Keep in mind that the SimpleMenu widget will force all menu items to
  67. be the width of the widest entry. 
  68. .Se
  69. .NH 3
  70. Subclassing the Sme Object
  71. .IN "Sme object" "subclassing" "@DEF"
  72. .LP
  73. .sp
  74. To Create a new Sme object you will need to define a few class procedures.
  75. These procedures allow the SimpleMenu to highlight and unhighlight the
  76. menu entry as the pointer cursor moves over it, as well as notifying the
  77. entry when the user has selected it.
  78. .LP
  79. There are three new class methods defined by the Sme Object.  All of
  80. these methods may be inherited from the Sme object, although the default
  81. semantics are not very interesting.
  82. .IP \fBHighlight\fP(\|) 1i
  83. .IN "Sme object" "Highlight routine"
  84. Called to put the menu entry into the highlighted state.
  85. .IP \fBUnhighlight\fP(\|) 1i
  86. .IN "Sme object" "Unhighlight routine"
  87. Called to return the widget to its normal (unhighlighted) state.
  88. .IP \fBNotify\fP(\|) 
  89. .IN "Sme object" "Notify routine"
  90. Called when the user selects this menu entry.
  91. .LP
  92. .sp
  93. Other then these specialized class procedures creating a new object
  94. is straight forward.  Just subclass Sme and define new redisplay and
  95. highlight procedures.  Here is some information that may help you
  96. avoid some common mistakes.
  97. .IP 1) 3n
  98. Objects can be zero pixels high.
  99. .IP 2) 3n
  100. Objects draw on their parent's window, therefore the Drawing dimensions
  101. are different from those of widgets.  For instance, y locations vary
  102. from \fBy\fP to \fBy + height\fP, not \fB0\fP to \fBheight\fP.
  103. .IP 3) 3n
  104. SetValues calls may come from the application while the SimpleMenu is in
  105. its \fBnotify\fP procedure.  The SimpleMenu may later call the menu
  106. entries \fBunhighlight\fP procedure.  Due to the asynchronous nature of
  107. X the expose event generated by \fBXtSetValues\fP will come \fBafter
  108. this \fBunhighlight\fP.
  109. .IP 4) 3n
  110. Remember the menu entry does not own the window.  Share the space with
  111. other menu entries, never draw outside your own section of the menu.
  112.  
  113.