#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>

#include <WSCmessageDialog.h>
#include <WSCtextField.h>

//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
extern WSCstring backup;
extern WSCtextField* newtext_001;
extern void m13ep(WSCbase*);
extern void m14ep(WSCbase*);

void m15ep(WSCbase* object){
  //do something...
  WSCstring text;
  text = newtext_001->getProperty(WSNlabelString);
  if (!strcmp((char*)text,(char*)backup)){
    //same...
  }else{
    WSCstring fname;
    fname = newtext_001->getProperty(WSNuserString);
    if (!strcmp((char*)fname,"")){
      m14ep(object); //rename save..
    }else{
      WSCmessageDialog* msg = WSGIappMessageDialog();
      WSCstring message;
      message << "file: " << (char*)fname
              << " 은 편집되여있습니다. \n"
              << "저장하겠습니까?";
      msg->setProperty(WSNdefaultPosition,True);
      msg->setProperty(WSNwidth,400);
      msg->setProperty(WSNheight,130);
      msg->setProperty(WSNlabelString,message);
      long ret = msg->popup();
      if (ret == WS_DIALOG_OK){
        m13ep(object); //rename save..
      }
    }
  }
  exit(0);
}
static WSCfunctionRegister  op("m15ep",(void*)m15ep);
