home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Resources / System / BoingBag1 / Contributions / InstallerNG / GUI-API / example / igui_AskDisk.c < prev    next >
C/C++ Source or Header  |  1999-11-01  |  3KB  |  120 lines

  1.  
  2. #include "includes.h"
  3. #include "installergui_data.h"
  4.  
  5. /********************************************************************
  6.  *
  7.  *  DESCRIPTION
  8.  *
  9.  *  this panel asks the user to insert a specific disk. when the
  10.  *  user presses the "Proceed with install" button, this function
  11.  *  must check for the requested disk and must not return as long
  12.  *  as this requested disk is missing.
  13.  *
  14.  *  IN:  application - pointer to the private application structure
  15.  *       localenv - the local environment of the related ASKDISK function
  16.  *
  17.  *  OUT: -
  18.  *
  19.  */
  20.  
  21. /********************************************************************
  22.  *
  23.  *  STATIC
  24.  *
  25.  */
  26.  
  27. /********************************************************************
  28.  *
  29.  *  EXTERN
  30.  *
  31.  */
  32.  
  33. /********************************************************************
  34.  *
  35.  *  PUBLIC
  36.  *
  37.  */
  38.  
  39. /********************************************************************
  40.  *
  41.  *  CODE
  42.  *
  43.  */
  44.  
  45. void __asm igui_AskDisk(register __a0 APTR application,
  46.                         register __a1 struct FunctionEnvironment *localenv)
  47. {
  48.   #ifdef DEBUG
  49.   DEBUG_MAKRO
  50.   #endif
  51.  
  52.   {
  53.     struct Application *app = (struct Application *) application;
  54.  
  55.     APTR must;
  56.     APTR obj = GroupObject,
  57.                  Child, TextObject,
  58.                    MUIA_Frame, MUIV_Frame_None,
  59.                    MUIA_Text_Contents, localenv->fe_Prompt,
  60.                    MUIA_Text_SetMin, TRUE,
  61.                    MUIA_Text_PreParse, "\33c",
  62.                  End,
  63.                  Child, GroupObject,
  64.                    MUIA_Group_Horiz, TRUE,
  65.                    Child, HVSpace,
  66.                    Child, GroupObject,
  67.                      Child, HVSpace,
  68.                      Child, must = TextObject,
  69.                        MUIA_Text_Contents, app->app_Texts[MUST_INSERT_DISK],
  70.                        MUIA_Text_SetMin, TRUE,
  71.                        MUIA_Text_PreParse, "\33c",
  72.                        MUIA_ShowMe, FALSE,
  73.                      End,
  74.                      Child, HVSpace,
  75.                    End,
  76.                    Child, HVSpace,
  77.                  End,
  78.                End;
  79.  
  80.     // maybee BACK (if specified) or respect the swing mode
  81.     if (localenv->fe_Back)         { guistuff_SetBackButton(app, TRUE); }
  82.     else if (!app->app_SWING_Mode) { igui_NameCancel(app, (char *) app->app_GlobalEnv[GENV_ABORT_BUTTON]); }
  83.  
  84.     // show the panel
  85.     if (guistuff_NewContent(app, obj))
  86.     {
  87.       // wait, until the user does anything
  88.       while (TRUE)
  89.       {
  90.         // wait for the user to do anything
  91.         igui_WaitApp(app);
  92.  
  93.         //
  94.         if (igui_QuitApp(app)) { break; }
  95.         else
  96.         {
  97.           // where is the requested device/volume?
  98.           if (sav_ExistsDosEntry((char *) localenv->fe_Dest, LDF_VOLUMES|LDF_DEVICES)) { break; }
  99.           if (localenv->fe_Assigns)
  100.           {
  101.             if (sav_ExistsDosEntry((char *) localenv->fe_Dest, LDF_ASSIGNS)) { break; }
  102.           }
  103.  
  104.           // no correct disk available
  105.           SetAttrs(must, MUIA_ShowMe, TRUE, TAG_DONE);
  106.           DisplayBeep(NULL);
  107.         }
  108.       }
  109.     }
  110.     else { /* NO GUI OBJECT */ }
  111.  
  112.     //
  113.     if (localenv->fe_Back) { guistuff_SetBackButton(app, FALSE); }
  114.  
  115.     igui_EmptyPanel(app);
  116.     return;
  117.   }
  118. }
  119.  
  120.