1 /*
2  * Icon releated definitions
3  *
4  *
5  * Copyright 1989 Massachusetts Institute of Technology
6  *
7  * $XConsortium: icons.h,v 1.4 89/07/18 17:16:24 jim Exp $
8  *
9  * 10-Apr-89 Tom LaStrange        Initial Version.
10  *
11  * Copyright 1992 Claude Lecommandeur.
12  */
13 
14 #ifndef _CTWM_ICONS_H
15 #define _CTWM_ICONS_H
16 
17 /* Where did the Image for the Icon come from? */
18 typedef enum {
19 	match_none,
20 	match_list,                 /* shared Image: iconslist and Scr->ImageCache */
21 	match_icon_pixmap_hint,     /* Pixmap copied from IconPixmapHint */
22 	match_net_wm_icon,          /* Pixmap created from NET_WM_ICON */
23 	match_unknown_default,      /* shared Image: Scr->UnknownImage */
24 } Matchtype;
25 
26 struct Icon {
27 	Matchtype   match;
28 	Window      w;              /* the icon window */
29 	OtpWinList *otp;            /* OnTopPriority info for the icon */
30 	Window      bm_w;           /* the icon bitmap window */
31 	Image       *image;         /* image icon structure */
32 	int         x;              /* icon text x coordinate */
33 	int         y;              /* icon text y coordiante */
34 	int         w_x;            /* x coor of the icon window !!untested!! */
35 	int         w_y;            /* y coor of the icon window !!untested!! */
36 	int         w_width;        /* width of the icon window */
37 	int         w_height;       /* height of the icon window */
38 	int         width;          /* width of the icon bitmap */
39 	int         height;         /* height of the icon bitmap */
40 	Pixel       border;         /* border color */
41 	ColorPair   iconc;
42 	int         border_width;
43 	struct IconRegion   *ir;
44 	bool        has_title, title_shrunk;
45 	bool        w_not_ours;     /* Icon.w comes from IconWindowHint */
46 };
47 
48 struct IconRegion {
49 	struct IconRegion   *next;
50 	int                 x, y, w, h;
51 	RegGravity          grav1, grav2;
52 	int                 stepx, stepy;       // allocation granularity
53 	TitleJust           TitleJustification;
54 	IRJust              Justification;
55 	IRAlignement        Alignement;
56 	name_list           *clientlist;
57 	struct IconEntry    *entries;
58 };
59 
60 struct IconEntry {
61 	struct IconEntry    *next;
62 	int                 x, y, w, h;
63 	TwmWindow           *twm_win;
64 	bool                used;
65 };
66 
67 
68 /* Placement and IconsRegion handling */
69 name_list **AddIconRegion(const char *geom, RegGravity grav1, RegGravity grav2,
70                           int stepx, int stepy, const char *ijust,
71                           const char *just, const char *align);
72 
73 /* Icon [window] creation/destruction */
74 void CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y);
75 void DeleteIconsList(TwmWindow *tmp_win);
76 void DeleteIcon(Icon *icon);
77 void ReleaseIconImage(Icon *icon);
78 
79 /* Handling for bringing them up or down */
80 void IconUp(TwmWindow *tmp_win);
81 void IconDown(TwmWindow *tmp_win);
82 
83 /* Drawing */
84 void PaintIcon(TwmWindow *tmp_win);
85 void ShrinkIconTitle(TwmWindow *tmp_win);
86 void ExpandIconTitle(TwmWindow *tmp_win);
87 int GetIconOffset(Icon *icon);
88 void RedoIcon(TwmWindow *win);
89 void RedoIconName(TwmWindow *win);
90 
91 #endif /* _CTWM_ICONS_H */
92