mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00

(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
169 lines
5.3 KiB
C++
169 lines
5.3 KiB
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
* list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
* and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Forward.h>
|
|
#include <AK/String.h>
|
|
#include <AK/Types.h>
|
|
#include <LibCore/AnonymousBuffer.h>
|
|
#include <LibGfx/Color.h>
|
|
|
|
namespace Gfx {
|
|
|
|
#define ENUMERATE_COLOR_ROLES(C) \
|
|
C(ActiveLink) \
|
|
C(ActiveWindowBorder1) \
|
|
C(ActiveWindowBorder2) \
|
|
C(ActiveWindowTitle) \
|
|
C(ActiveWindowTitleShadow) \
|
|
C(ActiveWindowTitleStripes) \
|
|
C(Base) \
|
|
C(BaseText) \
|
|
C(Button) \
|
|
C(ButtonText) \
|
|
C(DesktopBackground) \
|
|
C(FocusOutline) \
|
|
C(HighlightWindowBorder1) \
|
|
C(HighlightWindowBorder2) \
|
|
C(HighlightWindowTitle) \
|
|
C(HighlightWindowTitleShadow) \
|
|
C(HighlightWindowTitleStripes) \
|
|
C(HighlightSearching) \
|
|
C(HighlightSearchingText) \
|
|
C(HoverHighlight) \
|
|
C(InactiveSelection) \
|
|
C(InactiveSelectionText) \
|
|
C(InactiveWindowBorder1) \
|
|
C(InactiveWindowBorder2) \
|
|
C(InactiveWindowTitle) \
|
|
C(InactiveWindowTitleShadow) \
|
|
C(InactiveWindowTitleStripes) \
|
|
C(Link) \
|
|
C(MenuBase) \
|
|
C(MenuBaseText) \
|
|
C(MenuSelection) \
|
|
C(MenuSelectionText) \
|
|
C(MenuStripe) \
|
|
C(MovingWindowBorder1) \
|
|
C(MovingWindowBorder2) \
|
|
C(MovingWindowTitle) \
|
|
C(MovingWindowTitleShadow) \
|
|
C(MovingWindowTitleStripes) \
|
|
C(PlaceholderText) \
|
|
C(RubberBandBorder) \
|
|
C(RubberBandFill) \
|
|
C(Ruler) \
|
|
C(RulerActiveText) \
|
|
C(RulerBorder) \
|
|
C(RulerInactiveText) \
|
|
C(Selection) \
|
|
C(SelectionText) \
|
|
C(SyntaxComment) \
|
|
C(SyntaxControlKeyword) \
|
|
C(SyntaxIdentifier) \
|
|
C(SyntaxKeyword) \
|
|
C(SyntaxNumber) \
|
|
C(SyntaxOperator) \
|
|
C(SyntaxPreprocessorStatement) \
|
|
C(SyntaxPreprocessorValue) \
|
|
C(SyntaxPunctuation) \
|
|
C(SyntaxString) \
|
|
C(SyntaxType) \
|
|
C(TextCursor) \
|
|
C(ThreedHighlight) \
|
|
C(ThreedShadow1) \
|
|
C(ThreedShadow2) \
|
|
C(Tooltip) \
|
|
C(TooltipText) \
|
|
C(VisitedLink) \
|
|
C(Window) \
|
|
C(WindowText)
|
|
|
|
enum class ColorRole {
|
|
NoRole,
|
|
|
|
#undef __ENUMERATE_COLOR_ROLE
|
|
#define __ENUMERATE_COLOR_ROLE(role) role,
|
|
ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
|
|
#undef __ENUMERATE_COLOR_ROLE
|
|
|
|
__Count,
|
|
|
|
Background = Window,
|
|
DisabledText = ThreedShadow1,
|
|
};
|
|
|
|
inline const char* to_string(ColorRole role)
|
|
{
|
|
switch (role) {
|
|
case ColorRole::NoRole:
|
|
return "NoRole";
|
|
#undef __ENUMERATE_COLOR_ROLE
|
|
#define __ENUMERATE_COLOR_ROLE(role) \
|
|
case ColorRole::role: \
|
|
return #role;
|
|
ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
|
|
#undef __ENUMERATE_COLOR_ROLE
|
|
default:
|
|
VERIFY_NOT_REACHED();
|
|
}
|
|
}
|
|
|
|
enum class MetricRole {
|
|
NoRole,
|
|
TitleHeight,
|
|
TitleButtonWidth,
|
|
TitleButtonHeight,
|
|
__Count,
|
|
};
|
|
|
|
enum class PathRole {
|
|
NoRole,
|
|
TitleButtonIcons,
|
|
InactiveWindowShadow,
|
|
ActiveWindowShadow,
|
|
TaskBarShadow,
|
|
MenuBarShadow,
|
|
MenuShadow,
|
|
TooltipShadow,
|
|
__Count,
|
|
};
|
|
|
|
struct SystemTheme {
|
|
RGBA32 color[(int)ColorRole::__Count];
|
|
int metric[(int)MetricRole::__Count];
|
|
char path[(int)PathRole::__Count][256]; // TODO: PATH_MAX?
|
|
};
|
|
|
|
const SystemTheme& current_system_theme();
|
|
Core::AnonymousBuffer& current_system_theme_buffer();
|
|
void set_system_theme(Core::AnonymousBuffer);
|
|
Core::AnonymousBuffer load_system_theme(const String& path);
|
|
|
|
}
|
|
|
|
using Gfx::ColorRole;
|