1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

MouseDemo: Show distinct colors for primary vs secondary button

This shows mouse down of primary button in blue color,
and secondary button in light blue color.
This commit is contained in:
Andreas Oppebøen 2022-11-27 02:33:07 +01:00 committed by Sam Atkins
parent 903bfc3d68
commit 2c142e4c57

View file

@ -79,13 +79,15 @@ public:
auto secondary_pressed = m_buttons & GUI::MouseButton::Secondary;
if (primary_secondary_switched ? secondary_pressed : primary_pressed) {
painter.fill_rect({ 31, 21, 34, 44 }, Color::Blue);
painter.draw_triangle({ 30, 21 }, { 65, 21 }, { 65, 12 }, Color::Blue);
auto button_color = primary_secondary_switched ? Color::LightBlue : Color::MidBlue;
painter.fill_rect({ 31, 21, 34, 44 }, button_color);
painter.draw_triangle({ 30, 21 }, { 65, 21 }, { 65, 12 }, button_color);
}
if (primary_secondary_switched ? primary_pressed : secondary_pressed) {
painter.fill_rect({ 96, 21, 34, 44 }, Color::Blue);
painter.draw_triangle({ 96, 12 }, { 96, 21 }, { 132, 21 }, Color::Blue);
auto button_color = primary_secondary_switched ? Color::MidBlue : Color::LightBlue;
painter.fill_rect({ 96, 21, 34, 44 }, button_color);
painter.draw_triangle({ 96, 12 }, { 96, 21 }, { 132, 21 }, button_color);
}
if (m_buttons & GUI::MouseButton::Middle)