home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Programming / Source / winterp-1.13 / examples / pixmaps.lsp < prev    next >
Encoding:
Lisp/Scheme  |  1991-10-06  |  13.3 KB  |  396 lines

  1. ; -*-Lisp-*-
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;
  4. ; File:         pixmaps.lsp
  5. ; RCS:          $Header: pixmaps.lsp,v 1.5 91/10/05 18:32:58 mayer Exp $
  6. ; Description:  Play around with pixmaps. These are just random individual forms
  7. ;               I eval'd to play around and test pixmaps, pixmap garbage
  8. ;               collection, image cacheing, etc.
  9. ;               Many of the pixmaps mentioned in this file do not exist on your
  10. ;               machine.
  11. ; Author:       Niels Mayer, HPLabs
  12. ; Created:      Sat Nov 25 01:44:36 1989
  13. ; Modified:     Sat Oct  5 18:32:37 1991 (Niels Mayer) mayer@hplnpm
  14. ; Language:     Lisp
  15. ; Package:      N/A
  16. ; Status:       X11r5 contrib tape release
  17. ;
  18. ; WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  19. ; XLISP version 2.1, Copyright (c) 1989, by David Betz.
  20. ;
  21. ; Permission to use, copy, modify, distribute, and sell this software and its
  22. ; documentation for any purpose is hereby granted without fee, provided that
  23. ; the above copyright notice appear in all copies and that both that
  24. ; copyright notice and this permission notice appear in supporting
  25. ; documentation, and that the name of Hewlett-Packard and Niels Mayer not be
  26. ; used in advertising or publicity pertaining to distribution of the software
  27. ; without specific, written prior permission.  Hewlett-Packard and Niels Mayer
  28. ; makes no representations about the suitability of this software for any
  29. ; purpose.  It is provided "as is" without express or implied warranty.
  30. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  31.  
  32. (progn
  33.   (setq b1
  34.     (send xm_push_button_widget_class :new :managed rc_w
  35.           :XMN_LABEL_TYPE :PIXMAP
  36.           :XMN_LABEL_PIXMAP (xm_get_pixmap "background"  "white" "DarkSlateGrey")))
  37.   (setq b2
  38.     (send xm_push_button_widget_class :new :managed rc_w
  39.           :XMN_LABEL_TYPE :PIXMAP
  40.           :XMN_LABEL_PIXMAP (xm_get_pixmap "25_foreground" "white" "DarkSlateGrey")))
  41.   (setq b3
  42.     (send xm_push_button_widget_class :new :managed rc_w
  43.           :XMN_LABEL_TYPE :PIXMAP
  44.           :XMN_LABEL_PIXMAP (xm_get_pixmap "50_foreground"  "white" "DarkSlateGrey")))
  45.   (setq b4
  46.     (send xm_push_button_widget_class :new :managed rc_w
  47.           :XMN_LABEL_TYPE :PIXMAP
  48.           :XMN_LABEL_PIXMAP (xm_get_pixmap "75_foreground"  "white" "DarkSlateGrey")))
  49.   (setq b5
  50.     (send xm_push_button_widget_class :new :managed rc_w
  51.           :XMN_LABEL_TYPE :PIXMAP
  52.           :XMN_LABEL_PIXMAP (xm_get_pixmap "vertical" "white" "DarkSlateGrey")))
  53.   (setq b6
  54.     (send xm_push_button_widget_class :new :managed rc_w
  55.           :XMN_LABEL_TYPE :PIXMAP
  56.           :XMN_LABEL_PIXMAP (xm_get_pixmap "horizontal"  "white" "DarkSlateGrey")))
  57.   (setq b7
  58.     (send xm_push_button_widget_class :new :managed rc_w
  59.           :XMN_LABEL_TYPE :PIXMAP
  60.           :XMN_LABEL_PIXMAP (xm_get_pixmap "slant_right"  "white" "DarkSlateGrey")))
  61.   (setq b8
  62.     (send xm_push_button_widget_class :new :managed rc_w
  63.           :XMN_LABEL_TYPE :PIXMAP
  64.           :XMN_LABEL_PIXMAP (xm_get_pixmap "slant_left" "white" "DarkSlateGrey")))
  65.   (setq b9
  66.     (send xm_push_button_widget_class :new :managed rc_w
  67.           :XMN_LABEL_TYPE :PIXMAP
  68.           :XMN_LABEL_PIXMAP (xm_get_pixmap "menu_cascade" "white" "DarkSlateGrey")))
  69.   (setq b10
  70.     (send xm_push_button_widget_class :new :managed rc_w
  71.           :XMN_LABEL_TYPE :PIXMAP
  72.           :XMN_LABEL_PIXMAP (xm_get_pixmap "menu_checkmark"  "white" "DarkSlateGrey")))
  73.   )
  74.  
  75. (progn
  76.   (send b1 :set_values
  77.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  78.   (send b2 :set_values
  79.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  80.   (send b3 :set_values
  81.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  82.   (send b4 :set_values
  83.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  84.   (send b5 :set_values
  85.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  86.   (send b6 :set_values
  87.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  88.   (send b7 :set_values
  89.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  90.   (send b8 :set_values
  91.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  92.   (send b9 :set_values
  93.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  94.   (send b10 :set_values
  95.     :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "white" "DarkSlateGrey"))
  96.   )
  97.  
  98. (progn
  99.   (setq b1
  100.     (send xm_push_button_widget_class :new :managed rc_w
  101.           :XMN_LABEL_TYPE :PIXMAP
  102.           :XMN_LABEL_PIXMAP "background"))
  103.   (setq b2
  104.     (send xm_push_button_widget_class :new :managed rc_w
  105.           :XMN_LABEL_TYPE :PIXMAP
  106.           :XMN_LABEL_PIXMAP "25_foreground" ))
  107.   (setq b3
  108.     (send xm_push_button_widget_class :new :managed rc_w
  109.           :XMN_LABEL_TYPE :PIXMAP
  110.           :XMN_LABEL_PIXMAP "50_foreground"  ))
  111.   (setq b4
  112.     (send xm_push_button_widget_class :new :managed rc_w
  113.           :XMN_LABEL_TYPE :PIXMAP
  114.           :XMN_LABEL_PIXMAP "75_foreground"  ))
  115.   (setq b5
  116.     (send xm_push_button_widget_class :new :managed rc_w
  117.           :XMN_LABEL_TYPE :PIXMAP
  118.           :XMN_LABEL_PIXMAP "vertical" ))
  119.   (setq b6
  120.     (send xm_push_button_widget_class :new :managed rc_w
  121.           :XMN_LABEL_TYPE :PIXMAP
  122.           :XMN_LABEL_PIXMAP "horizontal"  ))
  123.   (setq b7
  124.     (send xm_push_button_widget_class :new :managed rc_w
  125.           :XMN_LABEL_TYPE :PIXMAP
  126.           :XMN_LABEL_PIXMAP "slant_right"  ))
  127.   (setq b8
  128.     (send xm_push_button_widget_class :new :managed rc_w
  129.           :XMN_LABEL_TYPE :PIXMAP
  130.           :XMN_LABEL_PIXMAP "slant_left" ))
  131.   (setq b9
  132.     (send xm_push_button_widget_class :new :managed rc_w
  133.           :XMN_LABEL_TYPE :PIXMAP
  134.           :XMN_LABEL_PIXMAP "menu_cascade" ))
  135.   (setq b10
  136.     (send xm_push_button_widget_class :new :managed rc_w
  137.           :XMN_LABEL_TYPE :PIXMAP
  138.           :XMN_LABEL_PIXMAP "menu_checkmark"  ))
  139.   )
  140.  
  141.  
  142.  
  143.  
  144.  
  145. (setq pb_w (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  146.       :XMN_LABEL_TYPE :PIXMAP
  147.       :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman" "red" "blue")))
  148. (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  149.       :XMN_LABEL_TYPE :PIXMAP
  150.       :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/wingdogs" "red" "blue"))
  151. (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  152.       :XMN_LABEL_TYPE :PIXMAP
  153.       :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/flagup" "red" "blue"))
  154. (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  155.       :XMN_LABEL_TYPE :PIXMAP
  156.       :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/flagdown" "red" "blue"))
  157. (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  158.       :XMN_LABEL_TYPE :PIXMAP
  159.       :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/xlogo16" "red" "blue"))
  160. (send pb_w :set_values 
  161.       :XMN_LABEL_TYPE :PIXMAP
  162.       :XMN_LABEL_PIXMAP "/usr/include/X11/bitmaps/woman")
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169. (setq pb_w 
  170.       (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  171.           )
  172.       )
  173. (send pb_w :set_values 
  174.       :XMN_LABEL_TYPE :PIXMAP
  175.       :XMN_LABEL_PIXMAP "/usr/include/X11/bitmaps/woman"
  176.       )
  177. (gc)
  178.  
  179.  
  180.  
  181.  
  182.  
  183. (setq pb_w 
  184.       (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  185.         :XMN_LABEL_TYPE :PIXMAP
  186.         :XMN_LABEL_PIXMAP "/usr/include/X11/bitmaps/xlogo16"
  187. ;        :XMN_ARM_PIXMAP "/usr/include/X11/bitmaps/flagup"
  188.         )
  189.       )
  190.  
  191. (setq pb_w 
  192.       (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  193.         :XMN_LABEL_TYPE :PIXMAP
  194.         :XMN_LABEL_PIXMAP "/usr/include/X11/bitmaps/flagdown"
  195.         )
  196.       )
  197.  
  198. (send pb_w :set_values 
  199.       :XMN_LABEL_TYPE :PIXMAP
  200.       :XMN_LABEL_PIXMAP "/usr/include/X11/bitmaps/woman"
  201.       )
  202.  
  203. (setq image1_pixmap (xm_get_pixmap "/usr/include/X11/bitmaps/woman"
  204.                  "white" "DarkSlateGrey"))
  205.  
  206. (setq pb_w (send xm_push_button_widget_class :new :managed rc_w
  207.          :XMN_LABEL_TYPE :PIXMAP
  208.          :XMN_LABEL_PIXMAP (xm_get_pixmap
  209.                     "/usr/include/X11/bitmaps/wingdogs"
  210.                     "white" "DarkSlateGrey")
  211.          ))
  212.  
  213. (send pb_w :set_values 
  214.       :XMN_LABEL_PIXMAP (xm_get_pixmap
  215.              "/usr/include/X11/bitmaps/xlogo16"
  216.              "white" "DarkSlateGrey")
  217.       )
  218.  
  219. (gc)
  220.  
  221. ; (setq image1_pixmap nil)
  222. (send pb_w :set_values 
  223.       :XMN_LABEL_TYPE :PIXMAP
  224.       :XMN_LABEL_PIXMAP image1_pixmap
  225.       )
  226.  
  227.  
  228. (setq pb_w 
  229.       (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  230.         :XMN_LABEL_TYPE :PIXMAP
  231.         :XMN_LABEL_PIXMAP image1_pixmap
  232.         )
  233.       )
  234. (setq image1_pixmap (xm_get_pixmap "/usr/include/X11/bitmaps/flagup"
  235.                  "blue" "red"))
  236.  
  237. (gc)
  238.  
  239. (setq pb_w 
  240.       (send XM_push_button_widget_CLASS :new :managed "foo" rc_w
  241.         :XMN_LABEL_TYPE :PIXMAP
  242.         :XMN_LABEL_PIXMAP image1_pixmap
  243. ;        :XMN_ARM_PIXMAP   image2_pixmap
  244.         )
  245.       )
  246.  
  247.  
  248. (setq rc (send XM_ROW_COLUMN_WIDGET_CLASS :new :managed
  249.                "rc"
  250.                (send (send TOP_LEVEL_SHELL_WIDGET_CLASS :new :XMN_GEOMETRY "500x500") :realize)
  251.                :xmn_orientation :vertical
  252.                :xmn_packing :pack_tight
  253.                :xmn_entry_alignment :alignment_center
  254.                :xmn_foreground "Black"
  255.                :xmn_background "LightGray"))
  256.  
  257. (setq to_w 
  258.       (send XM_toggle_button_widget_CLASS :new :managed "foo" rc
  259.         :XMN_LABEL_TYPE :PIXMAP
  260.         :XMN_LABEL_PIXMAP "/usr/include/X11/bitmaps/wingdogs"
  261.         :XMN_select_PIXMAP "/usr/include/X11/bitmaps/flagup"
  262.         :XMN_select_insensitive_PIXMAP "/usr/include/X11/bitmaps/flagdown"
  263.         )
  264.       )
  265.  
  266. (setq to_w 
  267.       (send XM_toggle_button_widget_CLASS :new :managed "foo" rc
  268.         :XMN_LABEL_TYPE :PIXMAP
  269.         :XMN_LABEL_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/woman"  "white" "DarkSlateGrey")
  270.         :XMN_select_PIXMAP (xm_get_pixmap "/usr/include/X11/bitmaps/wingdogs"  "red" "blue")
  271.         )
  272.       )
  273.  
  274.  
  275.  
  276.  
  277.  
  278. (send to_w :set_values 
  279.         :XMN_LABEL_PIXMAP "/usr/include/X11/bitmaps/xlogo64"
  280.         :XMN_SELECT_PIXMAP "/usr/include/X11/bitmaps/xlogo16"
  281.         )
  282.  
  283. (setq mbox_w
  284.       (send XM_MESSAGE_BOX_WIDGET_CLASS :new :managed :message_dialog top_w
  285.         :XMN_SYMBOL_PIXMAP "/usr/include/X11/bitmaps/woman"
  286.         ))
  287.  
  288.  
  289.  
  290. (xm_install_image
  291.  (setq image0_xi (xm_get_ximage_from_file "/usr/include/X11/bitmaps/woman"))
  292.  "image0")
  293.  
  294. (xm_install_image
  295.  (setq image1_xi (xm_get_ximage_from_file "/usr/include/X11/bitmaps/wingdogs"))
  296.  "image1")
  297.  
  298. (xm_install_image
  299.  (setq image2_xi (xm_get_ximage_from_file "/usr/include/X11/bitmaps/flagup"))
  300.  "image2")
  301.  
  302. (xm_install_image
  303.  (setq image3_xi (xm_get_ximage_from_file "/usr/include/X11/bitmaps/flagdown"))
  304.  "image3")
  305.  
  306. (xm_install_image
  307.  (setq image4_xi (xm_get_ximage_from_file "/usr/include/X11/bitmaps/xlogo16"))
  308.  "image4")
  309.  
  310. (format T "~A, ~A, ~A, ~A, ~A\n" image0_xi image1_xi image2_xi image3_xi image4_xi)
  311.  
  312. (progn
  313.   (setq b1
  314.     (send xm_push_button_widget_class :new :managed rc_w
  315.           :XMN_LABEL_TYPE :PIXMAP
  316.           :XMN_LABEL_PIXMAP (xm_get_pixmap "image0"  "white" "DarkSlateGrey")))
  317.   (setq b2
  318.     (send xm_push_button_widget_class :new :managed rc_w
  319.           :XMN_LABEL_TYPE :PIXMAP
  320.           :XMN_LABEL_PIXMAP (xm_get_pixmap "image1" "white" "DarkSlateGrey")))
  321.   (setq b3
  322.     (send xm_push_button_widget_class :new :managed rc_w
  323.           :XMN_LABEL_TYPE :PIXMAP
  324.           :XMN_LABEL_PIXMAP (xm_get_pixmap "image2"  "white" "DarkSlateGrey")))
  325.   (setq b4
  326.     (send xm_push_button_widget_class :new :managed rc_w
  327.           :XMN_LABEL_TYPE :PIXMAP
  328.           :XMN_LABEL_PIXMAP (xm_get_pixmap "image3"  "white" "DarkSlateGrey")))
  329.   (setq b5
  330.     (send xm_push_button_widget_class :new :managed rc_w
  331.           :XMN_LABEL_TYPE :PIXMAP
  332.           :XMN_LABEL_PIXMAP (xm_get_pixmap "image4" "white" "DarkSlateGrey")))
  333.   )
  334.  
  335. (xm_uninstall_image image0_xi)
  336. (xm_uninstall_image image1_xi)
  337. (xm_uninstall_image image2_xi)
  338. (xm_uninstall_image image3_xi)
  339. (xm_uninstall_image image4_xi)
  340.  
  341.  
  342.  
  343.  
  344. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  345. ; try out method :update_display in callback.
  346. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  347. (setq pb_w (send xm_push_button_widget_class :new :managed rc_w
  348.          :XMN_LABEL_TYPE :PIXMAP
  349.          :XMN_LABEL_PIXMAP (xm_get_pixmap
  350.                     "/usr/include/X11/bitmaps/xlogo16"
  351.                     "white" "green")
  352.          ))
  353. (send pb_w :set_callback :XMN_ACTIVATE_CALLBACK '(callback_widget)
  354.       '(
  355.     (send callback_widget :set_values 
  356.           :XMN_LABEL_TYPE :STRING
  357.           :XMN_LABEL_STRING "WAITING-1")
  358.     (send callback_widget :update_display)
  359.     (system "sleep 1")
  360.     (send callback_widget :set_values 
  361.           :XMN_LABEL_TYPE :STRING
  362.           :XMN_LABEL_STRING "WAITING-2")
  363.     (send callback_widget :update_display)
  364.     (system "sleep 1")
  365.     (send callback_widget :set_values 
  366.           :XMN_LABEL_TYPE :STRING
  367.           :XMN_LABEL_STRING "WAITING-3")
  368.     (send callback_widget :update_display)
  369.     (system "sleep 1")
  370.     (send callback_widget :set_values 
  371.           :XMN_LABEL_TYPE :STRING
  372.           :XMN_LABEL_STRING "WAITING-4")
  373.     (send callback_widget :update_display)
  374.     (system "sleep 1")
  375.     (send callback_widget :set_values 
  376.           :XMN_LABEL_TYPE :STRING
  377.           :XMN_LABEL_STRING "WAITING-5")
  378.     (send callback_widget :update_display)
  379.     (system "sleep 1")
  380.     (send callback_widget :set_values 
  381.           :XMN_LABEL_TYPE :STRING
  382.           :XMN_LABEL_STRING "WAITING-6")
  383.     (send callback_widget :update_display)
  384.     (system "sleep 1")
  385.     (send callback_widget :set_values 
  386.           :XMN_LABEL_TYPE :STRING
  387.           :XMN_LABEL_STRING "WAITING-7")
  388.     (send callback_widget :update_display)
  389.     (system "sleep 1")
  390.     (send callback_widget :set_values
  391.           :XMN_LABEL_TYPE :PIXMAP
  392.           :XMN_LABEL_PIXMAP (xm_get_pixmap
  393.                  "/usr/include/X11/bitmaps/xlogo16"
  394.                  "white" "DarkSlateGrey"))
  395.     ))
  396.