/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ /*---------------------- Pro/Toolkit Includes ------------------------*/ #include <ProToolkit.h> #include <ProMenu.h> #include <ProMdl.h> /*---------------------- Application Includes ------------------------*/ #include <TestError.h> /*----------------------------------------------------------------------------*\ Pro/TOOLKIT includes \*----------------------------------------------------------------------------*/ #include <ProToolkit.h> #include <ProMenu.h> #include <ProMessage.h> #include <TestError.h> /*----------------------------------------------------------------------------*\ Application includes \*----------------------------------------------------------------------------*/ #define EX9_LEFT 0 #define EX9_TOP 0 /*----------------------------------------------------------------------------*\ Prototypes \*----------------------------------------------------------------------------*/ int ProUserSelfClosingExample(ProAppData data, int num); int ProUserNonClosingExample(); int ProUserJustificationExample(); int ProUserBitsChangeExample(); ProError ProUserValueMenuCreate(ProAppData data, int num); ProError ProUserNewMenuShow() ; ProError ProDefineNonClosingMenu() ; ProError ProDefineSelfClosingMenu(); char ProUserBitsChange(char); int ProUserNavigatorPane(); extern ProError UgAddNewPane(); extern ProError UgAddNewDialogPane(); extern ProError UgChangeNavPaneUrl(); extern ProError UgChangeNavPaneIcon(); extern ProError UgNavPaneInfoGet(); /*-------------------------Function Declaration-------------------------------*/ extern int ProUserJustificationSet(int *vert, int *horz); int ProUserMenuDemo(); /*============================================================================*\ Function : ProUserMenuDemo Purpose : Create a menu for testing the chapter 2 examples \*============================================================================*/ int ProUserMenuDemo() { ProError err; int menuId; int action; err = ProMenuFileRegister("UGMenu", "ugmenu.mnu", &menuId); ERROR_CHECK("ProUserMenuDemo", "ProMenuFileRegister", err); err = ProMenubuttonActionSet("UGMenu", "-SelfClosingMenu", (ProMenubuttonAction)ProUserSelfClosingExample, NULL, 0); ERROR_CHECK("ProUserMenuDemo", "ProMenubuttonActionSet", err); err = ProMenubuttonActionSet("UGMenu", "-NonClosingMenu", (ProMenubuttonAction)ProUserNonClosingExample, NULL, 0); ERROR_CHECK("ProUserMenuDemo", "ProMenubuttonActionSet", err); err = ProMenubuttonActionSet("UGMenu", "-ValueMenu", (ProMenubuttonAction)ProUserValueMenuCreate, NULL, 0); ERROR_CHECK("ProUserMenuDemo", "ProMenubuttonActionSet", err); err = ProMenubuttonActionSet("UGMenu", "-Justification", (ProMenubuttonAction)ProUserJustificationExample, NULL, 0); ERROR_CHECK("ProUserMenuDemo", "ProMenubuttonActionSet", err); err = ProMenubuttonActionSet("UGMenu", "-BitsChange", (ProMenubuttonAction)ProUserBitsChangeExample, NULL, 0); ERROR_CHECK("ProUserMenuDemo", "ProMenubuttonActionSet", err); err = ProMenubuttonActionSet("UGMenu", "-NavigatorPane", (ProMenubuttonAction)ProUserNavigatorPane, NULL, 0); ERROR_CHECK("ProUserMenuDemo", "ProMenubuttonActionSet", err); err = ProMenubuttonActionSet("UGMenu", "UGMenu", (ProMenubuttonAction)ProMenuDelete, NULL, 0); ERROR_CHECK("ProUserMenuDemo", "ProMenubuttonActionSet", err); err = ProMenuCreate(PROMENUTYPE_MAIN, "UGMenu", &menuId); ERROR_CHECK("ProUserMenuDemo", "ProMenuCreate", err); err = ProMenuProcess("", &action); ERROR_CHECK("ProUserMenuDemo", "ProMenuProcess", err); return(0); } /*============================================================================*\ Function : ProUserSelfClosingExample Purpose : Illustrate User's Guide \*============================================================================*/ int ProUserSelfClosingExample(ProAppData data, int num) { ProError err; /*----------------------------------------------------------------------------*\ Call Example 4 function \*----------------------------------------------------------------------------*/ err = ProDefineSelfClosingMenu(); ERROR_CHECK("ProUserSelfClosingExample","ProDefineSelfClosingMenu",err); /*----------------------------------------------------------------------------*\ Call Example 6 function \*----------------------------------------------------------------------------*/ err = ProUserNewMenuShow(); ERROR_CHECK("ProUserSelfClosingExample","ProUserNewMenuShow",err); return(0); } /*============================================================================*\ Function : ProUserNonClosingExample Purpose : Illustrate User's Guide \*============================================================================*/ int ProUserNonClosingExample() { ProError err; /*----------------------------------------------------------------------------*\ Call Example 5 function \*----------------------------------------------------------------------------*/ err = ProDefineNonClosingMenu(); ERROR_CHECK("ProUserNonClosingExample","ProDefineNonClosingMenu",err); /*----------------------------------------------------------------------------*\ Call Example 6 function \*----------------------------------------------------------------------------*/ err = ProUserNewMenuShow(); ERROR_CHECK("ProUserNonClosingExample","ProUserNewMenuShow",err); return(0); } /*============================================================================*\ Function : ProUserJustificationExample Purpose : Illustrate User's Guide \*============================================================================*/ int ProUserJustificationExample() { int vert, horz; int status; vert = EX9_TOP; horz = EX9_LEFT; /*----------------------------------------------------------------------------*\ Call Example 9 function \*----------------------------------------------------------------------------*/ status = ProUserJustificationSet(&vert, &horz); ERROR_CHECK("ProUserJustificationExample","ProUserJustificationSet",status); return(status); } /*============================================================================*\ Function : ProUserBitsChangeExample Purpose : Illustrate User's Guide \*============================================================================*/ int ProUserBitsChangeExample() { char bits; bits = 0; bits = ProUserBitsChange(bits); return(0); } /*====================================================================* Function : ProUserNavigatorPane() Purpose : Add Navigstor Pane menu of the User Guide example \*====================================================================*/ int ProUserNavigatorPane() { int menu_id, action, status; status = ProMenuFileRegister("UgNavigatorPane", "ugnavigatorpane.mnu", &menu_id); ERROR_CHECK( "UgNavigatorPane", "ProMenuFileRegister", status ); status = ProMenubuttonActionSet("UgNavigatorPane","-AddNewPane", (ProMenubuttonAction) UgAddNewPane, NULL, 0); ERROR_CHECK( "ProUserNavigatorPane", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UgNavigatorPane","-AddNewDialogPane", (ProMenubuttonAction) UgAddNewDialogPane, NULL, 0); ERROR_CHECK( "ProUserNavigatorPane", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UgNavigatorPane","-ChangeNavPaneUrl", (ProMenubuttonAction) UgChangeNavPaneUrl, NULL, 0); ERROR_CHECK( "ProUserNavigatorPane", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UgNavigatorPane","-ChangeNavPaneIcon", (ProMenubuttonAction) UgChangeNavPaneIcon, NULL, 0); ERROR_CHECK( "ProUserNavigatorPane", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UgNavigatorPane","-NavPaneInfoGet", (ProMenubuttonAction) UgNavPaneInfoGet, NULL, 0); ERROR_CHECK( "ProUserNavigatorPane", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UgNavigatorPane","-Done/Return", (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0); ERROR_CHECK( "ProUserNavigatorPane", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UgNavigatorPane","UgNavigatorPane", (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0); ERROR_CHECK( "ProUserNavigatorPane", "ProMenubuttonActionSet", status ); status = ProMenuPush(); ERROR_CHECK( "ProUserNavigatorPane", "ProMenuPush", status ); status = ProMenuCreate(PROMENUTYPE_MAIN, "UgNavigatorPane", &menu_id); ERROR_CHECK( "ProUserNavigatorPane", "ProMenuCreate", status ); status = ProMenuProcess("UgNavigatorPane", &action); ERROR_CHECK( "ProUserNavigatorPane", "ProMenuProcess", status ); return(0); } #undef EX9_LEFT #undef EX9_TOP