/**************************************************************
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

#ifndef __com_sun_star_awt_XMenu_idl__
#define __com_sun_star_awt_XMenu_idl__

#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/awt/MenuItemType.idl>

module com {  module sun {  module star {  module awt {

published interface XPopupMenu;
published interface XMenuListener;

/** specifies a simple menu.
 */
published interface XMenu: com::sun::star::uno::XInterface
{
    /** adds the specified menu listener to receive events from this menu.

        @param xListener
            the <type>XMenuListener</type> to be added.
     */
    [oneway] void addMenuListener( [in] XMenuListener xListener );

    /** removes the specified menu listener so that it no longer
        receives events from this menu.

        @param xListener
            the <type>XMenuListener</type> to be removed.
     */
    [oneway] void removeMenuListener( [in] XMenuListener xListener );

    /** inserts an item into the menu.
        <p>The item is appended if the position is greater than or equal to
        <member>getItemCount()</member> or if it is negative.</p>

        @param nItemId
            specifies the ID of the menu item to be insterted.

        @param aText
            specifies the label of the menu item.

        @param nItemStyle
            specifies the style of the menu item, as defined in
            <type>MenuItemStyle</type>.

        @param nItemPos
            specifies the position where the menu item will be insterted.
     */
    [oneway] void insertItem( [in] short nItemId,
                              [in] string aText,
                              [in] short nItemStyle,
                              [in] short nItemPos );

    /** removes one or more items from the menu.

        @param nItemPos
            specifies the position of the (first) menu item to be removed.

        @param nCount
            specifies the number of menu items to remove.
     */
    [oneway] void removeItem( [in] short nItemPos,
                              [in] short nCount );

    /** removes all items from the menu.
     */
    void clear();

    /** returns the number of items in the menu.

        @return
            the number of items in this <type>XMenu</type>.
     */
    short getItemCount();

    /** returns the ID of the item at the specified position.

        @param nItemPos
            specifies the position of the menu item for which the item ID is queried.

        @return
            the ID of the menu item at the given position.
     */
    short getItemId( [in] short nItemPos );

    /** returns the position of the item with the specified ID.

        @param nItemId
            specifies the ID of the menu item for which the item position is queried.

        @return
            the position of the menu item with the specified ID.
     */
    short getItemPos( [in] short nItemId );

    /** retrieves the type of the menu item.

        @param nItemPos
            specifies the position of the menu item for which the item type is queried.

        @return
            a <type>MenuItemType</type> indicating the item type.
    */
    ::com::sun::star::awt::MenuItemType getItemType( [in] short nItemPos );

    /** enables or disables the menu item.

        @param nItemId
            specifies the menu item ID.

        @param bEnable
            specifies whether the menu item should be enabled (<TRUE/>) or
            disabled (<FALSE/>).
     */
    [oneway] void enableItem( [in] short nItemId,
                              [in] boolean bEnable );

    /** returns the state of the menu item.

        @param nItemId
            specifies the menu item ID.

        @return
            <TRUE/> if the item is enabled, <FALSE/> otherwise.
     */
    boolean isItemEnabled( [in] short nItemId );

    /** specifies whether disabled menu entries should be hidden, or not.

        @param bHide
            if <TRUE/>, disabled menu entries are hidden.
    */
    void hideDisabledEntries( [in] boolean bHide );

    /** specifies whether mnemonics are automatically assigned to menu items, or not.

        @param bEnable
            if <TRUE/>, mnemonics are automatically assigned to menu items.
    */
    void enableAutoMnemonics( [in] boolean bEnable );

    /** sets the text for the menu item.

        @param nItemId
            specifies the ID of the menu item.

        @param aText
            specifies the label of the menu item.
     */
    [oneway] void setItemText( [in] short nItemId,
                               [in] string aText );

    /** returns the string for the given item id.

        @param nItemId
            specifies the ID of the menu item.

        @return
            the label of the menu item.
     */
    string getItemText( [in] short nItemId );

    /** sets the command string for the menu item.

        @param nItemId
            specifies the menu item ID for which the command should be set.

        @param aCommand
            specifies the command for the menu item.
    */
    void setCommand( [in] short nItemId,
                     [in] string aCommand );

    /** retrieves the command string for the menu item.

        @param nItemId
            specifies the menu item ID for which the command URL should be set.

        @return
            the command of the menu item.
    */
    string getCommand( [in] short nItemId );

    /** sets the help command string for the menu item.

        @param nItemId
            specifies the menu item ID for which the help command URL be set.

        @param aCommand
            specifies the help command for the menu item.
    */
    void setHelpCommand( [in] short nItemId,
                         [in] string aCommand );

    /** retrieves the help command string for the menu item.

        @param nItemId
            specifies the menu item ID for which the help command should be set.

        @return
            the help command of the menu item.
    */
    string getHelpCommand( [in] short nItemId );

    /** sets the help text for the menu item.

        @param nItemId
            specifies the menu item identifier for which the help text should be set.

        @param sHelpText
            specifies the help text for the menu item.
    */
    void setHelpText( [in] short nItemId,
                      [in] string sHelpText );

    /** retrieves the help text for the menu item.

        @param nItemId
            specifies the menu item identifier for which the help text should be retrieved.

        @return
            a string with the help text.
    */
    string getHelpText( [in] short nItemId );

    /** sets the tip help text for the menu item.

        @param nItemId
            specifies the menu item identifier for which the tip help text should be set.

        @param sTipHelpText
            specifies the tip help text for the menu item.
    */
    void setTipHelpText( [in] short nItemId,
                         [in] string sTipHelpText );

    /** retrieves the tip help text for the menu item.

        @param nItemId
            specifies the menu item identifier for which the tip help text should be retrieved.

        @return
            a string with the tip help text.
    */
    string getTipHelpText( [in] short nItemId );

    /** checks whether an <type>XMenu</type> is an <type>XPopupMenu</type>.

        @return
                <TRUE/> if the menu is a <type>PopupMenu</type>,
                <FALSE/> if it is a <type>MenuBar</type>.
    */
    boolean isPopupMenu();

    /** sets the popup menu for a specified menu item.

        @param nItemId
            specifies the menu item ID for which the <type>XPopupMenu</type> should be set.

        @param aPopupMenu
            specifies a <type>XPopupMenu</type>.
     */
    [oneway] void setPopupMenu( [in] short nItemId,
                                [in] XPopupMenu aPopupMenu );

    /** returns the popup menu from the menu item.

        @param nItemId
            specifies the menu item ID for which the <type>XPopupMenu</type> should be retrieved.

        @return
            a <type>XPopupMenu</type>.
     */
    XPopupMenu getPopupMenu( [in] short nItemId );

};

}; }; }; };

#endif
