1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:27:35 +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
*/
@ -31,6 +32,12 @@ public:
return Color::from_rgba(theme().color[(int)role]);
}
Gfx::TextAlignment alignment(AlignmentRole role) const
{
VERIFY((int)role < (int)AlignmentRole::__Count);
return theme().alignment[(int)role];
}
bool flag(FlagRole role) const
{
VERIFY((int)role < (int)FlagRole::__Count);
@ -125,8 +132,9 @@ public:
Color syntax_preprocessor_statement() const { return color(ColorRole::SyntaxPreprocessorStatement); }
Color syntax_preprocessor_value() const { return color(ColorRole::SyntaxPreprocessorValue); }
Gfx::TextAlignment title_alignment() const { return alignment(AlignmentRole::TitleAlignment); }
bool is_dark() const { return flag(FlagRole::IsDark); }
bool is_title_center() const { return flag(FlagRole::IsTitleCenter); }
int window_border_thickness() const { return metric(MetricRole::BorderThickness); }
int window_border_radius() const { return metric(MetricRole::BorderRadius); }
@ -142,11 +150,13 @@ public:
String tooltip_shadow_path() const { return path(PathRole::TooltipShadow); }
Color color(ColorRole role) const { return m_impl->color(role); }
Gfx::TextAlignment alignment(AlignmentRole role) const { return m_impl->alignment(role); }
bool flag(FlagRole role) const { return m_impl->flag(role); }
int metric(MetricRole role) const { return m_impl->metric(role); }
String path(PathRole role) const { return m_impl->path(role); }
void set_color(ColorRole, Color);
void set_alignment(AlignmentRole, Gfx::TextAlignment);
void set_flag(FlagRole, bool);
void set_metric(MetricRole, int);
void set_path(PathRole, String);