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