xref: /haiku/src/preferences/appearance/ColorWhichItem.cpp (revision 4b3b81da9e459443d75329cfd08bc9a57ad02653)
1 /*
2  * Copyright 2002-2008, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		DarkWyrm (darkwyrm@earthlink.net)
7  *		Rene Gollent (rene@gollent.com)
8  */
9 #include "ColorWhichItem.h"
10 #include <stdio.h>
11 
12 ColorWhichItem::ColorWhichItem(color_which which)
13  :	BStringItem(NULL,0,false)
14 {
15 	SetAttribute(which);
16 }
17 
18 ColorWhichItem::~ColorWhichItem(void)
19 {
20 	// Empty, but exists for just-in-case
21 }
22 
23 void
24 ColorWhichItem::SetAttribute(color_which which)
25 {
26 	switch(which) {
27 		// cases not existing in R5 which exist in OpenBeOS
28 		case B_PANEL_BACKGROUND_COLOR: {
29 			attribute=which;
30 			SetText("Panel Background");
31 			break;
32 		}
33 		case B_PANEL_TEXT_COLOR: {
34 			attribute=which;
35 			SetText("Panel Text");
36 			break;
37 		}
38 		case B_DOCUMENT_BACKGROUND_COLOR: {
39 			attribute=which;
40 			SetText("Document Background");
41 			break;
42 		}
43 		case B_DOCUMENT_TEXT_COLOR: {
44 			attribute=which;
45 			SetText("Document Text");
46 			break;
47 		}
48 		case B_CONTROL_BACKGROUND_COLOR: {
49 			attribute=which;
50 			SetText("Control Background");
51 			break;
52 		}
53 		case B_CONTROL_TEXT_COLOR: {
54 			attribute=which;
55 			SetText("Control Text");
56 			break;
57 		}
58 		case B_CONTROL_BORDER_COLOR: {
59 			attribute=which;
60 			SetText("Control Border");
61 			break;
62 		}
63 		case B_CONTROL_HIGHLIGHT_COLOR: {
64 			attribute=which;
65 			SetText("Control Highlight");
66 			break;
67 		}
68 		case B_TOOLTIP_BACKGROUND_COLOR: {
69 			attribute=which;
70 			SetText("Tooltip Background");
71 			break;
72 		}
73 		case B_TOOLTIP_TEXT_COLOR: {
74 			attribute=which;
75 			SetText("Tooltip Text");
76 			break;
77 		}
78 		case B_MENU_BACKGROUND_COLOR: {
79 			attribute=which;
80 			SetText("Menu Background");
81 			break;
82 		}
83 		case B_MENU_SELECTION_BACKGROUND_COLOR: {
84 			attribute=which;
85 			SetText("Selected Menu Item Background");
86 			break;
87 		}
88 		case B_MENU_ITEM_TEXT_COLOR: {
89 			attribute=which;
90 			SetText("Menu Item Text");
91 			break;
92 		}
93 		case B_MENU_SELECTED_ITEM_TEXT_COLOR: {
94 			attribute=which;
95 			SetText("Selected Menu Item Text");
96 			break;
97 		}
98 		case B_MENU_SELECTED_BORDER_COLOR: {
99 			attribute=which;
100 			SetText("Selected Menu Item Border");
101 			break;
102 		}
103 		case B_NAVIGATION_BASE_COLOR: {
104 			attribute=which;
105 			SetText("Navigation Base");
106 			break;
107 		}
108 		case B_NAVIGATION_PULSE_COLOR: {
109 			attribute=which;
110 			SetText("Navigation Pulse");
111 			break;
112 		}
113 		case B_SUCCESS_COLOR: {
114 			attribute=which;
115 			SetText("Success");
116 			break;
117 		}
118 		case B_FAILURE_COLOR: {
119 			attribute=which;
120 			SetText("Failure");
121 			break;
122 		}
123 		case B_SHINE_COLOR: {
124 			attribute=which;
125 			SetText("Shine");
126 			break;
127 		}
128 		case B_SHADOW_COLOR: {
129 			attribute=which;
130 			SetText("Shadow");
131 			break;
132 		}
133 		case B_WINDOW_TAB_COLOR: {
134 			attribute=which;
135 			SetText("Window Tab");
136 			break;
137 		}
138 		case B_WINDOW_TEXT_COLOR: {
139 			attribute=which;
140 			SetText("Window Text");
141 			break;
142 		}
143 		case B_WINDOW_INACTIVE_TAB_COLOR: {
144 			attribute=which;
145 			SetText("Inactive Window Tab");
146 			break;
147 		}
148 		case B_WINDOW_INACTIVE_TEXT_COLOR: {
149 			attribute=which;
150 			SetText("Inactive Window Tab Text");
151 			break;
152 		}
153 		default: {
154 			printf("unknown code '%c%c%c%c'\n",(char)((which & 0xFF000000) >>  24),
155 				(char)((which & 0x00FF0000) >>  16),
156 				(char)((which & 0x0000FF00) >>  8),
157 				(char)((which & 0x000000FF)) );
158 			break;
159 		}
160 	}
161 }
162 
163 color_which
164 ColorWhichItem::GetAttribute(void)
165 {
166 	return attribute;
167 }
168 
169