vfs: check userland buffers before reading them.
[haiku.git] / docs / develop / servers / app_server / SystemPalette.htm
blob2211b5df0addb677dfc54dec7db337491a42ccfd
1 <HTML>
2 <HEAD>
3 <TITLE>SystemPalette.htm</TITLE>
4 <style type="text/css">
5 <!--
6 .Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
7 .OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
8 .OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
9 .Text-Background {background-color: rgb(255,255,255)}
10 .GR-Default {}
11 .Body {margin: 0px}
12 .Footer {margin: 0px}
13 .Header {margin: 0px}
14 .WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}
15 -->
16 </style>
17 </HEAD>
18 <BODY BGCOLOR="#ffffff">
19 <DIV class="sheet" id="Sheet 1">
20 <P class="Body" style="margin: 0px"><span class="OBOS-Title">SystemPalette class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
21 <P class="Body" style="margin: 0px"><BR>
22 </P>
23 <P class="Body" style="margin: 0px">This object does all the handling for system attribute colors and system palette management.</P>
24 <P class="Body" style="margin: 0px"><BR>
25 <BR>
26 <HR>
27 </P>
28 <P class="Body" style="margin: 0px"><BR>
29 Member Functions</P>
30 <P class="Body" style="margin: 0px"><BR>
31 </P>
32 <TABLE WIDTH=617 HEIGHT=196 BORDER=1 CELLPADDING=1 CELLSPACING=2>
33 <TR>
34 <TD WIDTH=203 HEIGHT=17>
35 <P class="Body" style="margin: 0px">SystemPalette(void)</P>
36 </TD>
37 <TD WIDTH=260 HEIGHT=17>
38 <P class="Body" style="margin: 0px">~SystemPalette(void)</P>
39 </TD>
40 </TR>
41 <TR>
42 <TD WIDTH=203 HEIGHT=32>
43 <P class="Body" style="margin: 0px">void SetPalette(uint8 index, RGBColor col)</P>
44 </TD>
45 <TD WIDTH=260 HEIGHT=32>
46 <P class="Body" style="margin: 0px">void SetPalette(uint8 index, rgb_color col)</P>
47 </TD>
48 </TR>
49 <TR>
50 <TD WIDTH=203 HEIGHT=32>
51 <P class="Body" style="margin: 0px">RGBColor GetPalette(uint8 index)</P>
52 </TD>
53 <TD WIDTH=260 HEIGHT=32>
54 <P class="Body" style="margin: 0px">void SetGUIColor(color_which which, RGBColor col)</P>
55 </TD>
56 </TR>
57 <TR>
58 <TD WIDTH=203 HEIGHT=32>
59 <P class="Body" style="margin: 0px">RGBColor GetGUIColor(color_which which)</P>
60 </TD>
61 <TD WIDTH=260 HEIGHT=32>
62 <P class="Body" style="margin: 0px">color_set GetGUIColors(void)</P>
63 </TD>
64 </TR>
65 <TR>
66 <TD WIDTH=203 HEIGHT=17>
67 <P class="Body" style="margin: 0px">void SetGUIColors(color_set cset)</P>
68 </TD>
69 <TD WIDTH=260 HEIGHT=17>
70 <P class="Body" style="margin: 0px">void _GenerateSystemPalette(rgb_color *palette)</P>
71 </TD>
72 </TR>
73 <TR>
74 <TD WIDTH=203 HEIGHT=17>
75 <P class="Body" style="margin: 0px">void _SetDefaultGUIColors(void)</P>
76 </TD>
77 <TD WIDTH=260 HEIGHT=17>
78 &nbsp;
79 </TD>
80 </TR>
81 </TABLE>
82 <P class="Body" style="margin: 0px"><BR>
83 <BR>
84 _ Denotes a protected function</P>
85 <P class="Body" style="margin: 0px"><BR>
86 Structures</P>
87 <P class="Body" style="margin: 0px"><BR>
88 color_set {</P>
89 <P class="Body" style="margin: 0px"> rgb_color panel_background</P>
90 <P class="Body" style="margin: 0px"> rgb_color panel_text</P>
91 <P class="Body" style="margin: 0px"> rgb_color document_background</P>
92 <P class="Body" style="margin: 0px"> rgb_color document_text</P>
93 <P class="Body" style="margin: 0px"> rgb_color control_background</P>
94 <P class="Body" style="margin: 0px"> rgb_color control_text</P>
95 <P class="Body" style="margin: 0px"> rgb_color control_border</P>
96 <P class="Body" style="margin: 0px"> rgb_color control_highlight</P>
97 <P class="Body" style="margin: 0px"> rgb_color tooltip_background</P>
98 <P class="Body" style="margin: 0px"> rgb_color tooltip_text</P>
99 <P class="Body" style="margin: 0px"> rgb_color menu_background</P>
100 <P class="Body" style="margin: 0px"> rgb_color menu_selected_background</P>
101 <P class="Body" style="margin: 0px"> rgb_color menu_text</P>
102 <P class="Body" style="margin: 0px"> rgb_color menu_selected_text</P>
103 <P class="Body" style="margin: 0px"> rgb_color menu_separator</P>
104 <P class="Body" style="margin: 0px"> rgb_color menu_triggers</P>
105 <P class="Body" style="margin: 0px">}</P>
106 <P class="Body" style="margin: 0px"><BR>
107 <HR>
108 </P>
109 <P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">SystemPalette(void)</span></P>
110 <P class="Body" style="margin: 0px"><BR>
111 1) Allocate the rgb_color[256] palette on the heap and call _GenerateSystemPalette()</P>
112 <P class="Body" style="margin: 0px">2) Initialize attribute variables to the defaults</P>
113 <P class="Body" style="margin: 0px"><BR>
114 <BR>
115 <span class="OBOS-Function-Def">~SystemPalette(void)</span></P>
116 <P class="Body" style="margin: 0px"><BR>
117 1) Free the palette array</P>
118 <P class="Body" style="margin: 0px"><BR>
119 <BR>
120 <span class="OBOS-Function-Def">void SetPalette(uint8 index, RGBColor col)</span></P>
121 <P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetPalette(uint8 index, rgb_color col)</span></P>
122 <P class="Body" style="margin: 0px"><BR>
123 Sets the said index to the passed color value.</P>
124 <P class="Body" style="margin: 0px"><BR>
125 <BR>
126 <span class="OBOS-Function-Def">RGBColor GetPalette(uint8 index)</span></P>
127 <P class="Body" style="margin: 0px"><BR>
128 Returns the color at said index in the palette.</P>
129 <P class="Body" style="margin: 0px"><BR>
130 <BR>
131 <span class="OBOS-Function-Def">void SetGUIColor(color_which which, RGBColor col)</span></P>
132 <P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">RGBColor GetGUIColor(color_which which)</span></P>
133 <P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">color_set GetGUIColors(void)</span></P>
134 <P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetGUIColors(color_set cset)</span></P>
135 <P class="Body" style="margin: 0px"><BR>
136 These tweak or return the system attribute colors, one at a time or all at once.</P>
137 <P class="Body" style="margin: 0px"><BR>
138 <BR>
139 <span class="OBOS-Function-Def">protected: void _GenerateSystemPalette(rgb_color *palette)</span></P>
140 <P class="Body" style="margin: 0px"><BR>
141 Sets the passed palette to the BeOS R5 system colors, which follows.</P>
142 <P class="Body" style="margin: 0px"><span class="Default">Grays:</span></P>
143 <P class="Body" style="margin: 0px"><span class="Default">0,0,0 -&gt; 248,248,248 by increments of 8</span></P>
144 <P class="Body" style="margin: 0px"><span class="Default">Blues:</span></P>
145 <P class="Body" style="margin: 0px"><span class="Default">0,0,255</span></P>
146 <P class="Body" style="margin: 0px"><span class="Default">0,0,229</span></P>
147 <P class="Body" style="margin: 0px"><span class="Default">0,0,204</span></P>
148 <P class="Body" style="margin: 0px"><span class="Default">0,0,179</span></P>
149 <P class="Body" style="margin: 0px"><span class="Default">0,0,154</span></P>
150 <P class="Body" style="margin: 0px"><span class="Default">0,0,129</span></P>
151 <P class="Body" style="margin: 0px"><span class="Default">0,0,105</span></P>
152 <P class="Body" style="margin: 0px"><span class="Default">0,0,80</span></P>
153 <P class="Body" style="margin: 0px"><span class="Default">0,0,55</span></P>
154 <P class="Body" style="margin: 0px"><span class="Default">0,0,30</span></P>
155 <P class="Body" style="margin: 0px"><span class="Default">Reds: as per blues, but red values are 1 less</span></P>
156 <P class="Body" style="margin: 0px"><span class="Default">Greens: as per blues, but green values are 1 less</span></P>
157 <P class="Body" style="margin: 0px"><span class="Default">0,152,51</span></P>
158 <P class="Body" style="margin: 0px"><span class="Default">255,255,255</span></P>
159 <P class="Body" style="margin: 0px"><span class="Default"><BR>
160 The following sets use [255, 203, 152, 102, 51, 0] for the blue values, keeping the other colors the same:</span></P>
161 <P class="Body" style="margin: 0px"><span class="Default"><BR>
162 203,255, [value]</span></P>
163 <P class="Body" style="margin: 0px"><span class="Default">152,255, [value]</span></P>
164 <P class="Body" style="margin: 0px"><span class="Default">102,255, [value]</span></P>
165 <P class="Body" style="margin: 0px"><span class="Default">51,255, [value]</span></P>
166 <P class="Body" style="margin: 0px"><span class="Default">255,152, [value]</span></P>
167 <P class="Body" style="margin: 0px"><span class="Default"><BR>
168 0,102,255</span></P>
169 <P class="Body" style="margin: 0px"><span class="Default">0,102,203</span></P>
170 <P class="Body" style="margin: 0px"><span class="Default"><BR>
171 203,203, [value]</span></P>
172 <P class="Body" style="margin: 0px"><span class="Default">152,255, [value]</span></P>
173 <P class="Body" style="margin: 0px"><span class="Default">102,255, [value]</span></P>
174 <P class="Body" style="margin: 0px"><span class="Default">51,255, [value]</span></P>
175 <P class="Body" style="margin: 0px"><span class="Default">255,102, [value]</span></P>
176 <P class="Body" style="margin: 0px"><span class="Default"><BR>
177 0,102,152</span></P>
178 <P class="Body" style="margin: 0px"><span class="Default">0,102,102</span></P>
179 <P class="Body" style="margin: 0px"><span class="Default"><BR>
180 203,152, [value]</span></P>
181 <P class="Body" style="margin: 0px"><span class="Default">152,152, [value]</span></P>
182 <P class="Body" style="margin: 0px"><span class="Default">102,152, [value]</span></P>
183 <P class="Body" style="margin: 0px"><span class="Default">51,152, [value]</span></P>
184 <P class="Body" style="margin: 0px"><span class="Default"><BR>
185 230,134,0</span></P>
186 <P class="Body" style="margin: 0px"><span class="Default"><BR>
187 255,51, [value excepting 255]</span></P>
188 <P class="Body" style="margin: 0px"><span class="Default"><BR>
189 0,102,51</span></P>
190 <P class="Body" style="margin: 0px"><span class="Default">0,102,0</span></P>
191 <P class="Body" style="margin: 0px"><span class="Default"><BR>
192 203,102, [value]</span></P>
193 <P class="Body" style="margin: 0px"><span class="Default">152,102, [value]</span></P>
194 <P class="Body" style="margin: 0px"><span class="Default">102,102, [value]</span></P>
195 <P class="Body" style="margin: 0px"><span class="Default">51,102, [value]</span></P>
196 <P class="Body" style="margin: 0px"><span class="Default">255,0, [value excepting 0]</span></P>
197 <P class="Body" style="margin: 0px"><span class="Default"><BR>
198 255,175,19</span></P>
199 <P class="Body" style="margin: 0px"><span class="Default">0,51,255</span></P>
200 <P class="Body" style="margin: 0px"><span class="Default">0,51,203</span></P>
201 <P class="Body" style="margin: 0px"><span class="Default"><BR>
202 203,51, [value]</span></P>
203 <P class="Body" style="margin: 0px"><span class="Default">152,51, [value]</span></P>
204 <P class="Body" style="margin: 0px"><span class="Default">102,51, [value]</span></P>
205 <P class="Body" style="margin: 0px"><span class="Default">51,51, [value]</span></P>
206 <P class="Body" style="margin: 0px"><span class="Default"><BR>
207 255,203,102 -&gt; 255,203,255, stepping in the [value] increments</span></P>
208 <P class="Body" style="margin: 0px"><span class="Default"><BR>
209 0,51, [value, starting at 152]</span></P>
210 <P class="Body" style="margin: 0px"><span class="Default">203,0, [value, excepting 0]</span></P>
211 <P class="Body" style="margin: 0px"><span class="Default"><BR>
212 255,227,70</span></P>
213 <P class="Body" style="margin: 0px"><span class="Default"><BR>
214 152,0, [value]</span></P>
215 <P class="Body" style="margin: 0px"><span class="Default">102,0, [value]</span></P>
216 <P class="Body" style="margin: 0px"><span class="Default">51,0, [value]</span></P>
217 <P class="Body" style="margin: 0px"><span class="Default"><BR>
218 255,203,51 </span></P>
219 <P class="Body" style="margin: 0px"><span class="Default">255,203,0</span></P>
220 <P class="Body" style="margin: 0px"><span class="Default"><BR>
221 255,255, [values in reverse]</span></P>
222 <P class="Body" style="margin: 0px"><BR>
223 <BR>
224 <span class="OBOS-Function-Def">protected: void _SetDefaultGUIColors(void)</span></P>
225 <P class="Body" style="margin: 0px"><BR>
226 Sets the internal color_set to the defaults, which is the following:</P>
227 <P class="Body" style="margin: 0px"><BR>
228 panel_background: 216,216, 216</P>
229 <P class="Body" style="margin: 0px">panel_text: 0,0,0</P>
230 <P class="Body" style="margin: 0px">document_background: 255,255,255</P>
231 <P class="Body" style="margin: 0px">document_text: 0,0,0</P>
232 <P class="Body" style="margin: 0px">control_background: 216,216,216</P>
233 <P class="Body" style="margin: 0px">control_text: 0,0,0</P>
234 <P class="Body" style="margin: 0px">control_border: 0,0,0</P>
235 <P class="Body" style="margin: 0px">control_highlight: 0,0,255</P>
236 <P class="Body" style="margin: 0px">tooltip_background: </P>
237 <P class="Body" style="margin: 0px">tooltip_text: 0,0,0</P>
238 <P class="Body" style="margin: 0px">menu_background: 216,216,216</P>
239 <P class="Body" style="margin: 0px">menu_selected_background: 160,160,160</P>
240 <P class="Body" style="margin: 0px">menu_text: 0,0,0</P>
241 <P class="Body" style="margin: 0px">menu_selected_text: 0,0,0</P>
242 <P class="Body" style="margin: 0px">menu_separator_high: 241,241,241</P>
243 <P class="Body" style="margin: 0px">menu_separator_low: 186,186,186</P>
244 <P class="Body" style="margin: 0px">menu_triggers: 0,0,0</P>
245 <DIV class="layer" id="Layer 1">
246 </DIV>
247 </DIV>
248 </BODY>
249 </HTML>