home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gwm18a.zip / wl_plug.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  2KB  |  83 lines

  1. /* Copyright 1989 GROUPE BULL -- See license conditions in file COPYRIGHT
  2.  * Copyright 1989 Massachusetts Institute of Technology
  3.  */
  4. /*********************\
  5. *               *
  6. *  WOOL_OBJECT: Plug  *
  7. *  BODY              *
  8. *               *
  9. \*********************/
  10.  
  11. #include "EXTERN.h"
  12. #include <stdio.h>
  13. #include "wool.h"
  14. #include "wl_atom.h"
  15. #include "wl_number.h"
  16. #include "wl_string.h"
  17. #include "gwm.h"
  18. #include "wl_event.h"
  19. #include "wl_fsm.h"
  20. #include "wl_label.h"
  21. #include "INTERN.h"
  22. #include "wl_plug.h"
  23.  
  24. /*
  25.  * Constructor: wool_plug_make callable from wool
  26.  */
  27.  
  28. WOOL_Plug
  29. wool_plug_make(label)
  30. WOOL_OBJECT label;
  31. {
  32.     WOOL_Plug       plug = (WOOL_Plug) Malloc(sizeof(struct _WOOL_Plug));
  33.  
  34.     zrt_put(plug);
  35.     plug -> type = WLPlug;
  36.     plug -> borderwidth = DefaultBorderWidth;
  37.     plug -> borderpixel = Context -> pixel.Border;
  38.     plug -> background = Context -> pixel.Back;
  39.     get_val_from_context(plug -> bordertile, WA_bordertile);
  40.     get_val_from_context(plug -> fsm, WA_fsm);
  41.     get_val_from_context(plug -> menu, WA_menu);
  42.     get_val_from_context(plug -> cursor, WA_cursor);
  43.     get_val_from_context(plug -> property, WA_property);
  44.  
  45.     fix_fsm(&(plug -> fsm));
  46.     increase_reference(plug -> graphic = label);
  47.     return plug;
  48. }
  49.  
  50. /*
  51.  * WLPlug_print:
  52.  * PLUG(text)
  53.  */
  54.  
  55. WOOL_OBJECT
  56. WLPlug_print(obj)
  57. WOOL_Plug       obj;
  58. {
  59.     wool_printf("{PLUG 0x%x: ", obj);
  60.     wool_print(obj -> graphic);
  61.     wool_puts("}");
  62.     return (WOOL_OBJECT) obj;
  63. }
  64.  
  65. /*
  66.  * WLPlug_free:
  67.  * recursivly free string and fsm
  68.  */
  69.  
  70. WOOL_OBJECT
  71. WLPlug_free(obj)
  72. WOOL_Plug       obj;
  73. {
  74.     decrease_reference(obj -> bordertile);
  75.     decrease_reference(obj -> menu);
  76.     decrease_reference(obj -> graphic);
  77.     decrease_reference(obj -> fsm);
  78.     decrease_reference(obj -> cursor);
  79.     decrease_reference(obj -> property);
  80.     Free(obj);
  81.     return NULL;
  82. }
  83.