/******************************************************************************

    MODUL
	menucontrol.c

    DESCRIPTION
	[X]DME intuition interface to menubase.c

    NOTES

    BUGS

    TODO

    EXAMPLES

    SEE ALSO

    INDEX

    HISTORY
	18 Dec 1992
    b_null created

******************************************************************************/

/**************************************
		Includes
**************************************/
#include "defs.h"
#include "types.h"
#include "menubase.h"


/**************************************
	    Globale Variable
**************************************/
Prototype APTR menu_cmd (struct IntuiMessage * im);


/**************************************
      Interne Defines & Strukturen
**************************************/


/**************************************
	    Interne Variable
**************************************/


/**************************************
	   Interne Prototypes
**************************************/


/*****************************************************************************

    NAME
	menu_cmd

    PARAMETER
	struct IntuiMessage * im

    RESULT
	address of a command that is referred by the
	selected menu;

    RETURN
	APTR

    DESCRIPTION
	we simply check if the command was a correct
	menu-selection and return some data that was
	stored together with the Intuition-structure

    NOTES
	we don not know, the structure of that data;
	so user might have to call macroname, macrobody
	or something like that before he is getting the wanted data

    BUGS

    EXAMPLES

    SEE ALSO

    INTERNALS
	falls korrekter Menueaufruf
	    gib entsprechendes Macro zurueck
	sonst gib NULL zurueck

    HISTORY
	18 Dec 1992 b_null  created

******************************************************************************/

APTR menu_cmd (struct IntuiMessage * im)
{
    XITEM *item;

    if (item = (XITEM *)ItemAddress (((MENUSTRIP *)currentmenu())->data, im->Code)) {
	return (item->com);
    } /* if found item */
    return (NULL);
} /* menu_cmd */

/******************************************************************************
*****  ENDE menucontrol.c
******************************************************************************/
