LibGUI: Include keyboard modifier state with button on_click calls

This will allow you us to implement special behavior when Ctrl+clicking
a button.
This commit is contained in:
Andreas Kling 2020-05-12 20:30:33 +02:00
parent 3a905aed06
commit 977863ea07
Notes: sideshowbarker 2024-07-19 06:42:03 +09:00
37 changed files with 76 additions and 76 deletions

View file

@ -60,7 +60,7 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
auto& button = html_view.add<GUI::Button>(value());
int text_width = Gfx::Font::default_font().width(value());
button.set_relative_rect(0, 0, text_width + 20, 20);
button.on_click = [this] {
button.on_click = [this](auto) {
if (auto* form = first_ancestor_of_type<HTMLFormElement>()) {
// FIXME: Remove this const_cast once we have a non-const first_ancestor_of_type.
const_cast<HTMLFormElement*>(form)->submit(this);