home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / openloo / 5119 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.2 KB  |  86 lines

  1. Newsgroups: comp.windows.open-look
  2. Path: sparky!uunet!pipex!warwick!dcs.warwick.ac.uk!cmchan
  3. From: cmchan@dcs.warwick.ac.uk (C M Chan)
  4. Subject: Pop-up window for displaying images
  5. Message-ID: <1993Jan21.223753.23725@dcs.warwick.ac.uk>
  6. Keywords: Pop-up frame, canvas
  7. Sender: news@dcs.warwick.ac.uk (Network News)
  8. Nntp-Posting-Host: behind
  9. Organization: Department of Computer Science, Warwick University, England
  10. Date: Thu, 21 Jan 1993 22:37:53 GMT
  11. Lines: 73
  12.  
  13.  
  14. Hi,
  15.  
  16. Can somebody out there please point me out explicitly the way to create a
  17. Pop-up window in which an application can display images and handles input
  18. with the XVIEW toolkit?
  19.  
  20. I have developed a simple program to create a Pop-up frame and its canvas
  21. child in which a line will be drawn. However, I can't get what I want.
  22.  
  23.  
  24. Any pointer will be greatly appreciated.   Thanks in advance.
  25.  
  26. ---------------------------------------------------------------
  27.  
  28.  
  29. #include <X11/Xlib.h>
  30. #include <xview/xview.h>
  31. #include <xview/canvas.h>
  32. #include <xview/xv_xrect.h>
  33. #include <xview/panel.h>
  34.  
  35.  
  36. Frame frame;     /* top level application base-frame */
  37. Frame subframe;  /* subframe (FRAME_CMD) is a child of frame */
  38.  
  39. void canvas_repaint_proc(Canvas, Xv_Window, Display*, Window, Xv_xrectlist*);
  40.  
  41. main(int argc, char **argv)
  42. {
  43.     xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
  44.  
  45.     /* Create base frame */
  46.     frame = (Frame)xv_create(NULL, FRAME,
  47.         FRAME_LABEL, argv[0],
  48.         NULL);
  49.  
  50.     /* Create the command frame -- not displayed until XV_SHOW is set */
  51.     subframe = (Frame)xv_create(frame, FRAME_CMD,
  52.         FRAME_LABEL,         "Popup",
  53.         NULL);
  54.  
  55.     (void) xv_create(subframe, CANVAS,
  56.         CANVAS_REPAINT_PROC,    canvas_repaint_proc,
  57.         CANVAS_X_PAINT_WINDOW,  TRUE,
  58.         NULL);
  59.  
  60.     xv_set(subframe, XV_SHOW, TRUE, NULL);
  61.  
  62.     xv_main_loop(frame);
  63. }
  64.  
  65. void
  66. canvas_repaint_proc(Canvas canvas, Xv_Window paint_window,
  67.                     Display *dpy,  Window xwin, Xv_xrectlist *xrects)
  68. {
  69.     GC gc;
  70.     int width, height;
  71.  
  72.     gc = DefaultGC(dpy, DefaultScreen(dpy));
  73.     width = (int)xv_get(paint_window, XV_WIDTH);
  74.     height = (int)xv_get(paint_window, XV_HEIGHT);
  75.  
  76.     XDrawLine(dpy, xwin, gc, 0, 0, width, height);
  77. }
  78.  
  79.  
  80.  
  81.  
  82. -- 
  83. C M CHAN         cmchan@dcs.warwick.ac.uk
  84.  
  85.  
  86.