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