
#include "includes.h"
#include "installergui_data.h"

#include <string.h>

/********************************************************************
 *
 *  DESCRIPTION
 *
 */

/********************************************************************
 *
 *  STATIC
 *
 */

/********************************************************************
 *
 *  EXTERN
 *
 */

/********************************************************************
 *
 *  PUBLIC
 *
 */

/********************************************************************
 *
 *  CODE
 *
 */

char * __asm igui_AskString(register __a0 APTR application,
                            register __a1 struct FunctionEnvironment *localenv)
{
  #ifdef DEBUG
  DEBUG_MAKRO
  #endif

  {
    struct Application *app = (struct Application *) application;

    APTR str, txt = NULL;
    APTR strobj,
         obj = GroupObject,
                 Child, HVSpace,
                 Child, TextObject,
                   MUIA_Frame, MUIV_Frame_None, //MUIV_Frame_Text,
                   MUIA_Text_Contents, localenv->fe_Prompt,
                   MUIA_Text_SetMin, TRUE,
                   MUIA_Text_PreParse, "\33c",
                 End,
                 Child, strobj = StringObject,
                   MUIA_Frame, MUIV_Frame_String,
                   MUIA_String_Contents, localenv->fe_Default,
                   MUIA_String_Format, MUIV_String_Format_Center,
                 End,
                 Child, HVSpace,
               End;

    //
    if (guistuff_NewContent(app, obj))
    {
      //
      igui_WaitApp(app);
      if (!igui_QuitApp(app))
      {
        //
        GetAttr(MUIA_String_Contents, strobj, (ULONG *) &str);

        txt = sav_AllocVec(strlen(str) + 1, MEMF_ANY);
        if (txt) { strcpy(txt, str); }
        else     { /* NO MEMORY */ }
      }

      igui_EmptyPanel(app);
    }
    else { /* NO GUI OBJECT */ }

    return(txt);
  }
}

