Program Listing for File simulated_secondary_click.h

Return to documentation for file (include/miral/miral/simulated_secondary_click.h)

/*
 * Copyright © Canonical Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 or 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MIRAL_SIMULATED_SECONDARY_CLICK_H
#define MIRAL_SIMULATED_SECONDARY_CLICK_H

#include <chrono>
#include <functional>
#include <memory>

namespace mir
{
class Server;
}

namespace miral
{
namespace live_config
{
class Store;
}
class SimulatedSecondaryClick
{
public:
    explicit SimulatedSecondaryClick(live_config::Store& config_store);

    auto static enabled() -> SimulatedSecondaryClick;

    auto static disabled() -> SimulatedSecondaryClick;

    void operator()(mir::Server& server);

    SimulatedSecondaryClick& enable();

    SimulatedSecondaryClick& disable();

    SimulatedSecondaryClick& hold_duration(std::chrono::milliseconds hold_duration);

    SimulatedSecondaryClick& displacement_threshold(float displacement);

    SimulatedSecondaryClick& on_hold_start(std::function<void()>&& on_hold_start);

    SimulatedSecondaryClick& on_hold_cancel(std::function<void()>&& on_hold_cancel);

    SimulatedSecondaryClick& on_secondary_click(std::function<void()>&& on_secondary_click);

private:
    struct Self;
    SimulatedSecondaryClick(std::shared_ptr<Self> self);
    std::shared_ptr<Self> self;
};
}

#endif // MIRAL_SIMULATED_SECONDARY_CLICK_H