1 /* vim:tabstop=4:expandtab:shiftwidth=4
2  *
3  * Idesk -- DesktopIconConfig.h
4  *
5  * Copyright (c) 2002, Chris (nikon) (nikon@sc.rr.com)
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  *      Redistributions of source code must retain the above copyright
12  *      notice, this list of conditions and the following disclaimer.
13  *
14  *      Redistributions in binary form must reproduce the above copyright
15  *      notice, this list of conditions and the following disclaimer in the
16  *      documentation and/or other materials provided with the distribution.
17  *
18  *      Neither the name of the <ORGANIZATION> nor the names of its
19  *      contributors may be used to endorse or promote products derived from
20  *      this software without specific prior written permission.
21  *
22  * (See the included file COPYING / BSD )
23  */
24 
25 #ifndef DESKTOP_ICON_CLASS
26 #define DESKTOP_ICON_CLASS
27 
28 #include <fcntl.h>
29 #include "AbstractClasses.h"
30 #include "Database.h"
31 #include "cursors.h"    /* defines XC_watch, etc. */
32 
33 class CommonOptions
34 {
35     protected:
36         Table table;
37 
38         string fontName, fontColor;
39 
40         int fontSize;
41 
42         bool isBold;
43 
44         string shadowColor;
45         bool shadowOn;
46         int shadowX, shadowY;
47 
48         int snapShadowTrans;
49         bool snapShadow;
50 
51         int clickDelay;
52 
53         bool captionOnHover;
54 
55         string captionPlacement;
56 	string fillStyle;
57 
58 	int cursorOver;
59 
60         /* TODO
61          * High Contrast - I'm not that interested in this old option. I may
62          * look into it if someone asks. */
63 
64     public:
65 	 CommonOptions();
66         ~CommonOptions();
67         virtual void setOptions(Table);
68         virtual void setCommonDefaults();
69         virtual void setDefaultsFromParent(CommonOptions &/***/ other);
70 
getBoldness()71         virtual bool getBoldness() { return isBold; }
72 
isShadow()73         virtual bool isShadow() { return shadowOn; }
getShadowX()74         virtual int getShadowX() { return shadowX; }
getShadowY()75         virtual int getShadowY() { return shadowY; }
getShadowColor()76         virtual string getShadowColor() { return shadowColor; }
77 
getSnapShadow()78         virtual bool getSnapShadow() { return snapShadow; }
getSnapShadowTrans()79         virtual int getSnapShadowTrans() { return snapShadowTrans; }
80 
getFont()81         virtual string getFont() { return fontName; }
getFontSize()82         virtual int getFontSize() { return fontSize; }
getFontColor()83         virtual string getFontColor() { return fontColor; }
84 
getCaptionOnHover()85         virtual bool getCaptionOnHover() { return captionOnHover; }
86 
getCaptionPlacement()87         virtual string getCaptionPlacement() { return captionPlacement; }
88 
getCursorOver()89 	virtual int getCursorOver(){ return cursorOver;}
getFillStyle()90 	virtual string getFillStyle(){ return fillStyle;}
91 };
92 
93 
94 class DesktopIconConfig : public AbstractIconConfig
95 {
96     protected:
97         CommonOptions * common;
98 
99         int x, y;
100         int width, height;
101 
102     public:
103 	DesktopIconConfig(const string & fName, CommonOptions * parentData);
104         virtual ~DesktopIconConfig();
105 
106         virtual void setIconOptions(Table);
107 
108         virtual string getExtension(const string & file);
109 
getX()110         virtual int getX() { return x; }
getY()111         virtual int getY() { return y; }
getWidth()112         virtual int getWidth() { return width; }
getHeight()113         virtual int getHeight() { return height; }
isSvg()114         virtual bool isSvg() { return picExtension == "SVG"; }
isRaster()115         virtual bool isRaster() { return (picExtension == "JPEG" ||
116                                           picExtension == "GIF"  ||
117                                           picExtension == "PPM"  ||
118                                           picExtension == "PGM"  ||
119                                           picExtension == "XPM"  ||
120 	                                      picExtension == "JPG"  ||
121                                           picExtension == "TIFF" ||
122                                           picExtension == "PNG"); }
isXpm()123         virtual bool isXpm() { return picExtension == "XPM"; }
124 
125         virtual void saveIcon(int xCord, int yCord);
126 
getBoldness()127         virtual bool getBoldness() { return common->getBoldness(); }
128 
isShadow()129         virtual bool isShadow() { return common->isShadow(); }
getShadowX()130         virtual int getShadowX() { return common->getShadowX(); }
getShadowY()131         virtual int getShadowY() { return common->getShadowY(); }
getShadowColor()132         virtual string getShadowColor() { return common->getShadowColor(); }
133 
getSnapShadow()134         virtual bool getSnapShadow() { return common->getSnapShadow(); }
getSnapShadowTrans()135         virtual int getSnapShadowTrans() {return common->getSnapShadowTrans();}
136 
getFont()137         virtual string getFont() { return common->getFont(); }
getFontSize()138         virtual int getFontSize() { return common->getFontSize(); }
getFontColor()139         virtual string getFontColor() { return common->getFontColor(); }
140 
getCaptionOnHover()141         virtual bool getCaptionOnHover() { return common->getCaptionOnHover(); }
142 
getCaptionPlacement()143         virtual string getCaptionPlacement() { return common->getCaptionPlacement(); }
getFillStyle()144 	virtual string getFillStyle() { return common->getFillStyle();}
145 };
146 
147 #endif
148