First checkin, AXE release 0.2
[AXE.git] / src / icon.h
1 /**************************************************************************
2 **  (c) Copyright 1998, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 **      FILE NAME      : icon.h
7 **      SYSTEM NAME    : AXE - Andromeda X-windows Encapsulation
8 **      VERSION NUMBER : $Revision: 1.1 $
9 **
10 **  DESCRIPTION      : Definition of icon class
11 **
12 **  EXPORTED OBJECTS : class icon
13 **  LOCAL    OBJECTS : 
14 **  MODULES  USED    :
15 ***************************************************************************
16 **  ADMINISTRATIVE INFORMATION *
17 ********************************
18 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 **      CREATION DATE   : Jul 13, 2000
20 **      MODIFICATIONS   : 
21 **************************************************************************/
22
23 /*****************************
24    $Log: icon.h,v $
25    Revision 1.1  2002-07-25 08:01:27  arjen
26    First checkin, AXE release 0.2
27
28 *****************************/
29
30 /* static const char *RCSID = "$Id: icon.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */
31
32 #ifndef AXE_ICON_H
33 #define AXE_ICON_H
34
35 #include <X11/Xlib.h>
36 #include <X11/xpm.h>
37 #include "xwindow.h"
38
39 /*
40 ///////////////////////////////////////////////////////////////////////////
41 //  NAME           : icon
42 //  BASECLASS      :
43 //  MEMBERS        : pixmap picture;
44 //  OPERATORS      :
45 //  METHODS        :
46 //
47 //  DESCRIPTION    :  An icon is a window that contains a pixmap.
48 //                    It automatically redraws on Expose events.
49 //
50 //  RELATIONS      :
51 //  SEE ALSO       :
52 //  LAST MODIFIED  : Jul 13, 2000
53 ///////////////////////////////////////////////////////////////////////////
54 */
55
56 class icon : public window
57 {
58    pixmap picture;
59
60    virtual int EV_Expose(XExposeEvent ev);
61
62 public:
63
64    icon(window &parent, int x, int y, char *data, unsigned int w, unsigned int h) :
65         window(parent, x, y, w, h)
66    {
67       //picture = XCreateBitmapFromData(stddpy, stddpy.Root(), data, w, h);
68       SelectInput(ExposureMask, 1);
69    }
70
71    icon(window &parent, int x, int y, char *pixmap_data[]) :
72                                window(parent, x, y, 4, 4, 0)
73    {
74       picture.create(pixmap_data);
75       Resize(picture.Size());
76       SelectInput(ExposureMask, 1);
77    }
78
79    icon(window &parent, int x, int y, char *filename) : window(parent, x, y, 4, 4, 0)
80    {
81       picture.read(filename);
82       Resize(picture.Size());
83       SelectInput(ExposureMask, 1);
84    }
85
86 };
87
88 #endif /* AXE_ICON_H  */