xref: /aoo41x/main/offapi/com/sun/star/awt/XPopupMenu.idl (revision 31d843d7)
1d1766043SAndrew Rist/**************************************************************
2d026be40SAriel Constenla-Haile *
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
10d026be40SAriel Constenla-Haile *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d026be40SAriel Constenla-Haile *
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.
19d026be40SAriel Constenla-Haile *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d026be40SAriel Constenla-Haile#ifndef __com_sun_star_awt_XPopupMenu_idl__
23d026be40SAriel Constenla-Haile#define __com_sun_star_awt_XPopupMenu_idl__
24d026be40SAriel Constenla-Haile
25d026be40SAriel Constenla-Haile#include <com/sun/star/awt/KeyEvent.idl>
26*31d843d7SAriel Constenla-Haile#include <com/sun/star/awt/Rectangle.idl>
27d026be40SAriel Constenla-Haile#include <com/sun/star/awt/XMenu.idl>
28d026be40SAriel Constenla-Haile#include <com/sun/star/graphic/XGraphic.idl>
29d026be40SAriel Constenla-Haile
30d026be40SAriel Constenla-Hailemodule com {  module sun {  module star {  module awt {
31d026be40SAriel Constenla-Haile
32d026be40SAriel Constenla-Hailepublished interface XWindowPeer;
33d1766043SAndrew Rist
34cdf0e10cSrcweir/** controls a popup menu.
35cdf0e10cSrcweir */
36cdf0e10cSrcweirpublished interface XPopupMenu: XMenu
37d026be40SAriel Constenla-Haile{
38d026be40SAriel Constenla-Haile    /** inserts a separator at the specified position.
39d026be40SAriel Constenla-Haile
40d026be40SAriel Constenla-Haile        @param nItemPos
41d026be40SAriel Constenla-Haile            specifies the position where the menu separator will be insterted.
42d026be40SAriel Constenla-Haile     */
43d026be40SAriel Constenla-Haile    [oneway] void insertSeparator( [in] short nItemPos );
44d026be40SAriel Constenla-Haile
45d026be40SAriel Constenla-Haile    /** sets the menu default item.
46d026be40SAriel Constenla-Haile
47d026be40SAriel Constenla-Haile        @param nItemId
48d026be40SAriel Constenla-Haile            specifies the menu item identifier.
49d026be40SAriel Constenla-Haile     */
50d026be40SAriel Constenla-Haile    [oneway] void setDefaultItem( [in] short nItemId );
51d026be40SAriel Constenla-Haile
52d026be40SAriel Constenla-Haile    /** returns the menu default item.
53d026be40SAriel Constenla-Haile
54d026be40SAriel Constenla-Haile        @return
55d026be40SAriel Constenla-Haile            the ID of the default item.
56d026be40SAriel Constenla-Haile     */
57d026be40SAriel Constenla-Haile    short getDefaultItem();
58d026be40SAriel Constenla-Haile
59d026be40SAriel Constenla-Haile    /** sets the state of the item to be checked or unchecked.
60d026be40SAriel Constenla-Haile
61d026be40SAriel Constenla-Haile        @param nItemId
62d026be40SAriel Constenla-Haile            specifies the menu item identifier.
63d026be40SAriel Constenla-Haile
64d026be40SAriel Constenla-Haile        @param bCheck
65d026be40SAriel Constenla-Haile            specifies if the item is checked (<TRUE/>) or unchecked (<FALSE/>).
66d026be40SAriel Constenla-Haile     */
67d026be40SAriel Constenla-Haile    [oneway] void checkItem( [in] short nItemId,
68d026be40SAriel Constenla-Haile                             [in] boolean bCheck );
69d026be40SAriel Constenla-Haile
70d026be40SAriel Constenla-Haile    /** returns whether the item is checked or unchecked.
71d026be40SAriel Constenla-Haile
72d026be40SAriel Constenla-Haile        @param nItemId
73d026be40SAriel Constenla-Haile            specifies the menu item identifier.
74d026be40SAriel Constenla-Haile
75d026be40SAriel Constenla-Haile        @return
76d026be40SAriel Constenla-Haile            <TRUE/> if the item is checked, <FALSE/> otherwise.
77d026be40SAriel Constenla-Haile     */
78d026be40SAriel Constenla-Haile    boolean isItemChecked( [in] short nItemId );
79d026be40SAriel Constenla-Haile
80d026be40SAriel Constenla-Haile    /** executes the popup menu and returns the selected item
81d026be40SAriel Constenla-Haile        or <code>0</code>, if cancelled.
82d026be40SAriel Constenla-Haile
83d026be40SAriel Constenla-Haile        @param Parent
84d026be40SAriel Constenla-Haile            the parent window.
85d026be40SAriel Constenla-Haile
86d026be40SAriel Constenla-Haile        @param Position
87*31d843d7SAriel Constenla-Haile            a <type>Rectangle</type> representing the coordinates system
88*31d843d7SAriel Constenla-Haile            where the popup menu should be executed.
89d026be40SAriel Constenla-Haile
90d026be40SAriel Constenla-Haile        @param Direction
91d026be40SAriel Constenla-Haile            the direction in which a popup menu will grow, as specified
92d026be40SAriel Constenla-Haile            by one of the <type>PopupMenuDirection</type> constants.
93d026be40SAriel Constenla-Haile
94d026be40SAriel Constenla-Haile        @return
95d026be40SAriel Constenla-Haile            returns the selected item or <code>0</code>, if cancelled.
96d026be40SAriel Constenla-Haile     */
97d026be40SAriel Constenla-Haile    short execute( [in] XWindowPeer Parent,
98*31d843d7SAriel Constenla-Haile                   [in] Rectangle Position,
99d026be40SAriel Constenla-Haile                   [in] short Direction );
100d026be40SAriel Constenla-Haile
101d026be40SAriel Constenla-Haile    /** queries if the <type>PopupMenu</type> is being.
102d026be40SAriel Constenla-Haile
103d026be40SAriel Constenla-Haile        <p>Returns <TRUE/> only if the <type>PopupMenu</type> is being executed
104d026be40SAriel Constenla-Haile        as a result of invoking <member >XPopupMenu::execute()</member>; that is,
105d026be40SAriel Constenla-Haile        for a <type>PopupMenu</type> activated by a <type>MenuBar</type> item,
106d026be40SAriel Constenla-Haile        this methods returns <FALSE/>.</p>
107d026be40SAriel Constenla-Haile
108d026be40SAriel Constenla-Haile        @return
109d026be40SAriel Constenla-Haile            <TRUE/> if the <type>PopupMenu</type> is being executed,
110d026be40SAriel Constenla-Haile            <FALSE/> otherwise.
111d026be40SAriel Constenla-Haile
112d026be40SAriel Constenla-Haile        @see <member >XPopupMenu::execute()</member>
113d026be40SAriel Constenla-Haile    */
114d026be40SAriel Constenla-Haile    boolean isInExecute();
115d026be40SAriel Constenla-Haile
116d026be40SAriel Constenla-Haile    /** ends the execution of the <type>PopupMenu</type>.
117d026be40SAriel Constenla-Haile        <p><member scope="com::sun::star::awt">XPopupMenu::execute()</member>
118d026be40SAriel Constenla-Haile        will then return 0.</p>
119d026be40SAriel Constenla-Haile
120d026be40SAriel Constenla-Haile        @see <member scope="com::sun::star::awt">XPopupMenu::execute()</member>
121d026be40SAriel Constenla-Haile    */
122d026be40SAriel Constenla-Haile    void endExecute();
123d026be40SAriel Constenla-Haile
124d026be40SAriel Constenla-Haile    /** sets the <type>KeyEvent</type> for the menu item.
125d026be40SAriel Constenla-Haile
126d026be40SAriel Constenla-Haile        <p>The <type>KeyEvent</type> is <b>only</b> used as a container to transport
127d026be40SAriel Constenla-Haile        the shortcut information, this methods only draws the text corresponding to
128d026be40SAriel Constenla-Haile        this keyboard shortcut. The client code is responsible for listening to
129d026be40SAriel Constenla-Haile        keyboard events (typicaly done via <type>XUserInputInterception</type>),
130d026be40SAriel Constenla-Haile        and dispatch the respective command.</p>
131d026be40SAriel Constenla-Haile
132d026be40SAriel Constenla-Haile        @param nItemId
133d026be40SAriel Constenla-Haile            specifies the menu item identifier for which the <type>KeyEvent</type> should be set.
134d026be40SAriel Constenla-Haile
135d026be40SAriel Constenla-Haile        @param aKeyEvent
136d026be40SAriel Constenla-Haile            specifies the <type>KeyEvent</type> for the menu item.
137d026be40SAriel Constenla-Haile    */
138d026be40SAriel Constenla-Haile    void setAcceleratorKeyEvent( [in] short nItemId,
139d026be40SAriel Constenla-Haile                                 [in] KeyEvent aKeyEvent );
140d026be40SAriel Constenla-Haile
141d026be40SAriel Constenla-Haile    /** retrieves the <type>KeyEvent</type> for the menu item.
142d026be40SAriel Constenla-Haile
143d026be40SAriel Constenla-Haile        <p>The <type>KeyEvent</type> is <b>only</b> used as a container to transport
144d026be40SAriel Constenla-Haile        the shortcut information, so that in this case
145d026be40SAriel Constenla-Haile        <member scope="::com::sun::star::lang::">EventObject::Source</member> is <NULL/>.</p>
146d026be40SAriel Constenla-Haile
147d026be40SAriel Constenla-Haile        @param nItemId
148d026be40SAriel Constenla-Haile            specifies the menu item identifier for which the <type>KeyEvent</type> should be retrieved.
149d026be40SAriel Constenla-Haile
150d026be40SAriel Constenla-Haile        @return
151d026be40SAriel Constenla-Haile            the <type>KeyEvent</type> struct assigned to the requested menu item.
152d026be40SAriel Constenla-Haile    */
153d026be40SAriel Constenla-Haile    KeyEvent getAcceleratorKeyEvent( [in] short nItemId );
154d026be40SAriel Constenla-Haile
155d026be40SAriel Constenla-Haile    /** sets the image for the menu item.
156d026be40SAriel Constenla-Haile
157d026be40SAriel Constenla-Haile        @param nItemId
158d026be40SAriel Constenla-Haile            specifies the menu item identifier for which the image should be set.
159d026be40SAriel Constenla-Haile
160d026be40SAriel Constenla-Haile        @param xGraphic
161d026be40SAriel Constenla-Haile            specifies the image for the menu item.
162d026be40SAriel Constenla-Haile
163d026be40SAriel Constenla-Haile        @param bScale
164d026be40SAriel Constenla-Haile            if <TRUE/>, the image will be scaled to the standard size used internally by
165d026be40SAriel Constenla-Haile            the implementation.
166d026be40SAriel Constenla-Haile    */
167d026be40SAriel Constenla-Haile    void setItemImage( [in] short nItemId,
168d026be40SAriel Constenla-Haile                       [in] ::com::sun::star::graphic::XGraphic xGraphic,
169d026be40SAriel Constenla-Haile                       [in] boolean bScale );
170d026be40SAriel Constenla-Haile
171d026be40SAriel Constenla-Haile    /** retrieves the image for the menu item.
172d026be40SAriel Constenla-Haile
173d026be40SAriel Constenla-Haile        @param nItemId
174d026be40SAriel Constenla-Haile            specifies the menu item identifier for which the image should be retrieved.
175d026be40SAriel Constenla-Haile
176d026be40SAriel Constenla-Haile        @return
177d026be40SAriel Constenla-Haile            a <type scope="::com::sun::star::graphic::">XGraphic</type> reference
178d026be40SAriel Constenla-Haile            to the current image for the requested menu item.
179d026be40SAriel Constenla-Haile    */
180d026be40SAriel Constenla-Haile    ::com::sun::star::graphic::XGraphic getItemImage( [in] short nItemId );
181d026be40SAriel Constenla-Haile
182d026be40SAriel Constenla-Haile};
183d026be40SAriel Constenla-Haile
184d026be40SAriel Constenla-Haile}; }; }; };
185d026be40SAriel Constenla-Haile
186d026be40SAriel Constenla-Haile#endif
187