/usr/share/doc/xviewg/examples/icons/icon_demo.c is in xview-examples 3.2p1.4-28.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /*
* icon_demo.c -- demonstrate how an icon is used. Create a server
* image and create an icon object with the image as the ICON_IMAGE.
* Use the icon as the frame's icon.
*/
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/svrimage.h>
#include <xview/icon.h>
unsigned short open_bits[] = {
#include "open.icon"
};
unsigned short closed_bits[] = {
#include "closed.icon"
};
main(argc, argv)
int argc;
char *argv[];
{
Frame frame;
Panel panel;
Server_image open_image, closed_image;
Icon icon;
void close_frame();
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create(XV_NULL, FRAME, NULL);
panel = (Panel)xv_create(frame, PANEL, NULL);
open_image = (Server_image)xv_create(NULL, SERVER_IMAGE,
XV_WIDTH, 64,
XV_HEIGHT, 64,
SERVER_IMAGE_BITS, open_bits,
NULL);
closed_image = (Server_image)xv_create(NULL, SERVER_IMAGE,
XV_WIDTH, 64,
XV_HEIGHT, 64,
SERVER_IMAGE_BITS, closed_bits,
NULL);
(void) xv_create(panel, PANEL_MESSAGE,
PANEL_LABEL_IMAGE, open_image,
PANEL_NOTIFY_PROC, close_frame,
NULL);
icon = (Icon)xv_create(frame, ICON,
ICON_IMAGE, closed_image,
XV_X, 100,
XV_Y, 100,
NULL);
xv_set(frame, FRAME_ICON, icon, NULL);
window_fit(panel);
window_fit(frame);
xv_main_loop(frame);
}
void
close_frame(item, event)
Panel_item item;
Event *event;
{
Frame frame = (Frame)xv_get(xv_get(item,
PANEL_PARENT_PANEL), XV_OWNER);
xv_set(frame, FRAME_CLOSED, TRUE, NULL);
}
|