1/*
2 * Copyright 2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Axel D��rfler, axeld@pinc-software.de
7 */
8#ifndef SERVER_READ_ONLY_MEMORY_H
9#define SERVER_READ_ONLY_MEMORY_H
10
11
12#include <GraphicsDefs.h>
13#include <InterfaceDefs.h>
14
15
16static const int32 kNumColors = 34;
17
18struct server_read_only_memory {
19	rgb_color	colors[kNumColors];
20};
21
22
23// NOTE: these functions must be kept in sync with InterfaceDefs.h color_which!
24
25static inline int32
26color_which_to_index(color_which which)
27{
28	// NOTE: this must be kept in sync with InterfaceDefs.h color_which!
29	if (which <= B_LIST_SELECTED_ITEM_TEXT_COLOR)
30		return which - 1;
31	if (which >= B_SUCCESS_COLOR && which <= B_FAILURE_COLOR)
32		return which - B_SUCCESS_COLOR + B_LIST_SELECTED_ITEM_TEXT_COLOR;
33
34	return -1;
35}
36
37
38static inline color_which
39index_to_color_which(int32 index)
40{
41	if (index >= 0 && index < kNumColors) {
42		if ((color_which)index < B_LIST_SELECTED_ITEM_TEXT_COLOR)
43			return (color_which)(index + 1);
44		else {
45			return (color_which)(index + B_SUCCESS_COLOR
46			  - B_LIST_SELECTED_ITEM_TEXT_COLOR);
47		}
48	}
49
50	return (color_which)-1;
51}
52
53#endif	/* SERVER_READ_ONLY_MEMORY_H */
54