1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

Theming: Add alignment section

This commit removes the IsTitleCenter property and replaces it with
the TitleAlignment property that supports "Left", "Right" & "Center".
This commit is contained in:
Filiph Sandström 2022-01-01 18:26:19 +01:00 committed by Andreas Kling
parent 2bb32a87f9
commit 35dac843b4
21 changed files with 181 additions and 32 deletions

View file

@ -1,6 +1,7 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -13,6 +14,7 @@
#include <LibCore/AnonymousBuffer.h>
#include <LibCore/ConfigFile.h>
#include <LibGfx/Color.h>
#include <LibGfx/TextAlignment.h>
namespace Gfx {
@ -90,9 +92,11 @@ namespace Gfx {
C(Window) \
C(WindowText)
#define ENUMERATE_ALIGNMENT_ROLES(C) \
C(TitleAlignment)
#define ENUMERATE_FLAG_ROLES(C) \
C(IsDark) \
C(IsTitleCenter)
C(IsDark)
#define ENUMERATE_METRIC_ROLES(C) \
C(BorderThickness) \
@ -139,6 +143,33 @@ inline const char* to_string(ColorRole role)
}
}
enum class AlignmentRole {
NoRole,
#undef __ENUMERATE_ALIGNMENT_ROLE
#define __ENUMERATE_ALIGNMENT_ROLE(role) role,
ENUMERATE_ALIGNMENT_ROLES(__ENUMERATE_ALIGNMENT_ROLE)
#undef __ENUMERATE_ALIGNMENT_ROLE
__Count,
};
inline const char* to_string(AlignmentRole role)
{
switch (role) {
case AlignmentRole::NoRole:
return "NoRole";
#undef __ENUMERATE_ALIGNMENT_ROLE
#define __ENUMERATE_ALIGNMENT_ROLE(role) \
case AlignmentRole::role: \
return #role;
ENUMERATE_ALIGNMENT_ROLES(__ENUMERATE_ALIGNMENT_ROLE)
#undef __ENUMERATE_ALIGNMENT_ROLE
default:
VERIFY_NOT_REACHED();
}
}
enum class FlagRole {
NoRole,
@ -222,6 +253,7 @@ inline const char* to_string(PathRole role)
struct SystemTheme {
RGBA32 color[(int)ColorRole::__Count];
Gfx::TextAlignment alignment[(int)AlignmentRole::__Count];
bool flag[(int)FlagRole::__Count];
int metric[(int)MetricRole::__Count];
char path[(int)PathRole::__Count][256]; // TODO: PATH_MAX?