From ee28496955341ed66375ecaa123187c17a085370 Mon Sep 17 00:00:00 2001 From: and3md Date: Thu, 21 Sep 2017 18:31:08 +0200 Subject: [PATCH] Ability to foreach action in accelerator map. --- src/dlangui/core/events.d | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/dlangui/core/events.d b/src/dlangui/core/events.d index 06fd8353..00176063 100644 --- a/src/dlangui/core/events.d +++ b/src/dlangui/core/events.d @@ -613,6 +613,18 @@ struct ActionMap { } return null; } + + int opApply(int delegate(ref Action) op) { + int result = 0; + foreach (ref Accelerator acc; _map.byKey) { + result = op(_map[acc]); + + if (result) + break; + } + return result; + } + } /// List of Actions, for looking up Action by key