1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +00:00

LibGUI: Allow disabling the alpha channel in ColorInput widgets

This commit is contained in:
Andreas Kling 2020-04-29 15:32:18 +02:00
parent 17e76b4760
commit c7107385ee
2 changed files with 19 additions and 1 deletions

View file

@ -70,6 +70,19 @@ void ColorInput::set_color(Color color)
set_text(color.to_string());
};
void ColorInput::set_color_has_alpha_channel(bool has_alpha)
{
if (m_color_has_alpha_channel == has_alpha)
return;
m_color_has_alpha_channel = has_alpha;
m_color.set_alpha(0xff);
if (!has_alpha)
set_text(m_color.to_string_without_alpha());
else
set_text(m_color.to_string());
}
void ColorInput::mousedown_event(MouseEvent& event)
{
if (event.button() == MouseButton::Left) {