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


#include <ProToolkit.h>
#include <ProMessage.h>
#include <ProGroup.h>
#include <ProUtil.h>

#include <PTUDFExamples.h>

/*====================================================================*\
FUNCTION: PTUDFExMessage
PURPOSE:  Show message explaining why ungroup was blocked.
\*====================================================================*/
ProError PTUDFExMessage (char* message_key)
{
  ProFileName file_name;
  ProCharLine message_name;
  
  ProStringToWstring (file_name, "pt_udf_ex_msgs.txt");
  
  strcpy (message_name, message_key);

  status = ProMessageDisplay (file_name, message_name);
  PT_TEST_LOG_SUCC ("ProMessageDisplay()");

  return (PRO_TK_NO_ERROR);
}

/*====================================================================*\
FUNCTION: PTUDFExUgroupPreventAction
PURPOSE:  Notification function called before a group is ungroup by the UI.
\*====================================================================*/
ProError PTUDFExUgroupPreventAction (ProGroup* group)
{
  PTUDFExMessage ("PTUDFEx: Preventing ungroup");

/*----------------------------------------------------------------------*\
	Return PRO_TK_GENERAL_ERROR to block ungroup; a PRO_TK_NO_ERROR
	return would allow it.
\*----------------------------------------------------------------------*/
  return (PRO_TK_GENERAL_ERROR);
}