1<sect1 id="Sme_Object"> 2<title>Sme Object</title> 3<para> 4<!-- .LP --> 5<!-- .XS --> 6<!-- Sme Object --> 7<!-- .XE --> 8<indexterm significance="preferred"><primary>Sme object</primary></indexterm> 9<!-- .sp --> 10<literallayout class="monospaced"> 11<!-- .TA 2.0i --> 12<!-- .ta 2.0i --> 13Application Header file <X11/Xaw/Sme.h> 14<indexterm><primary>Sme.h</primary></indexterm> 15Class Header file <X11/Xaw/SmeP.h> 16<indexterm><primary>SmeP.h</primary></indexterm> 17Class smeObjectClass 18<indexterm><primary>smeObjectClass</primary></indexterm> 19Class Name Sme 20<indexterm><primary>Sme object</primary><secondary>class name</secondary></indexterm> 21Superclass RectObj 22</literallayout> 23<!-- .sp --> 24</para> 25<para> 26<!-- .LP --> 27The Sme object is the base class for all menu entries. While this 28object is mainly intended to be subclassed, it may be used in a menu to 29add blank space between menu entries. 30</para> 31<sect2 id='Sme::Resources'> 32<title>Resources</title> 33<indexterm><primary>SmeLine object</primary><secondary>resources</secondary></indexterm> 34<para> 35<!-- .LP --> 36The resources associated with the SmeLine object are defined in this 37section, and affect only the single menu entry specified by this object. 38There are no new resources added for this class, as it picks up all its 39resources from the RectObj class. 40</para> 41<informaltable> 42 <tgroup cols='5' align='center'> 43 <colspec colname='c1'/> 44 <colspec colname='c2'/> 45 <colspec colname='c3'/> 46 <colspec colname='c4'/> 47 <colspec colname='c5'/> 48 <thead> 49 <row> 50 <entry>Name</entry> 51 <entry>Class</entry> 52 <entry>Type</entry> 53 <entry>Notes</entry> 54 <entry>Default Value</entry> 55 </row> 56 </thead> 57 <tbody> 58 <row> 59 <entry>ancestorSensitive</entry> 60 <entry>AncestorSensitive</entry> 61 <entry>Boolean</entry> 62 <entry></entry> 63 <entry>True</entry> 64 </row> 65 <row> 66 <entry>callback</entry> 67 <entry>Callback</entry> 68 <entry>XtCallbackList</entry> 69 <entry></entry> 70 <entry>NULL</entry> 71 </row> 72 <row> 73 <entry>destroyCallback</entry> 74 <entry>Callback</entry> 75 <entry>XtCallbackList</entry> 76 <entry></entry> 77 <entry>NULL</entry> 78 </row> 79 <row> 80 <entry>height</entry> 81 <entry>Height</entry> 82 <entry>Dimension</entry> 83 <entry></entry> 84 <entry>0</entry> 85 </row> 86 <row> 87 <entry>international</entry> 88 <entry>International</entry> 89 <entry>Boolean</entry> 90 <entry>C</entry> 91 <entry>False</entry> 92 </row> 93 <row> 94 <entry>sensitive</entry> 95 <entry>Sensitive</entry> 96 <entry>Boolean</entry> 97 <entry></entry> 98 <entry>True</entry> 99 </row> 100 <row> 101 <entry>width</entry> 102 <entry>Width</entry> 103 <entry>Dimension</entry> 104 <entry></entry> 105 <entry>1</entry> 106 </row> 107 </tbody> 108 </tgroup> 109</informaltable> 110<!-- .As --> 111<!-- .Dc --> 112<!-- .Hw --> 113 114<para> 115Keep in mind that the SimpleMenu widget will force all menu items to 116be the width of the widest entry. 117<!-- .Ix Bold --> 118<!-- .Se --> 119</para> 120</sect2> 121<sect2 id="Subclassing_the_Sme_Object"> 122<title>Subclassing the Sme Object</title> 123<indexterm significance="preferred"><primary>Sme object</primary><secondary>subclassing</secondary></indexterm> 124<para> 125<!-- .LP --> 126<!-- .sp --> 127To Create a new Sme object <emphasis remap='I'>class</emphasis> you will need to define three class methods. 128These methods allow the SimpleMenu to highlight and unhighlight the 129menu entry as the pointer cursor moves over it, as well as notify the 130entry when the user has selected it. All of 131these methods may be inherited from the Sme object, although the default 132semantics are not very interesting. 133</para> 134<para> 135<variablelist> 136 <varlistentry> 137 <term> 138 <function>Highlight</function>( ) 139 </term> 140 <listitem> 141 <para> 142<indexterm><primary>Sme object</primary><secondary>Highlight method</secondary></indexterm> 143Called to put the menu entry into the highlighted state. 144 </para> 145 </listitem> 146 </varlistentry> 147 <varlistentry> 148 <term> 149 <function>Unhighlight</function>( ) 150 </term> 151 <listitem> 152 <para> 153<indexterm><primary>Sme object</primary><secondary>Unhighlight method</secondary></indexterm> 154Called to return the widget to its normal (unhighlighted) state. 155 </para> 156 </listitem> 157 </varlistentry> 158 <varlistentry> 159 <term> 160 <function>Notify</function>( ) 161 </term> 162 <listitem> 163 <para> 164<indexterm><primary>Sme object</primary><secondary>Notify method</secondary></indexterm> 165Called when the user selects this menu entry. 166 </para> 167 </listitem> 168 </varlistentry> 169</variablelist> 170</para> 171<para> 172<!-- .LP --> 173<!-- .sp --> 174Other then these methods, creating a new object 175is straight forward. Here is some information that may help you 176avoid some common mistakes. 177</para> 178<orderedlist> 179 <listitem><para>Objects can be zero pixels high.</para></listitem> 180 <listitem> 181 <para> 182Objects draw on their parent's window, therefore the Drawing dimensions 183are different from those of widgets. For instance, y locations vary 184from <function>y</function> to <function>y + height</function>, not <function>0</function> to <function>height</function>. 185 </para> 186 </listitem> 187 <listitem> 188 <para> 189<!-- .IP 3) 3n --> 190XtSetValues calls may come from the application while the Sme is highlighted, 191and if the SetValues method returns True, will result in an expose event. 192The SimpleMenu may later call the menu entry's <function>unhighlight</function> 193procedure. However, due to the asynchronous nature of 194X, the expose event generated by <xref linkend='XtSetValues' xrefstyle='select: title'/> will come <emphasis remap='I'>after</emphasis> 195this unhighlight. 196 </para> 197 </listitem> 198 <listitem> 199 <para> 200Remember that your subclass of the Sme does not own the 201window. Share the space with other menu entries, and refrain 202from drawing outside the subclass's own section of the menu. 203 </para> 204 </listitem> 205</orderedlist> 206</sect2> 207</sect1> 208