mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:27:34 +00:00
LibGfx+Base: Add Tray/TrayText theme colors and Gfx::ButtonStyle::Tray
A "Tray" is a sunken container area for widgets. The first intended client of this style is the GUI::FilePicker's common locations frame. Thanks to @nvella for coming up with the term "Tray" :^)
This commit is contained in:
parent
e34238945d
commit
11bea5d633
14 changed files with 38 additions and 9 deletions
|
@ -66,6 +66,8 @@ SyntaxPreprocessorStatement=#ffafff
|
||||||
SyntaxPreprocessorValue=orange
|
SyntaxPreprocessorValue=orange
|
||||||
Tooltip=#1f1f1f
|
Tooltip=#1f1f1f
|
||||||
TooltipText=white
|
TooltipText=white
|
||||||
|
Tray=#171717
|
||||||
|
TrayText=white
|
||||||
|
|
||||||
[Metrics]
|
[Metrics]
|
||||||
TitleHeight=24
|
TitleHeight=24
|
||||||
|
|
|
@ -62,6 +62,8 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=#ffffe1
|
Tooltip=#ffffe1
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#9397a5
|
||||||
|
TrayText=white
|
||||||
|
|
||||||
[Metrics]
|
[Metrics]
|
||||||
TitleButtonWidth=17
|
TitleButtonWidth=17
|
||||||
|
|
|
@ -58,3 +58,5 @@ SyntaxPreprocessorStatement=darkgray
|
||||||
SyntaxPreprocessorValue=orange
|
SyntaxPreprocessorValue=orange
|
||||||
Tooltip=#444444
|
Tooltip=#444444
|
||||||
TooltipText=white
|
TooltipText=white
|
||||||
|
Tray=#323232
|
||||||
|
TrayText=white
|
||||||
|
|
|
@ -66,6 +66,8 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=#ffffe1
|
Tooltip=#ffffe1
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#808080
|
||||||
|
TrayText=#ffffff
|
||||||
|
|
||||||
[Metrics]
|
[Metrics]
|
||||||
TitleHeight=19
|
TitleHeight=19
|
||||||
|
|
|
@ -66,6 +66,8 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=white
|
Tooltip=white
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#a28d68
|
||||||
|
TrayText=white
|
||||||
|
|
||||||
[Metrics]
|
[Metrics]
|
||||||
TitleHeight=19
|
TitleHeight=19
|
||||||
|
|
|
@ -58,3 +58,5 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=#ffffe1
|
Tooltip=#ffffe1
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#282828
|
||||||
|
TrayText=white
|
||||||
|
|
|
@ -58,3 +58,5 @@ SyntaxPreprocessorStatement=#ffafff
|
||||||
SyntaxPreprocessorValue=orange
|
SyntaxPreprocessorValue=orange
|
||||||
Tooltip=#4c566a
|
Tooltip=#4c566a
|
||||||
TooltipText=white
|
TooltipText=white
|
||||||
|
Tray=#3b4252
|
||||||
|
TrayText=white
|
||||||
|
|
|
@ -62,6 +62,8 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=#ffffe1
|
Tooltip=#ffffe1
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#808080
|
||||||
|
TrayText=white
|
||||||
|
|
||||||
[Metrics]
|
[Metrics]
|
||||||
TitleButtonWidth=17
|
TitleButtonWidth=17
|
||||||
|
|
|
@ -62,6 +62,8 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=#ffffe1
|
Tooltip=#ffffe1
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#808080
|
||||||
|
TrayText=white
|
||||||
|
|
||||||
[Metrics]
|
[Metrics]
|
||||||
TitleButtonWidth=17
|
TitleButtonWidth=17
|
||||||
|
|
|
@ -58,3 +58,5 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=#ffffe1
|
Tooltip=#ffffe1
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#3b3b3b
|
||||||
|
TrayText=white
|
||||||
|
|
|
@ -62,6 +62,8 @@ SyntaxPreprocessorStatement=#008080
|
||||||
SyntaxPreprocessorValue=#800000
|
SyntaxPreprocessorValue=#800000
|
||||||
Tooltip=#ffffe1
|
Tooltip=#ffffe1
|
||||||
TooltipText=black
|
TooltipText=black
|
||||||
|
Tray=#9397a5
|
||||||
|
TrayText=white
|
||||||
|
|
||||||
[Paths]
|
[Paths]
|
||||||
TitleButtonIcons=/res/icons/themes/Sunshine/16x16/
|
TitleButtonIcons=/res/icons/themes/Sunshine/16x16/
|
||||||
|
|
|
@ -170,7 +170,7 @@ void ClassicStylePainter::paint_button(Painter& painter, const IntRect& rect, co
|
||||||
|
|
||||||
Color button_color = palette.button();
|
Color button_color = palette.button();
|
||||||
Color highlight_color = palette.threed_highlight();
|
Color highlight_color = palette.threed_highlight();
|
||||||
Color shadow_color = palette.threed_shadow1();
|
Color shadow_color = button_style == ButtonStyle::CoolBar ? palette.threed_shadow1() : palette.threed_shadow2();
|
||||||
|
|
||||||
PainterStateSaver saver(painter);
|
PainterStateSaver saver(painter);
|
||||||
painter.translate(rect.location());
|
painter.translate(rect.location());
|
||||||
|
@ -178,11 +178,13 @@ void ClassicStylePainter::paint_button(Painter& painter, const IntRect& rect, co
|
||||||
if (pressed || checked) {
|
if (pressed || checked) {
|
||||||
// Base
|
// Base
|
||||||
IntRect base_rect { 1, 1, rect.width() - 2, rect.height() - 2 };
|
IntRect base_rect { 1, 1, rect.width() - 2, rect.height() - 2 };
|
||||||
|
if (button_style == ButtonStyle::CoolBar) {
|
||||||
if (checked && !pressed) {
|
if (checked && !pressed) {
|
||||||
painter.fill_rect_with_dither_pattern(base_rect, palette.button().lightened(1.3f), palette.button());
|
painter.fill_rect_with_dither_pattern(base_rect, palette.button().lightened(1.3f), Color());
|
||||||
} else {
|
} else {
|
||||||
painter.fill_rect(base_rect, button_color);
|
painter.fill_rect(base_rect, button_color);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sunken shadow
|
// Sunken shadow
|
||||||
painter.draw_line({ 1, 1 }, { rect.width() - 2, 1 }, shadow_color);
|
painter.draw_line({ 1, 1 }, { rect.width() - 2, 1 }, shadow_color);
|
||||||
|
@ -191,9 +193,11 @@ void ClassicStylePainter::paint_button(Painter& painter, const IntRect& rect, co
|
||||||
// Bottom highlight
|
// Bottom highlight
|
||||||
painter.draw_line({ rect.width() - 2, 1 }, { rect.width() - 2, rect.height() - 3 }, highlight_color);
|
painter.draw_line({ rect.width() - 2, 1 }, { rect.width() - 2, rect.height() - 3 }, highlight_color);
|
||||||
painter.draw_line({ 1, rect.height() - 2 }, { rect.width() - 2, rect.height() - 2 }, highlight_color);
|
painter.draw_line({ 1, rect.height() - 2 }, { rect.width() - 2, rect.height() - 2 }, highlight_color);
|
||||||
} else if (button_style == ButtonStyle::CoolBar && hovered) {
|
} else if (hovered) {
|
||||||
|
if (button_style == ButtonStyle::CoolBar) {
|
||||||
// Base
|
// Base
|
||||||
painter.fill_rect({ 1, 1, rect.width() - 2, rect.height() - 2 }, button_color);
|
painter.fill_rect({ 1, 1, rect.width() - 2, rect.height() - 2 }, button_color);
|
||||||
|
}
|
||||||
|
|
||||||
// Top highlight
|
// Top highlight
|
||||||
painter.draw_line({ 1, 1 }, { rect.width() - 2, 1 }, highlight_color);
|
painter.draw_line({ 1, 1 }, { rect.width() - 2, 1 }, highlight_color);
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace Gfx {
|
||||||
|
|
||||||
enum class ButtonStyle {
|
enum class ButtonStyle {
|
||||||
Normal,
|
Normal,
|
||||||
CoolBar
|
CoolBar,
|
||||||
|
Tray,
|
||||||
};
|
};
|
||||||
enum class FrameShadow {
|
enum class FrameShadow {
|
||||||
Plain,
|
Plain,
|
||||||
|
|
|
@ -99,6 +99,8 @@ namespace Gfx {
|
||||||
C(ThreedShadow2) \
|
C(ThreedShadow2) \
|
||||||
C(Tooltip) \
|
C(Tooltip) \
|
||||||
C(TooltipText) \
|
C(TooltipText) \
|
||||||
|
C(Tray) \
|
||||||
|
C(TrayText) \
|
||||||
C(VisitedLink) \
|
C(VisitedLink) \
|
||||||
C(Window) \
|
C(Window) \
|
||||||
C(WindowText)
|
C(WindowText)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue