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

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!pipex!warwick!dcs.warwick.ac.uk!cmchan
  3. From: cmchan@dcs.warwick.ac.uk (C M Chan)
  4. Subject: How to create a Pop-up window in XVIEW
  5. Message-ID: <1993Jan23.224932.9079@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: Sat, 23 Jan 1993 22:49:32 GMT
  11. Lines: 73
  12.  
  13.  
  14. Hi,
  15.  
  16. I am a novice user of XVIEW Toolkit. Can somebody out there please point me
  17. out explicitly the way to create a Pop-up window in which an application can
  18. display images and handles input 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. By the way, how can I install a new colormap for the Pop-up window?
  24.  
  25. Any pointer will be greatly appreciated.   Thanks in advance.
  26.  
  27.  
  28. ---------------------------------------------------------------
  29.  
  30.  
  31. #include <X11/Xlib.h>
  32. #include <xview/xview.h>
  33. #include <xview/canvas.h>
  34. #include <xview/xv_xrect.h>
  35. #include <xview/panel.h>
  36.  
  37.  
  38. Frame frame;     /* top level application base-frame */
  39. Frame subframe;  /* subframe (FRAME_CMD) is a child of frame */
  40.  
  41. void canvas_repaint_proc(Canvas, Xv_Window, Display*, Window, Xv_xrectlist*);
  42.  
  43. main(int argc, char **argv)
  44. {
  45.     xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
  46.  
  47.     /* Create base frame */
  48.     frame = (Frame)xv_create(NULL, FRAME,
  49.         FRAME_LABEL, argv[0],
  50.         NULL);
  51.  
  52.     /* Create the command frame -- not displayed until XV_SHOW is set */
  53.     subframe = (Frame)xv_create(frame, FRAME_CMD,
  54.         FRAME_LABEL,         "Popup",
  55.         NULL);
  56.  
  57.     (void) xv_create(subframe, CANVAS,
  58.         CANVAS_REPAINT_PROC,    canvas_repaint_proc,
  59.         CANVAS_X_PAINT_WINDOW,  TRUE,
  60.         NULL);
  61.  
  62.     xv_set(subframe, XV_SHOW, TRUE, NULL);
  63.  
  64.     xv_main_loop(frame);
  65. }
  66.  
  67. void
  68. canvas_repaint_proc(Canvas canvas, Xv_Window paint_window,
  69.                     Display *dpy,  Window xwin, Xv_xrectlist *xrects)
  70. {
  71.     GC gc;
  72.     int width, height;
  73.  
  74.     gc = DefaultGC(dpy, DefaultScreen(dpy));
  75.     width = (int)xv_get(paint_window, XV_WIDTH);
  76.     height = (int)xv_get(paint_window, XV_HEIGHT);
  77.  
  78.     XDrawLine(dpy, xwin, gc, 0, 0, width, height);
  79. }
  80.  
  81.  
  82. -- 
  83. C M CHAN         cmchan@dcs.warwick.ac.uk
  84.  
  85.  
  86.