File: theme.hh

package info (click to toggle)
sapphire 0.15.8-9.1
  • links: PTS
  • area: main
  • in suites: bullseye, sid, stretch
  • size: 448 kB
  • ctags: 850
  • sloc: cpp: 6,490; makefile: 102; sh: 77
file content (214 lines) | stat: -rw-r--r-- 9,273 bytes parent folder | download | duplicates (6)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/*
 * Copyright (C) 1999,2000,2001 Frank Hale
 * frankhale@yahoo.com
 * http://sapphire.sourceforge.net/
 *
 * Updated: 3 Nov 2001
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */


#ifndef _THEME_HH_
#define _THEME_HH_

#define TOOLBAR_TOP			(1<<1)
#define TOOLBAR_VISIBLE			(1<<2)

#define ROOT_ON				(1<<1)
#define ROOT_OFF			(1<<2)

class Theme
{
private:
	XrmDatabase resource_db;
	
	char* currentTheme;
	
	char* font;
	char* menufont;

	XFontStruct *xfont;
	
	// Each array has 2 elements 
	// 
	// 	0 = color_from used for gradients
	//	1 = color_to used for gradients
	//
	// If the image is supposed to be solid then the first color_from is used.
	//
	BColor client[2];
	BColor buttons[2];
	BColor clock[2];
	BColor menu[2];
	BColor menu_title[2];
	BColor menu_select[2];
	BColor toolbar[2];
	BColor root[2];
	BColor client_focus[2];
	BColor resize[2];
	BColor right_sidebar[2];
	BColor font_color[2];
	BColor menufont_color[2];
	
	// Bit masks for the different styles for window decorations
	unsigned long titlebar_style;
	unsigned long button_style;
	unsigned long toolbar_style;
	unsigned long toolbar_extra_style;
	unsigned long clock_style;
	unsigned long menu_style;
	unsigned long menu_title_style;
	unsigned long menu_select_style;
	unsigned long resize_style;
	unsigned long right_sidebar_style;
	unsigned long root_style;
	unsigned long root_extra_style;
	unsigned long font_style;

public:
	Theme(); 	// This creates the default theme
	~Theme();	// This has no purpose since we don't dynamically allocate any memory

	char* getFont() const { return font; }
	char* getMenuFont() const { return menufont; }

	void parseTheme(char *themeFile);
	char* getCurrentTheme() const { return currentTheme; }
	unsigned long readDatabaseTexture(char *rname, char *rclass);

	void setFontStyle(unsigned long style) 	{ font_style=style; }
	unsigned long getFontStyle() const 	{ return font_style; }

	void setRootExtraStyle(unsigned long style) 	{ root_extra_style=style; }
	unsigned long getRootExtraStyle() const 	{ return root_extra_style; }

	void setRootStyle(unsigned long style) 		{ root_style=style; }
	unsigned long getRootStyle() const 		{ return root_style; }

	void setRightSidebarStyle(unsigned long style) 	{ right_sidebar_style=style; }
	unsigned long getRightSidebarStyle() const 		{ return right_sidebar_style; }

	void setResizeStyle(unsigned long style) 	{ resize_style=style; }
	unsigned long getResizeStyle() const 		{ return resize_style; }

	void setTitlebarStyle(unsigned long style) 	{ titlebar_style=style; }
	unsigned long getTitlebarStyle() const 		{ return titlebar_style; }

	void setButtonStyle(unsigned long style) 	{ button_style=style; }
	unsigned long getButtonStyle() const 		{ return button_style; }

	void setToolbarStyle(unsigned long style) 	{ toolbar_style=style; }
	unsigned long getToolbarStyle() const 		{ return toolbar_style; }

	void setToolbarExtraStyle(unsigned long style) 	{ toolbar_extra_style=style; }
	unsigned long getToolbarExtraStyle() const 	{ return toolbar_extra_style; }
	void setToolbarVisible() 			{ toolbar_extra_style|=TOOLBAR_VISIBLE; }
	void setToolbarTop() 				{ toolbar_extra_style|=TOOLBAR_TOP; }

	void setClockStyle(unsigned long style) 	{ clock_style=style; }
	unsigned long getClockStyle() const 		{ return clock_style; }

	void setMenuStyle(unsigned long style) 		{ menu_style=style; }
	unsigned long getMenuStyle() const 		{ return menu_style; }

	void setMenuTitleStyle(unsigned long style) 	{ menu_title_style=style; }
	unsigned long getMenuTitleStyle() const 	{ return menu_title_style; }

	void setMenuSelectStyle(unsigned long style) 	{ menu_select_style=style; }
	unsigned long getMenuSelectStyle() const 	{ return menu_select_style; }

