2006-04-26 00:12:06 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
#ifndef SERVER_READ_ONLY_MEMORY_H
|
|
|
|
#define SERVER_READ_ONLY_MEMORY_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <GraphicsDefs.h>
|
|
|
|
#include <InterfaceDefs.h>
|
|
|
|
|
|
|
|
|
2013-04-07 01:13:36 +04:00
|
|
|
// Update this constant with the largest color constant excluding
|
|
|
|
// B_SUCCESS_COLOR and B_FAILURE_COLOR.
|
|
|
|
// If you add a constant with index greater than 100 you'll have to add
|
|
|
|
// to the second operand.
|
2013-04-16 11:44:42 +04:00
|
|
|
static const int32 kColorWhichCount = B_SCROLL_BAR_THUMB_COLOR + 3;
|
2013-04-07 01:13:36 +04:00
|
|
|
|
|
|
|
|
2006-04-26 00:12:06 +04:00
|
|
|
struct server_read_only_memory {
|
2013-04-16 11:44:42 +04:00
|
|
|
rgb_color colors[kColorWhichCount];
|
2006-04-26 00:12:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static inline int32
|
|
|
|
color_which_to_index(color_which which)
|
|
|
|
{
|
2013-04-16 11:44:42 +04:00
|
|
|
if (which <= kColorWhichCount - 3)
|
2006-04-26 00:12:06 +04:00
|
|
|
return which - 1;
|
|
|
|
if (which >= B_SUCCESS_COLOR && which <= B_FAILURE_COLOR)
|
2013-04-16 11:44:42 +04:00
|
|
|
return which - B_SUCCESS_COLOR + kColorWhichCount - 3;
|
2006-04-26 00:12:06 +04:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-07-15 23:05:59 +04:00
|
|
|
|
2008-03-04 04:19:04 +03:00
|
|
|
static inline color_which
|
|
|
|
index_to_color_which(int32 index)
|
|
|
|
{
|
2013-04-16 11:44:42 +04:00
|
|
|
if (index >= 0 && index < kColorWhichCount) {
|
|
|
|
if ((color_which)index < kColorWhichCount - 3)
|
2008-03-04 04:19:04 +03:00
|
|
|
return (color_which)(index + 1);
|
2011-11-14 00:47:27 +04:00
|
|
|
else {
|
|
|
|
return (color_which)(index + B_SUCCESS_COLOR
|
2013-04-16 11:44:42 +04:00
|
|
|
- kColorWhichCount - 3);
|
2011-11-14 00:47:27 +04:00
|
|
|
}
|
2008-03-04 04:19:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return (color_which)-1;
|
|
|
|
}
|
|
|
|
|
2006-04-26 00:12:06 +04:00
|
|
|
#endif /* SERVER_READ_ONLY_MEMORY_H */
|