From b453da0696b24cc02a7fcf5127afcd7baef9c801 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 10 Mar 2008 10:57:51 +0000 Subject: [PATCH] Add set_source method to Control --- source/input/control.cpp | 12 ++++++++++++ source/input/control.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/source/input/control.cpp b/source/input/control.cpp index 8ddcdd7..0519d8f 100644 --- a/source/input/control.cpp +++ b/source/input/control.cpp @@ -87,6 +87,18 @@ void Control::cancel_capture() connect_signals(); } +void Control::set_source(Device &d, ControlSrcType t, unsigned i) +{ + set_source(ControlSource(d, t, i)); +} + +void Control::set_source(const ControlSource &s) +{ + notify_callbacks(); + src=s; + connect_signals(); +} + void Control::connect_signals() { switch(src.type) diff --git a/source/input/control.h b/source/input/control.h index f7146b4..1ee21c8 100644 --- a/source/input/control.h +++ b/source/input/control.h @@ -67,6 +67,8 @@ public: void capture(Device &); void cancel_capture(); + void set_source(Device &, ControlSrcType, unsigned); + void set_source(const ControlSource &); const ControlSource &get_source() const { return src; } protected: virtual void on_press() =0; -- 2.45.2