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