home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / ftp.vapor.com / voyager / voyager-sdk.lzx / zapster_prefs.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-03-27  |  1.7 KB  |  96 lines

  1. /*
  2. ** Zapster Preferences
  3. ** -------------------
  4. **
  5. ** ⌐ 2000 by David Gerber <zapek@vapor.com>
  6. ** All rights reserved
  7. **
  8. ** $Id$
  9. **
  10. */
  11.  
  12.  
  13. #include <exec/types.h>
  14. #include <dos.h>
  15.  
  16. // MUI
  17.  
  18. #include <libraries/mui.h>
  19.  
  20. // Protos
  21.  
  22. #include <proto/exec.h>
  23. #include <proto/muimaster.h>
  24.  
  25. #include "zapster_mcc.h"
  26. #include "v_plugin.h"
  27.  
  28. extern ULONG getv(APTR obj, ULONG attr);
  29.  
  30. extern struct Library *MUIMasterBase;
  31.  
  32. ULONG __stdargs DoSuperNew(struct IClass *cl,Object *obj,ULONG tag1,...)
  33. {
  34.     return(DoSuperMethod(cl, obj, OM_NEW, &tag1, NULL));
  35. }
  36.  
  37. static char *opts[] = {
  38.     "Yes",
  39.     "No",
  40.     "Maybe",
  41.     "Too bad",
  42.     NULL
  43. };
  44.  
  45.  
  46. static ULONG handleOM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
  47. {
  48.     obj = (Object *)DoSuperNew(cl, obj,
  49.                         
  50.                         /*
  51.                          * Preference object
  52.                          */
  53.                         Child, VGroup,
  54.                             Child, VSpace(0),
  55.                             Child, HGroup,
  56.                                 Child, HSpace(0),
  57.                                 Child, VGroup, GroupFrameT("Prefs example"),
  58.                                     Child, HGroup,
  59.                                         Child, Label1("Options:"), Child, Cycle(opts),
  60.                                     End,
  61.                                 End,
  62.                                 Child, HSpace(0),
  63.                             End,
  64.                             Child, VSpace(0),
  65.                         End,
  66.     TAG_DONE);
  67.  
  68.     return((ULONG)obj);
  69. }
  70.  
  71.  
  72. static ULONG handleMM_Prefs_StorePrefs(struct IClass *cl, Object *obj, ULONG *msg)
  73. {
  74.     /*
  75.      * This method does nothing but we can for example store the prefs
  76.      * in some internal structures here.
  77.      */
  78.     return(TRUE);
  79. }
  80.  
  81.  
  82. __saveds __asm ULONG prefs_dispatch(register __a0 struct IClass *cl, register __a2 Object *obj, register __a1 Msg msg)
  83. {
  84.     /*
  85.      * We need to restore the near data pointer.
  86.      * This *HAS* to be done in every dispatcher !
  87.      */
  88.     putreg(REG_A4, cl->cl_UserData);
  89.     
  90.     switch (msg->MethodID)
  91.     {
  92.         case OM_NEW:                return(handleOM_NEW(cl, obj, (APTR)msg));
  93.     }
  94.     return(DoSuperMethodA(cl,obj,(Msg)msg));
  95. }
  96.