template class EE::UI::UICommandBindingSet

Overview

Owns a command together with its primary widget and shortcut bindings. More…

#include <uicommand.hpp>

template <typename ShortcutTarget>
class UICommandBindingSet {
public:
    // construction

    UICommandBindingSet(std::function<void()> execute, UIWidget& widget, ShortcutTarget& shortcutTarget, const KeyBindings::Shortcut& shortcut);

    template <typename Source>
    UICommandBindingSet(std::function<void()> execute, Source& enabled, UIWidget& widget, ShortcutTarget& shortcutTarget, const KeyBindings::Shortcut& shortcut);

    UICommandBindingSet(const UICommandBindingSet&);
    UICommandBindingSet(UICommandBindingSet&&);

    // methods

    UICommandBindingSet& operator=(const UICommandBindingSet&);
    UICommandBindingSet& operator=(UICommandBindingSet&&);
    UICommand& command();
    const UICommand& command() const;
};

Detailed Documentation

Owns a command together with its primary widget and shortcut bindings.

This is the concise form for the common case where an action is exposed by one clickable widget and one default shortcut. Keep the returned object alive for as long as both bindings are needed.

Construction

UICommandBindingSet(std::function<void()> execute, UIWidget& widget, ShortcutTarget& shortcutTarget, const KeyBindings::Shortcut& shortcut)

Creates an always-enabled command with widget and shortcut endpoints.

template <typename Source>
UICommandBindingSet(std::function<void()> execute, Source& enabled, UIWidget& widget, ShortcutTarget& shortcutTarget, const KeyBindings::Shortcut& shortcut)

Creates a command following enabled with widget and shortcut endpoints.

Methods

UICommand& command()

Returns:

The owned command for explicit execution or additional endpoint bindings.

const UICommand& command() const

Returns:

The owned command.