/*
	Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
*/



/*---------------------- Pro/Toolkit Includes ------------------------*/
#include <ProToolkit.h>
#include <ProMenu.h>

/*---------------------- Function Prototypes -------------------------*/
ProError ProUserValueMenuCreate();
ProError ProUserValueGet();

/*------------------------------------------------------------*\
    The three values to choose from
\*------------------------------------------------------------*/
#define	EX3_QUIT	-1
#define	EX3_VALUE1	1
#define	EX3_VALUE2	2
#define	EX3_VALUE3	3

ProError ProUserValueMenuCreate(void *a, int b)
{
    int action, menuId;
    ProError ProUserValueGet(void *dummy, int value);

    int value;

/*------------------------------------------------------------*\
    Set up the value menu
\*------------------------------------------------------------*/
    ProMenuFileRegister("value", "value.mnu", &menuId);
    ProMenubuttonActionSet("value", "Value 1", 
        (ProMenubuttonAction)ProUserValueGet, NULL, EX3_VALUE1);
       
    ProMenubuttonActionSet("value", "Value 2", 
        (ProMenubuttonAction)ProUserValueGet, NULL, EX3_VALUE2);

    ProMenubuttonActionSet("value", "Value 3", 
        (ProMenubuttonAction)ProUserValueGet, NULL, EX3_VALUE3);
	
    ProMenubuttonActionSet("value", "Quit",
        (ProMenubuttonAction)ProMenuDelete, NULL, EX3_QUIT);

    ProMenubuttonActionSet("value", "value", 
        (ProMenubuttonAction)ProMenuHold, NULL, 0);

/*------------------------------------------------------------*\
    Use the value menu
\*------------------------------------------------------------*/
    ProMenuCreate(PROMENUTYPE_MAIN, "value", &menuId);
    value = ProMenuProcess("", &action);

    if(value == EX3_QUIT)
	return(0);
}

/*------------------------------------------------------------*\
    Command-function to close a menu, returning the selected value
\*------------------------------------------------------------*/
ProError ProUserValueGet(void *dummy, int value)
{
    ProMenuDeleteWithStatus(value);
    return(0);
}