xref: /trunk/main/offapi/com/sun/star/awt/XMenu.idl (revision d026be40)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22#ifndef __com_sun_star_awt_XMenu_idl__
23#define __com_sun_star_awt_XMenu_idl__
24
25#include <com/sun/star/uno/XInterface.idl>
26#include <com/sun/star/awt/MenuItemType.idl>
27
28module com {  module sun {  module star {  module awt {
29
30published interface XPopupMenu;
31published interface XMenuListener;
32
33/** specifies a simple menu.
34 */
35published interface XMenu: com::sun::star::uno::XInterface
36{
37    /** adds the specified menu listener to receive events from this menu.
38
39        @param xListener
40            the <type>XMenuListener</type> to be added.
41     */
42    [oneway] void addMenuListener( [in] XMenuListener xListener );
43
44    /** removes the specified menu listener so that it no longer
45        receives events from this menu.
46
47        @param xListener
48            the <type>XMenuListener</type> to be removed.
49     */
50    [oneway] void removeMenuListener( [in] XMenuListener xListener );
51
52    /** inserts an item into the menu.
53        <p>The item is appended if the position is greater than or equal to
54        <member>getItemCount()</member> or if it is negative.</p>
55
56        @param nItemId
57            specifies the ID of the menu item to be insterted.
58
59        @param aText
60            specifies the label of the menu item.
61
62        @param nItemStyle
63            specifies the style of the menu item, as defined in
64            <type>MenuItemStyle</type>.
65
66        @param nItemPos
67            specifies the position where the menu item will be insterted.
68     */
69    [oneway] void insertItem( [in] short nItemId,
70                              [in] string aText,
71                              [in] short nItemStyle,
72                              [in] short nItemPos );
73
74    /** removes one or more items from the menu.
75
76        @param nItemPos
77            specifies the position of the (first) menu item to be removed.
78
79        @param nCount
80            specifies the number of menu items to remove.
81     */
82    [oneway] void removeItem( [in] short nItemPos,
83                              [in] short nCount );
84
85    /** removes all items from the menu.
86     */
87    void clear();
88
89    /** returns the number of items in the menu.
90
91        @return
92            the number of items in this <type>XMenu</type>.
93     */
94    short getItemCount();
95
96    /** returns the ID of the item at the specified position.
97
98        @param nItemPos
99            specifies the position of the menu item for which the item ID is queried.
100
101        @return
102            the ID of the menu item at the given position.
103     */
104    short getItemId( [in] short nItemPos );
105
106    /** returns the position of the item with the specified ID.
107
108        @param nItemId
109            specifies the ID of the menu item for which the item position is queried.
110
111        @return
112            the position of the menu item with the specified ID.
113     */
114    short getItemPos( [in] short nItemId );
115
116    /** retrieves the type of the menu item.
117
118        @param nItemPos
119            specifies the position of the menu item for which the item type is queried.
120
121        @return
122            a <type>MenuItemType</type> indicating the item type.
123    */
124    ::com::sun::star::awt::MenuItemType getItemType( [in] short nItemPos );
125
126    /** enables or disables the menu item.
127
128        @param nItemId
129            specifies the menu item ID.
130
131        @param bEnable
132            specifies whether the menu item should be enabled (<TRUE/>) or
133            disabled (<FALSE/>).
134     */
135    [oneway] void enableItem( [in] short nItemId,
136                              [in] boolean bEnable );
137
138    /** returns the state of the menu item.
139
140        @param nItemId
141            specifies the menu item ID.
142
143        @return
144            <TRUE/> if the item is enabled, <FALSE/> otherwise.
145     */
146    boolean isItemEnabled( [in] short nItemId );
147
148    /** specifies whether disabled menu entries should be hidden, or not.
149
150        @param bHide
151            if <TRUE/>, disabled menu entries are hidden.
152    */
153    void hideDisabledEntries( [in] boolean bHide );
154
155    /** specifies whether mnemonics are automatically assigned to menu items, or not.
156
157        @param bEnable
158            if <TRUE/>, mnemonics are automatically assigned to menu items.
159    */
160    void enableAutoMnemonics( [in] boolean bEnable );
161
162    /** sets the text for the menu item.
163
164        @param nItemId
165            specifies the ID of the menu item.
166
167        @param aText
168            specifies the label of the menu item.
169     */
170    [oneway] void setItemText( [in] short nItemId,
171                               [in] string aText );
172
173    /** returns the string for the given item id.
174
175        @param nItemId
176            specifies the ID of the menu item.
177
178        @return
179            the label of the menu item.
180     */
181    string getItemText( [in] short nItemId );
182
183    /** sets the command string for the menu item.
184
185        @param nItemId
186            specifies the menu item ID for which the command should be set.
187
188        @param aCommand
189            specifies the command for the menu item.
190    */
191    void setCommand( [in] short nItemId,
192                     [in] string aCommand );
193
194    /** retrieves the command string for the menu item.
195
196        @param nItemId
197            specifies the menu item ID for which the command URL should be set.
198
199        @return
200            the command of the menu item.
201    */
202    string getCommand( [in] short nItemId );
203
204    /** sets the help command string for the menu item.
205
206        @param nItemId
207            specifies the menu item ID for which the help command URL be set.
208
209        @param aCommand
210            specifies the help command for the menu item.
211    */
212    void setHelpCommand( [in] short nItemId,
213                         [in] string aCommand );
214
215    /** retrieves the help command string for the menu item.
216
217        @param nItemId
218            specifies the menu item ID for which the help command should be set.
219
220        @return
221            the help command of the menu item.
222    */
223    string getHelpCommand( [in] short nItemId );
224
225    /** sets the help text for the menu item.
226
227        @param nItemId
228            specifies the menu item identifier for which the help text should be set.
229
230        @param sHelpText
231            specifies the help text for the menu item.
232    */
233    void setHelpText( [in] short nItemId,
234                      [in] string sHelpText );
235
236    /** retrieves the help text for the menu item.
237
238        @param nItemId
239            specifies the menu item identifier for which the help text should be retrieved.
240
241        @return
242            a string with the help text.
243    */
244    string getHelpText( [in] short nItemId );
245
246    /** sets the tip help text for the menu item.
247
248        @param nItemId
249            specifies the menu item identifier for which the tip help text should be set.
250
251        @param sTipHelpText
252            specifies the tip help text for the menu item.
253    */
254    void setTipHelpText( [in] short nItemId,
255                         [in] string sTipHelpText );
256
257    /** retrieves the tip help text for the menu item.
258
259        @param nItemId
260            specifies the menu item identifier for which the tip help text should be retrieved.
261
262        @return
263            a string with the tip help text.
264    */
265    string getTipHelpText( [in] short nItemId );
266
267    /** checks whether an <type>XMenu</type> is an <type>XPopupMenu</type>.
268
269        @return
270                <TRUE/> if the menu is a <type>PopupMenu</type>,
271                <FALSE/> if it is a <type>MenuBar</type>.
272    */
273    boolean isPopupMenu();
274
275    /** sets the popup menu for a specified menu item.
276
277        @param nItemId
278            specifies the menu item ID for which the <type>XPopupMenu</type> should be set.
279
280        @param aPopupMenu
281            specifies a <type>XPopupMenu</type>.
282     */
283    [oneway] void setPopupMenu( [in] short nItemId,
284                                [in] XPopupMenu aPopupMenu );
285
286    /** returns the popup menu from the menu item.
287
288        @param nItemId
289            specifies the menu item ID for which the <type>XPopupMenu</type> should be retrieved.
290
291        @return
292            a <type>XPopupMenu</type>.
293     */
294    XPopupMenu getPopupMenu( [in] short nItemId );
295
296};
297
298}; }; }; };
299
300#endif
301