	void setMenuFontColor(BColor c) 		{ menufont_color[0]=c; 		}
	void setMenuFontColorFrom(BColor c) 		{ menufont_color[0]=c; 		}
	void setMenuFontColorTo(BColor c)		{ menufont_color[1]=c; 		}
	void setFontColor(BColor c) 			{ font_color[0]=c; 		}
	void setFontColorFrom(BColor c) 		{ font_color[0]=c; 		}
	void setFontColorTo(BColor c)			{ font_color[1]=c; 		}
	void setClockColor(BColor c) 			{ clock[0]=c; 		}
	void setClockColorFrom(BColor c) 		{ clock[0]=c; 		}
	void setClockColorTo(BColor c)			{ clock[1]=c; 		}
	void setRightSidebarColor(BColor c) 		{ right_sidebar[0]=c; 	}
	void setRightSidebarColorFrom(BColor c) 	{ right_sidebar[0]=c; 	}
	void setRightSidebarColorTo(BColor c)		{ right_sidebar[1]=c; 	}
	void setResizeColor(BColor c) 			{ resize[0]=c; 		}
	void setResizeColorFrom(BColor c) 		{ resize[0]=c; 		}
	void setResizeColorTo(BColor c)			{ resize[1]=c; 		}
	void setClientColor(BColor c) 			{ client[0]=c; 		}
	void setClientColorFrom(BColor c) 		{ client[0]=c; 		}
	void setClientColorTo(BColor c)			{ client[1]=c; 		}
	void setClientFocusColor(BColor c)		{ client_focus[0]=c; 	}
	void setClientFocusColorFrom(BColor c) 		{ client_focus[0]=c; 	}
	void setClientFocusColorTo(BColor c) 		{ client_focus[1]=c; 	}
	void setButtonColor(BColor c) 			{ buttons[0] = c; 	}
	void setButtonColorFrom(BColor c) 		{ buttons[0] = c; 	}
	void setButtonColorTo(BColor c) 		{ buttons[1] = c; 	}
	void setMenuTitleColor(BColor c) 		{ menu_title[0]=c; 	}
	void setMenuTitleColorFrom(BColor c) 		{ menu_title[0]=c; 	}
	void setMenuTitleColorTo(BColor c) 		{ menu_title[1]=c; 	}
	void setMenuColor(BColor c) 			{ menu[0]=c; 		}
	void setMenuColorFrom(BColor c) 		{ menu[0]=c; 		}
	void setMenuColorTo(BColor c) 			{ menu[1]=c; 		}
	void setMenuSelectColor(BColor c) 		{ menu_select[0]=c; 	}
	void setMenuSelectColorFrom(BColor c) 		{ menu_select[0]=c; 	}
	void setMenuSelectColorTo(BColor c) 		{ menu_select[1]=c; 	}
	void setToolbarColor(BColor c) 			{ toolbar[0]=c; 	}
	void setToolbarColorFrom(BColor c) 		{ toolbar[0]=c; 	}
	void setToolbarColorTo(BColor c) 		{ toolbar[1]=c; 	}
	void setRootColor(BColor c) 			{ root[0] = c; 		}		
	void setRootColorFrom(BColor c) 		{ root[0] = c; 		}	
	void setRootColorTo(BColor c) 			{ root[1] = c; 		}	

	BColor getMenuFontColor() 		const { return menufont_color[0];}
	BColor getMenuFontColorFrom() 		const { return menufont_color[0];}
	BColor getMenuFontColorTo() 		const { return menufont_color[1];}
	BColor getFontColor() 			const { return font_color[0]; 	 }
	BColor getFontColorFrom() 		const { return font_color[0]; 	 }
	BColor getFontColorTo() 		const { return font_color[1]; 	 }
	BColor getClockColor() 			const { return clock[0]; 	 }
	BColor getClockColorFrom() 		const { return clock[0]; 	 }
	BColor getClockColorTo() 		const { return clock[1]; 	 }
	BColor getRightSidebarColor() 		const { return right_sidebar[0]; }
	BColor getRightSidebarColorFrom() 	const { return right_sidebar[0]; }
	BColor getRightSidebarColorTo() 	const { return right_sidebar[1]; }
	BColor getResizeColor() 		const { return resize[0];	 }
	BColor getResizeColorFrom() 		const { return resize[0]; 	 }
	BColor getResizeColorTo() 		const { return resize[1]; 	 }
	BColor getClientColorFrom() 		const { return client[0]; 	 }
	BColor getClientColorTo() 		const { return client[1]; 	 }
	BColor getClientColor() 		const { return client[0]; 	 }
	BColor getClientFocusColorFrom()	const { return client_focus[0];  }
	BColor getClientFocusColorTo() 		const { return client_focus[1];  }	
	BColor getClientFocusColor() 		const { return client_focus[0];  }
	BColor getButtonColorFrom() 		const { return buttons[0]; 	 }
	BColor getButtonColorTo() 		const { return buttons[1]; 	 }
	BColor getButtonColor() 		const { return buttons[0]; 	 }
	BColor getMenuColorFrom() 		const { return menu[0]; 	 } 
	BColor getMenuColorTo() 		const { return menu[1]; 	 }
	BColor getMenuColor() 			const { return menu[0]; 	 } 
	BColor getMenuTitleColorFrom() 		const { return menu_title[0]; 	 } 
	BColor getMenuTitleColorTo() 		const { return menu_title[1]; 	 }
	BColor getMenuTitleColor() 		const { return menu_title[0]; 	 } 
	BColor getMenuSelectColorFrom() 	const { return menu_select[0]; 	 }
	BColor getMenuSelectColorTo() 		const { return menu_select[1]; 	 }
	BColor getMenuSelectColor() 		const { return menu_select[0]; 	 }
	BColor getToolbarColorFrom() 		const { return toolbar[0]; 	 }
	BColor getToolbarColorTo() 		const { return toolbar[1]; 	 }
	BColor getToolbarColor() 		const { return toolbar[0]; 	 }
	BColor getRootColorFrom() 		const { return root[0]; 	 }
	BColor getRootColorTo() 		const { return root[1]; 	 }
	BColor getRootColor() 			const { return root[0]; 	 }
};

#endif