2008-08-27 20:07:36 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-08-27 20:07:36 +04:00
|
|
|
|
|
|
|
#ifndef nsNativeThemeColors_h_
|
|
|
|
#define nsNativeThemeColors_h_
|
|
|
|
|
2012-05-17 11:53:20 +04:00
|
|
|
#include "nsCocoaFeatures.h"
|
2008-08-27 20:07:36 +04:00
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
enum ColorName {
|
2009-01-06 18:46:59 +03:00
|
|
|
toolbarTopBorderGrey,
|
2011-08-08 18:42:20 +04:00
|
|
|
toolbarFillGrey,
|
|
|
|
toolbarBottomBorderGrey,
|
2008-08-27 20:07:36 +04:00
|
|
|
};
|
|
|
|
|
2009-09-22 11:48:55 +04:00
|
|
|
static const int sSnowLeopardThemeColors[][2] = {
|
|
|
|
/* { active window, inactive window } */
|
2011-08-08 18:42:20 +04:00
|
|
|
// toolbar:
|
2009-09-22 11:48:55 +04:00
|
|
|
{ 0xD0, 0xF1 }, // top separator line
|
2011-08-08 18:42:20 +04:00
|
|
|
{ 0xA7, 0xD8 }, // fill color
|
|
|
|
{ 0x51, 0x99 }, // bottom separator line
|
2009-09-22 11:48:55 +04:00
|
|
|
};
|
|
|
|
|
2011-08-08 18:42:27 +04:00
|
|
|
static const int sLionThemeColors[][2] = {
|
|
|
|
/* { active window, inactive window } */
|
|
|
|
// toolbar:
|
|
|
|
{ 0xD0, 0xF0 }, // top separator line
|
|
|
|
{ 0xB2, 0xE1 }, // fill color
|
|
|
|
{ 0x59, 0x87 }, // bottom separator line
|
|
|
|
};
|
|
|
|
|
2011-03-23 21:46:57 +03:00
|
|
|
__attribute__((unused))
|
2008-08-27 20:07:36 +04:00
|
|
|
static int NativeGreyColorAsInt(ColorName name, BOOL isMain)
|
|
|
|
{
|
2012-05-17 11:53:20 +04:00
|
|
|
if (nsCocoaFeatures::OnLionOrLater())
|
2011-08-08 18:42:27 +04:00
|
|
|
return sLionThemeColors[name][isMain ? 0 : 1];
|
|
|
|
|
2012-11-09 14:22:36 +04:00
|
|
|
return sSnowLeopardThemeColors[name][isMain ? 0 : 1];
|
2008-08-27 20:07:36 +04:00
|
|
|
}
|
|
|
|
|
2011-03-23 21:46:57 +03:00
|
|
|
__attribute__((unused))
|
2008-08-27 20:07:36 +04:00
|
|
|
static float NativeGreyColorAsFloat(ColorName name, BOOL isMain)
|
|
|
|
{
|
|
|
|
return NativeGreyColorAsInt(name, isMain) / 255.0f;
|
|
|
|
}
|
|
|
|
|
2011-03-23 21:46:57 +03:00
|
|
|
__attribute__((unused))
|
2009-08-04 02:27:31 +04:00
|
|
|
static void DrawNativeGreyColorInRect(CGContextRef context, ColorName name,
|
|
|
|
CGRect rect, BOOL isMain)
|
2008-08-27 20:07:36 +04:00
|
|
|
{
|
2009-08-04 02:27:31 +04:00
|
|
|
float grey = NativeGreyColorAsFloat(name, isMain);
|
|
|
|
CGContextSetRGBFillColor(context, grey, grey, grey, 1.0f);
|
|
|
|
CGContextFillRect(context, rect);
|
2008-08-27 20:07:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // nsNativeThemeColors_h_
|