home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / fish / disks / d1031.lha / Programs / Textfield / MUITest / muitest.c < prev    next >
C/C++ Source or Header  |  1994-11-12  |  2KB  |  87 lines

  1. /*
  2.  * muitest.c was generated with MUIBuilder, except for the part
  3.  * that makes the Textfield gadget, which I just modified from
  4.  * from a list object.
  5.  *
  6.  * When using the Textfield gadgetin MUI, I suggest you use the
  7.  * frames and labels that it provides instead of the features
  8.  * builtin to the Textfield gadget.  This way, MUI has a better
  9.  * idea how to correctly layout the graphics elements.
  10.  */
  11.  
  12. #include <libraries/mui.h>
  13. #include <proto/muimaster.h>
  14. #include <clib/exec_protos.h>
  15. #include <exec/memory.h>
  16. #include <intuition/icclass.h>
  17. #include <gadgets/textfield.h>
  18.  
  19. #include <proto/textfield.h>
  20.  
  21. #ifndef MAKE_ID
  22. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  23. #endif
  24.  
  25. #ifdef _DCC
  26. #define __inline
  27. #endif
  28.  
  29. #define MUIA_Boopsi_Smart 0x8042b8d7 /* V9 i.. BOOL */
  30.  
  31. /*    ExTended KeyButton ( or Eric Totel KeyButton :-) )    */
  32. /*    to use with localization features             */
  33.  
  34. static APTR __inline ETKeyButton(char *text)
  35. {
  36.         return (KeyButton(&text[3], text[1]));
  37. }
  38.  
  39. #include "muitest.h"
  40.  
  41. struct ObjApp * CreateApp( void )
  42. {
  43.     struct ObjApp * Object;
  44.  
  45.     if (!(Object = AllocVec( sizeof( struct ObjApp ), MEMF_PUBLIC|MEMF_CLEAR )))
  46.         return( NULL );
  47.  
  48.  
  49.     Object->App = ApplicationObject,
  50.         MUIA_Application_Author, "NONE",
  51.         MUIA_Application_Base, "NONE",
  52.         MUIA_Application_Title, "NONE",
  53.         MUIA_Application_Version, "$VER: NONE XX.XX (XX.XX.XX)",
  54.         MUIA_Application_Copyright, "NOBODY",
  55.         MUIA_Application_Description, "NONE",
  56.         SubWindow, Object->window = WindowObject,
  57.             MUIA_Window_Title, "Test MUI - BOOPSI",
  58.             MUIA_Window_ID, MAKE_ID( '0','W','I','N' ),
  59.             WindowContents, GroupObject,
  60.                 MUIA_Group_Horiz, TRUE,
  61.                 Child, Object->text = BoopsiObject,  /* MUI and Boopsi tags mixed */
  62.                     InputListFrame,
  63.                     MUIA_Boopsi_Class,        TextFieldClass,
  64.                     MUIA_Boopsi_Smart,        TRUE,
  65.                     MUIA_Boopsi_MinWidth,    20, /* boopsi objects don't know */
  66.                     MUIA_Boopsi_MinHeight,    20, /* their sizes, so we help   */
  67.                     ICA_TARGET,                ICTARGET_IDCMP, /* needed for notification */
  68.                     TEXTFIELD_Text,            (ULONG)"Hello?",
  69.                 End,
  70.             End,
  71.         End,
  72.     End;
  73.  
  74.     if (!(Object->App))
  75.     {
  76.         FreeVec(Object);
  77.         Object = NULL;
  78.     }
  79.     return( Object );
  80. }
  81.  
  82. void DisposeApp( struct ObjApp * Object )
  83. {
  84.     MUI_DisposeObject(Object->App);
  85.     FreeVec( Object );
  86. }
  87.